windowsforms-devexpress-dot-xtraverticalgrid-dot-propertygridcontrol-2b42ad7e.md
Allows you to customize brick buttons that invoke a context menu (the Office view only).
Namespace : DevExpress.XtraVerticalGrid
Assembly : DevExpress.XtraVerticalGrid.v25.2.dll
NuGet Packages : DevExpress.Win.Navigation, DevExpress.Win.VerticalGrid
public event CustomDrawRowBrickEventHandler CustomDrawRowBrick
Public Event CustomDrawRowBrick As CustomDrawRowBrickEventHandler
The CustomDrawRowBrick event's data class is DevExpress.XtraVerticalGrid.Events.CustomDrawRowBrickEventArgs.
In the Office view (see PropertyGridControl.ActiveViewType), you can display brick buttons against properties by setting the PropertyGridControl.OptionsView.ShowRowBrick property to True (see PGridOptionsView.ShowRowBrick). The CustomDrawRowBrick event allows you to customize the brick buttons.
private void propertyGridControl1_CustomDrawRowBrick(object sender, DevExpress.XtraVerticalGrid.Events.CustomDrawRowBrickEventArgs e) {
e.Handled = true;
Size size = new Size(7, 7);
Rectangle bounds = RectangleHelper.GetCenterBounds(e.RowBrickInfo.BrickArea, size);
if (e.RowBrickInfo.State == DevExpress.Utils.Drawing.ObjectState.Normal)
e.Cache.FillRectangle(Color.Transparent, bounds);
if (e.RowBrickInfo.State == DevExpress.Utils.Drawing.ObjectState.Hot)
e.Cache.FillRectangle(Color.LightGray, bounds);
e.Cache.DrawRectangle(bounds, Color.DarkGray, e.RowBrickInfo.BorderThickness);
}
Private Sub propertyGridControl1_CustomDrawRowBrick(ByVal sender As Object, ByVal e As DevExpress.XtraVerticalGrid.Events.CustomDrawRowBrickEventArgs) _
Handles propertyGridControl1.CustomDrawRowBrick
e.Handled = True
Dim size1 As New Size(7, 7)
Dim bounds1 As Rectangle = RectangleHelper.GetCenterBounds(e.RowBrickInfo.BrickArea, size1)
If e.RowBrickInfo.State = DevExpress.Utils.Drawing.ObjectState.Normal Then
e.Cache.FillRectangle(Color.Transparent, bounds1)
End If
If e.RowBrickInfo.State = DevExpress.Utils.Drawing.ObjectState.Hot Then
e.Cache.FillRectangle(Color.LightGray, bounds1)
End If
e.Cache.DrawRectangle(bounds1, Color.DarkGray, e.RowBrickInfo.BorderThickness)
End Sub
To populate a context menu invoked with a click on a brick button, handle the PropertyGridControl.RowBrickMenuShowing event.
See Also