private void AdditionalBMController_CustomDrawBandHeader(object sender, DevExpress.XtraGrid.Views.BandedGrid.BandHeaderCustomDrawEventArgs e)
{
if (e.Band != null )
{
if (e.Band.ReallyVisible == false || e.Band.HasChildren == false)
return;
if (e.Graphics.ClipBounds.Width > e.Info.CaptionRect.Width)
return;
e.Info.Caption = "";
e.Painter.DrawObject(e.Info);
System.Drawing.Drawing2D.GraphicsState state = e.Graphics.Save();
Rectangle r = e.Info.CaptionRect;
StringFormat sf = new StringFormat();
sf.FormatFlags = sf.FormatFlags;// | StringFormatFlags.NoWrap;
sf.Alignment = StringAlignment.Center;
int gwidth = Convert.ToInt32(e.Graphics.ClipBounds.Width);
int gx = Convert.ToInt32(e.Graphics.ClipBounds.X);
int heigh = (int)e.Info.CaptionRect.Height;
int width = e.Info.CaptionRect.Width > gwidth ? gwidth : e.Info.CaptionRect.Width;
int sX = e.Info.CaptionRect.Width + e.Info.CaptionRect.Location.X - (int)e.Graphics.ClipBounds.X;
int x = e.Info.CaptionRect.Location.X > gx ? e.Info.CaptionRect.Location.X : sX < gx ? sX : gx;
int y = (int)e.Info.CaptionRect.Location.Y;
r.X = x;
r.Y = y;
r.Width = width;
r.Height = heigh;
e.Handled = true;
e.Graphics.DrawString(e.Band.Caption, e.Appearance.Font, e.Appearance.GetForeBrush(e.Cache), r, sf);
e.Graphics.Restore(state);
}
}
긴 Band Header가 있는 경우 화면에 Caption이 표시되지 않는 문제 처리
'.Net Framework Standard > Component' 카테고리의 다른 글
Devexpress GridContro/ TreeList Indicator Header에 버튼 추가 (0) | 2024.07.03 |
---|---|
[Devexpress] TreeListControl - Raise AfterCheckNode / BeforeCheckNode (0) | 2024.05.10 |
Devexpress TreeList Multiple FooterRow - CustomDrawFooterCell (0) | 2024.01.30 |
[Devexpress]Form Control 및 Devexpress Ribbon의 TabView의 Perfomance (0) | 2016.08.01 |