A newer version of this page is available.
Switch to the current version.
GroupCaptionCustomDrawEventArgs Class
Provides data for the GroupControl.CustomDrawCaption event.
Namespace: DevExpress.XtraEditors
Assembly: DevExpress.Utils.v19.2.dll
Declaration
public class GroupCaptionCustomDrawEventArgs :
ObjectCustomDrawEventArgs
Public Class GroupCaptionCustomDrawEventArgs
Inherits ObjectCustomDrawEventArgs
Remarks
The GroupControl.CustomDrawCaption event fires before the group's caption is painted. It enables you to paint the group control caption manually. The GroupCaptionCustomDrawEventArgs class provides properties that allow information about the group whose caption is being painted to be obtained.
Examples
The following example demonstrates how to handle the GroupControl.CustomDrawCaption event to manually paint a group control's caption.
The image below shows the result.
using System.Drawing.Drawing2D;
using DevExpress.XtraEditors;
// ...
private void groupControl1_CustomDrawCaption(object sender, GroupCaptionCustomDrawEventArgs e) {
LinearGradientBrush outerBrush = new LinearGradientBrush(e.CaptionBounds,
Color.LightBlue, Color.Blue, LinearGradientMode.Vertical);
using(outerBrush) {
e.Graphics.FillRectangle(outerBrush, e.CaptionBounds);
}
Rectangle innerRect = Rectangle.Inflate(e.CaptionBounds, -3, -3);
LinearGradientBrush innerBrush = new LinearGradientBrush(innerRect, Color.Blue,
Color.LightBlue, LinearGradientMode.Vertical);
using(innerBrush) {
e.Graphics.FillRectangle(innerBrush, e.CaptionBounds);
}
StringFormat outStrFormat = new StringFormat();
outStrFormat.Alignment = StringAlignment.Center;
outStrFormat.LineAlignment = StringAlignment.Center;
e.Graphics.DrawString(e.Info.Caption, e.Info.AppearanceCaption.Font,
e.Cache.GetSolidBrush(Color.White), innerRect, outStrFormat);
e.Handled = true;
}
Inheritance
See Also
Feedback