VGridControlBase.CustomDrawCaption Event
In This Article
Allows you to paint the control’s caption.
Namespace: DevExpress.XtraVerticalGrid
Assembly: DevExpress.XtraVerticalGrid.v24.2.dll
NuGet Packages: DevExpress.Win.Navigation, DevExpress.Win.VerticalGrid
#Declaration
#Event Data
The CustomDrawCaption event's data class is DevExpress.XtraVerticalGrid.Events.CustomDrawCaptionEventArgs.
#Remarks
The following example handles the CustomDrawCaption
event to paint the Vertical Grid’s caption.
using DevExpress.XtraVerticalGrid.Events;
private void vGridControl1_CustomDrawCaption(object sender, CustomDrawCaptionEventArgs e) {
LinearGradientBrush outerBrush = new LinearGradientBrush(e.Bounds, Color.LightBlue, Color.Blue, LinearGradientMode.Vertical);
using(outerBrush) {
e.Cache.FillRectangle(outerBrush, e.Bounds);
}
Rectangle innerRect = Rectangle.Inflate(e.Bounds, -3, -3);
LinearGradientBrush innerBrush = new LinearGradientBrush(innerRect, Color.Blue, Color.LightBlue, LinearGradientMode.Vertical);
using(innerBrush) {
e.Cache.FillRectangle(innerBrush, e.Bounds);
}
StringFormat outStrFormat = new StringFormat();
outStrFormat.Alignment = StringAlignment.Center;
outStrFormat.LineAlignment = StringAlignment.Center;
e.Cache.DrawString(e.DisplayText, e.Appearance.Font, e.Cache.GetSolidBrush(Color.White), innerRect, outStrFormat);
e.Handled = true;
}
See Also