protected override void OnPaint(PaintEventArgs e) { //base.OnPaint(e); e.Graphics.TextRenderingHint = TextRenderingHint; for (int i = 0; i < line_count; i++) { FetchInfoToDislayEventArgs eArgs = new FetchInfoToDislayEventArgs(i); OnFetchInfoToDislay(eArgs); string_format.Trimming = eArgs.DisplayTrimming; string_format.Alignment = eArgs.Alignment; Brush fore_brush = null; Brush back_brush = null; fore_brush = brushes.GetBrush(eArgs.Colors.ForegroundColor); back_brush = brushes.GetBrush(eArgs.Colors.BackgroundColor); e.Graphics.FillRectangle(back_brush, line_rects[i]); e.Graphics.DrawString (eArgs.DisplayText, Font, fore_brush, line_rects[i], string_format); } }
private void OnFetchInfoToDislay(FetchInfoToDislayEventArgs e) { if (FetchInfoToDislay != null) { FetchInfoToDislay(this, e); } }
protected override void OnPaintBackground(PaintEventArgs e) { FetchInfoToDislayEventArgs eArgs = new FetchInfoToDislayEventArgs(-1); OnFetchInfoToDislay(eArgs); e.Graphics.FillRectangle(brushes.GetBrush(eArgs.Colors.BackgroundColor), ClientRectangle); if (show_border) { ControlPaint.DrawBorder3D (e.Graphics, ClientRectangle); } }
void inner_InfoPanel_FetchInfoToDislay(object sender, FetchInfoToDislayEventArgs e) { if (internal_source == null) { e.DisplayText = string.Empty; } else { switch (e.LineIndex) { case 0: e.DisplayText = inner_ListControl.FocusedIndex >= internal_source.ItemCount ? string.Empty : internal_source.GetItemDisplayNameLong(inner_ListControl.FocusedIndex); e.DisplayTrimming = StringTrimming.EllipsisCharacter; e.Alignment = StringAlignment.Near; break; case 1: e.DisplayText = inner_ListControl.FocusedIndex >= internal_source.ItemCount ? string.Empty : internal_source.GetItemDisplaySummaryInfo(inner_ListControl.FocusedIndex); e.DisplayTrimming = StringTrimming.EllipsisCharacter; e.Alignment = StringAlignment.Near; break; case 2: if (inner_ListControl.GetSelectionCount() != 0) { e.DisplayText = internal_source.GetSummaryInfo(inner_ListControl.GetSelectionIndices()); } else { e.DisplayText = internal_source.GetSummaryInfo(); } e.DisplayTrimming = StringTrimming.EllipsisCharacter; e.Alignment = StringAlignment.Near; break; } } e.Colors = Options.GetItemColors(string.Empty, ItemState.None, ItemCategory.Default); }