/// <summary> /// 重写OnDrawItem事件 /// </summary> /// <param name="e"></param> protected override void OnDrawItem(System.Windows.Forms.DrawItemEventArgs e) { Rectangle tabArea; RectangleF tabTextArea; tabArea = this.GetTabRect(e.Index); //主要是做个转换来获得TAB项的RECTANGELF tabTextArea = (RectangleF)(this.GetTabRect(e.Index)); StringFormat sf = new StringFormat(); //封装文本布局信息 sf.LineAlignment = StringAlignment.Center; sf.Alignment = StringAlignment.Center; SolidBrush brush = new SolidBrush(_tabPageTextForeColor); //绘制背景的画笔 SolidBrush backBrush; if (this.SelectedIndex == e.Index) //选中页 { backBrush = new SolidBrush(_tabPageTextCurBackColor); } else { backBrush = new SolidBrush(_tabPageTextBackColor); } e.Graphics.FillRectangle(backBrush, tabArea); //绘制文字 e.Graphics.DrawString(this.TabPages[e.Index].Text, this.Font, brush, tabTextArea, sf); base.OnDrawItem(e); }
private void ListBox1_DrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e) { if (e.Index == -1) { return; } int i = System.Convert.ToInt32(ListBox1.Items[e.Index]); e.DrawBackground(); if (i % 4 != 0) { string spaces = new string(' ', 20); e.Graphics.DrawString( "Item #: " + i.ToString() + spaces.Replace(" ", " <Filler>"), ListBox1.Font, System.Drawing.Brushes.Black, 0, e.Bounds.Top); } else { e.Graphics.DrawLine( System.Drawing.Pens.Blue, 10, e.Bounds.Top + 1, 52, e.Bounds.Top + 1); } e.DrawFocusRectangle(); }
private void StyleComboBox_DrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e) { if (this.iarray_0.Count != 0) { e.DrawBackground(); try { IStyleGalleryItem styleGalleryItem = this.iarray_0.get_Element(e.Index) as IStyleGalleryItem; if (styleGalleryItem != null) { System.IntPtr hdc = e.Graphics.GetHdc(); IStyleDraw styleDraw = StyleDrawFactory.CreateStyleDraw(styleGalleryItem.Item); if (styleDraw != null) { e.Bounds.Inflate(-2, -4); styleDraw.Draw(hdc.ToInt32(), e.Bounds, 72.0, 1.0); } e.Graphics.ReleaseHdc(hdc); } else { Brush brush = new SolidBrush(e.ForeColor); e.Graphics.DrawString(base.Items[e.Index].ToString(), e.Font, brush, (float)(e.Bounds.Left + 3), (float)(e.Bounds.Top + 3)); } } catch { } } }
public void EventAllConfigsLB_DrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e) { System.Windows.Forms.ListBox _ListBox = (System.Windows.Forms.ListBox)sender; e.DrawBackground(); System.Drawing.Brush myBrush = System.Drawing.Brushes.White; string currentItem = _ListBox.Items[e.Index].ToString(); if (_ListBox.SelectedIndex != e.Index)//e.State != System.Windows.Forms.DrawItemState.Selected)// { string currItemValue = currentItem.Split('=').Last(); if (currItemValue == "enabled") { myBrush = System.Drawing.Brushes.DarkGreen; } else if (currItemValue == "disabled") { myBrush = System.Drawing.Brushes.DarkRed; } else// if (currItemValue == "enabled(auto)") { myBrush = System.Drawing.Brushes.Black; } } e.Graphics.DrawString(currentItem, e.Font, myBrush, e.Bounds, System.Drawing.StringFormat.GenericDefault); }
public void DrawItem(System.Windows.Forms.DrawItemEventArgs e) { Graphics g = e.Graphics; using (Pen pen = new Pen(new SolidBrush(Color.Black))) { pen.Width = 2; pen.DashStyle = DashStyle; if (e.State == System.Windows.Forms.DrawItemState.HotLight) { g.FillRectangle(new SolidBrush(Color.Blue), e.Bounds); g.DrawLine(pen, new PointF(e.Bounds.Left, e.Bounds.Top + e.Bounds.Height / 2 - Pens.Red.Width / 2), new PointF(e.Bounds.Left + e.Bounds.Width, e.Bounds.Top + e.Bounds.Height / 2 - Pens.Red.Width / 2)); } else if (((int)(e.State & System.Windows.Forms.DrawItemState.Selected)) != 0) { Color clr = Color.FromArgb(255, 195, 255, 255); g.FillRectangle(new SolidBrush(clr), e.Bounds); g.DrawLine(pen, new PointF(e.Bounds.Left, e.Bounds.Top + e.Bounds.Height / 2 - Pens.Red.Width / 2), new PointF(e.Bounds.Left + e.Bounds.Width, e.Bounds.Top + e.Bounds.Height / 2 - Pens.Red.Width / 2)); } else { g.FillRectangle(new SolidBrush(Color.White), e.Bounds); g.DrawLine(pen, new PointF(e.Bounds.Left, e.Bounds.Top + e.Bounds.Height / 2 - Pens.Red.Width / 2), new PointF(e.Bounds.Left + e.Bounds.Width, e.Bounds.Top + e.Bounds.Height / 2 - Pens.Red.Width / 2)); } } }
protected override void OnDrawItem(System.Windows.Forms.DrawItemEventArgs e) { if (e.Index >= 0) { bool strikeOut = false; if (this.Items[e.Index].GetType() == typeof(dal.WorkOrder)) { strikeOut = ((dal.WorkOrder) this.Items[e.Index]).Complete; } string text = this.Items[e.Index].ToString(); bool complete = text.EndsWith("--") || strikeOut; if (complete) { text = text.Trim('-'); } Color fore = Color.Black; //Will be overridden Color back = Color.Black; //Will be overridden if (System.Convert.ToBoolean(e.State & System.Windows.Forms.DrawItemState.Selected)) { //Item selected? fore = Aerial.db.Properties.Settings.Default.SelectedForeColor; back = Aerial.db.Properties.Settings.Default.SelectedBackColor; } else { if (complete) { fore = Aerial.db.Properties.Settings.Default.FinishedForeColor; } else { fore = Aerial.db.Properties.Settings.Default.ControlForeColor; } back = Aerial.db.Properties.Settings.Default.ControlBackColor; } //Draw Background e.Graphics.DrawRectangle(new Pen(back), e.Bounds); e.Graphics.FillRectangle(new SolidBrush(back), e.Bounds); //Draw Text Brush brush = new SolidBrush(fore); StringFormat sf = new StringFormat(); sf.LineAlignment = StringAlignment.Center; sf.Alignment = StringAlignment.Near; Font f = e.Font; if (complete) { f = new Font(e.Font, FontStyle.Strikeout); } e.Graphics.DrawString(text, f, brush, e.Bounds, sf); } System.Windows.Forms.ControlPaint.DrawBorder(e.Graphics, base.ClientRectangle, this.BorderColor, System.Windows.Forms.ButtonBorderStyle.Solid); }
private void ColorRampComboBox_DrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e) { if (this.iarray_0.Count != 0) { e.DrawBackground(); System.IntPtr hdc = e.Graphics.GetHdc(); this.DrawColorRamp(hdc.ToInt32(), e.Bounds, (IColorRamp)this.iarray_0.get_Element(e.Index)); e.Graphics.ReleaseHdc(hdc); } }
private void ListBox_DrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e) { string text = uiListBox1.GetItemText(e.Index); if (text.Contains("6")) { e.Graphics.FillRectangle(UIColor.Green, e.Bounds); e.Graphics.DrawString(text, e.Font, Color.Blue, e.Bounds); } }
private void listBox1_DrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e) { try { if (editStyle == EditStyle.dash) { LineDashStyle style = (LineDashStyle)listBox1.Items[e.Index]; using (var bitmap = Current.Engine.CreateBitmap(e.Bounds.Width, e.Bounds.Height)) using (var canvas = bitmap.CreateCanvas()) using (var pen = Current.Engine.CreatePen(ArgbColor.Black, 2)) { if (style == (LineDashStyle)_style) { using (var brush = Current.Engine.CreateSolidBrush(ArgbColor.Yellow)) { canvas.FillRectangle(brush, new CanvasRectangle(0, 0, e.Bounds.Width, e.Bounds.Height)); } } pen.DashStyle = style; canvas.DrawLine(pen, 5, bitmap.Height / 2, bitmap.Width - 10, bitmap.Height / 2); e.Graphics.DrawImage(bitmap.ToGdiBitmap(), e.Bounds.Left, e.Bounds.Top); } } else if (editStyle == EditStyle.hatch) { HatchStyle style = (HatchStyle)listBox1.Items[e.Index]; using (var bitmap = Current.Engine.CreateBitmap(e.Bounds.Width, e.Bounds.Height)) using (var canvas = bitmap.CreateCanvas()) using (var hbrush = Current.Engine.CreateHatchBrush(style, ArgbColor.Black, ArgbColor.Transparent)) { if (style == (HatchStyle)_style) { using (var brush = Current.Engine.CreateSolidBrush(ArgbColor.Yellow)) { canvas.FillRectangle(brush, new CanvasRectangle(0, 0, e.Bounds.Width, e.Bounds.Height)); } } CanvasRectangleF rect = new CanvasRectangleF(5, 5, bitmap.Width - 10, bitmap.Height - 10); using (var pen = Current.Engine.CreatePen(ArgbColor.Black, 1)) { canvas.DrawRectangle(pen, rect); } canvas.FillRectangle(hbrush, rect); e.Graphics.DrawImage(bitmap.ToGdiBitmap(), e.Bounds.Left, e.Bounds.Top); } } } catch { } }
protected override void OnDrawItem(System.Windows.Forms.DrawItemEventArgs e) { if (e.Index > -1) { string fontstring = Items[e.Index].ToString(); nfont = new Font(fontstring, 10); Font afont = new Font("Arial", 10); if (both) { Graphics g = CreateGraphics(); int w = (int)g.MeasureString(fontstring, afont).Width; if ((e.State & DrawItemState.Focus) == 0) { e.Graphics.FillRectangle(new SolidBrush(SystemColors.Window), e.Bounds.X + ttimg.Width, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height); e.Graphics.DrawString(fontstring, afont, new SolidBrush(SystemColors.WindowText), e.Bounds.X + ttimg.Width * 2, e.Bounds.Y); e.Graphics.DrawString(samplestr, nfont, new SolidBrush(SystemColors.WindowText), e.Bounds.X + w + ttimg.Width * 2, e.Bounds.Y); } else { e.Graphics.FillRectangle(new SolidBrush(SystemColors.Highlight), e.Bounds.X + ttimg.Width, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height); e.Graphics.DrawString(fontstring, afont, new SolidBrush(SystemColors.HighlightText), e.Bounds.X + ttimg.Width * 2, e.Bounds.Y); e.Graphics.DrawString(samplestr, nfont, new SolidBrush(SystemColors.HighlightText), e.Bounds.X + w + ttimg.Width * 2, e.Bounds.Y); } } else { if ((e.State & DrawItemState.Focus) == 0) { e.Graphics.FillRectangle(new SolidBrush(SystemColors.Window), e.Bounds.X + ttimg.Width, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height); e.Graphics.DrawString(fontstring, nfont, new SolidBrush(SystemColors.WindowText), e.Bounds.X + ttimg.Width * 2, e.Bounds.Y); } else { e.Graphics.FillRectangle(new SolidBrush(SystemColors.Highlight), e.Bounds.X + ttimg.Width, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height); e.Graphics.DrawString(fontstring, nfont, new SolidBrush(SystemColors.HighlightText), e.Bounds.X + ttimg.Width * 2, e.Bounds.Y); } } e.Graphics.DrawImage(ttimg, new Point(e.Bounds.X, e.Bounds.Y)); } base.OnDrawItem(e); }
protected override void OnDrawItem(System.Windows.Forms.DrawItemEventArgs e) { if (ImageList == null) { return; } int imageIndex = TabPages[e.Index].ImageIndex; if (imageIndex >= 0) { ImageList.Draw(e.Graphics, 0, 0, imageIndex); } }
private void SymbolListBox_DrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e) { if (base.Items.Count != 0) { SymbolListItem symbolListItem = (SymbolListItem)base.Items[e.Index]; e.DrawBackground(); Bitmap image; if (symbolListItem.m_bVisible) { image = new Bitmap( base.GetType().Assembly.GetManifestResourceStream("Yutai.ArcGIS.Common.SymbolLib.Check.bmp")); } else { image = new Bitmap( base.GetType() .Assembly.GetManifestResourceStream("Yutai.ArcGIS.Common.SymbolLib.UnCheck.bmp")); } Bitmap image2; if (symbolListItem.m_bLockColor) { image2 = new Bitmap( base.GetType().Assembly.GetManifestResourceStream("Yutai.ArcGIS.Common.SymbolLib.Lock.bmp")); } else { image2 = new Bitmap( base.GetType() .Assembly.GetManifestResourceStream("Yutai.ArcGIS.Common.SymbolLib.UnLock.bmp")); } Rectangle rect = new Rectangle(2, e.Bounds.Y + (e.Bounds.Height - 16) / 2, 16, 16); Rectangle rect2 = new Rectangle(e.Bounds.Right - 21, e.Bounds.Y + (e.Bounds.Height - 16) / 2, 16, 16); Rectangle rectangle = new Rectangle(rect.Right + 2, e.Bounds.Y + 1, e.Bounds.Width - 46, e.Bounds.Height - 2); e.Graphics.DrawImageUnscaled(image, rect); e.Graphics.DrawImageUnscaled(image2, rect2); e.Graphics.FillRectangle(Brushes.White, rectangle); Graphics graphics = e.Graphics; System.IntPtr hdc = graphics.GetHdc(); this.DrawSymbol(hdc.ToInt32(), rectangle, symbolListItem.m_pSymbol); graphics.ReleaseHdc(hdc); } }
//protected override void OnMeasureItem(System.Windows.Forms.MeasureItemEventArgs e) //{ // base.OnMeasureItem(e); // e.ItemHeight = e.ItemHeight - 2; //} protected override void OnDrawItem(System.Windows.Forms.DrawItemEventArgs e) { base.OnDrawItem(e); if (e.Index < 0) { return; } float size = this.Font.Size; System.Drawing.Font myFont; System.Drawing.FontFamily family = this.Font.FontFamily; System.Drawing.Color animalColor = this.ForeColor; // Draw the background of the item. e.DrawBackground(); // Create a square filled with the animals color. Vary the size // of the rectangle based on the length of the animals name. //System.Drawing.Rectangle rectangle = new Rectangle(2, e.Bounds.Top + 2, // e.Bounds.Height, e.Bounds.Height - 4); //e.Graphics.FillRectangle(new SolidBrush(animalColor), rectangle); // Draw each string in the array, using a different size, color, // and font for each item. myFont = new Font(family, size, FontStyle.Regular); e.Graphics.DrawString(this.GetItemText(Items[e.Index]), myFont, System.Drawing.Brushes.Black, new PointF(e.Bounds.X + 5, e.Bounds.Y + 2)); //new RectangleF(e.Bounds.X + e.Bounds.Height, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height)); //弹出下拉 //if (e.State == (System.Windows.Forms.DrawItemState.NoAccelerator | System.Windows.Forms.DrawItemState.NoFocusRect)) //{ // e.Graphics.DrawRectangle(new Pen(_borderColor), e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height); //} //else//选择时 //{ // e.Graphics.DrawRectangle(new Pen(_borderColor), e.Bounds.X, e.Bounds.Y, e.Bounds.Width - 1, e.Bounds.Height - 1); //} // Draw the focus rectangle if the mouse hovers over an item. e.DrawFocusRectangle(); }
private void RepresentationruleListBox_DrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e) { if (base.Items.Count != 0) { RepresentationruleListBox.RepresentationRuleWrap representationRuleWrap = (RepresentationruleListBox.RepresentationRuleWrap)base.Items[e.Index]; e.DrawBackground(); string s = "(" + representationRuleWrap.RuleID.ToString() + ") " + representationRuleWrap.Name; Brush brush = new SolidBrush(e.ForeColor); e.Graphics.DrawString(s, this.Font, brush, (float)e.Bounds.X, (float)e.Bounds.Y); brush.Dispose(); System.IntPtr hdc = e.Graphics.GetHdc(); IOutputContext outputContext = new OutputContext(); IPoint point = new ESRI.ArcGIS.Geometry.Point(); point.PutCoords((double)(e.Bounds.X + e.Bounds.Width / 2), (double)(e.Bounds.Y + e.Bounds.Height / 2 + 10)); tagRECT tagRECT_ = default(tagRECT); tagRECT_.left = e.Bounds.Left + 10; tagRECT_.right = e.Bounds.Right - 10; tagRECT_.top = e.Bounds.Top + 10; tagRECT_.bottom = e.Bounds.Bottom - 5; outputContext.Init(1.0, 1.5, 96.0, 0.0, point, ref tagRECT_, hdc.ToInt32()); IGeometry geometry; if (this.esriGeometryType_0 == esriGeometryType.esriGeometryPolygon) { geometry = this.method_1(tagRECT_); } else if (this.esriGeometryType_0 == esriGeometryType.esriGeometryPolyline) { geometry = this.method_2(tagRECT_); } else { geometry = new ESRI.ArcGIS.Geometry.Point(); (geometry as IPoint).PutCoords((double)((tagRECT_.left + tagRECT_.right) / 2), (double)((tagRECT_.top + tagRECT_.bottom) / 2)); } representationRuleWrap.RepresentationRule.Draw(-1, outputContext, geometry, geometry.Envelope); e.Graphics.ReleaseHdc(hdc); } }
protected override void OnDrawItem(System.Windows.Forms.DrawItemEventArgs e) { e.DrawBackground(); if (e.State == System.Windows.Forms.DrawItemState.Focus) { e.DrawFocusRectangle(); } if (e.Index < 0 || e.Index >= Items.Count) { return; } string text = (Items[e.Index] == null) ? "(null)" : Items[e.Index].ToString(); using (System.Drawing.SolidBrush brush = new System.Drawing.SolidBrush(e.ForeColor)) { e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit; e.Graphics.DrawString(text, e.Font, brush, e.Bounds); } }
private void tabControl1_DrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e) { Font fntTab; Brush bshBack; Brush bshFore; if (e.Index == this.SelectedIndex) { fntTab = new Font(e.Font, FontStyle.Bold); bshBack = new System.Drawing.Drawing2D.LinearGradientBrush(e.Bounds, SystemColors.Control, SystemColors.Control, System.Drawing.Drawing2D.LinearGradientMode.BackwardDiagonal); bshFore = Brushes.Black; //bshBack = new System.Drawing.Drawing2D.LinearGradientBrush(e.Bounds, Color.LightSkyBlue , Color.LightGreen, System.Drawing.Drawing2D.LinearGradientMode.BackwardDiagonal); //bshFore = Brushes.Blue; } else { fntTab = e.Font; bshBack = new SolidBrush(Color.Red); bshFore = new SolidBrush(Color.Aqua); //bshBack = new SolidBrush(Color.White); //bshFore = new SolidBrush(Color.Black); } string tabName = this.TabPages[e.Index].Text; StringFormat sftTab = new StringFormat(); e.Graphics.FillRectangle(bshBack, e.Bounds); Rectangle recTab = e.Bounds; recTab = new Rectangle(recTab.X, recTab.Y + 4, recTab.Width, recTab.Height - 4); e.Graphics.DrawString(tabName, fntTab, bshFore, recTab, sftTab); Rectangle r = this.GetTabRect(this.TabPages.Count - 1); RectangleF tf = new RectangleF(r.X + r.Width, r.Y - 5, this.Width - (r.X + r.Width) + 5, r.Height + 5); Brush b = Brushes.BlueViolet; e.Graphics.FillRectangle(b, tf); }
protected override void OnDrawItem(System.Windows.Forms.DrawItemEventArgs e) { e.DrawBackground(); e.DrawFocusRectangle(); GListBoxItem item; Rectangle bounds = e.Bounds; Size imageSize = _myImageList.ImageSize; try { item = (GListBoxItem)Items[e.Index]; if (item.ImageIndex != -1) { imageList.Draw(e.Graphics, bounds.Left, bounds.Top, item.ImageIndex); e.Graphics.DrawString(item.Text, e.Font, new SolidBrush(e.ForeColor), bounds.Left + imageSize.Width, bounds.Top); } else { e.Graphics.DrawString(item.Text, e.Font, new SolidBrush(e.ForeColor), bounds.Left, bounds.Top); } } catch { if (e.Index != -1) { e.Graphics.DrawString(Items[e.Index].ToString(), e.Font, new SolidBrush(e.ForeColor), bounds.Left, bounds.Top); } else { e.Graphics.DrawString(Text, e.Font, new SolidBrush(e.ForeColor), bounds.Left, bounds.Top); } } base.OnDrawItem(e); }
public void ComboBoxEX_DrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e) { if (e.Index < 0) { return; } Font f = this.Font; int yOffset = 0; if ((e.State & System.Windows.Forms.DrawItemState.Focus) == 0) { e.Graphics.FillRectangle(Brushes.White, e.Bounds); if ((this.Items[e.Index]).Image != null) { e.Graphics.DrawString(((CustomControl.Item) this.Items[e.Index]).Value.ToString(), f, Brushes.Black, new Point(((CustomControl.Item) this.Items[e.Index]).Image.Width * 2, e.Bounds.Y + yOffset)); e.Graphics.DrawImage(((CustomControl.Item) this.Items[e.Index]).Image, new Point(e.Bounds.X, e.Bounds.Y + yOffset)); } else { e.Graphics.DrawString(((CustomControl.Item) this.Items[e.Index]).Value.ToString(), f, Brushes.Black, new Point(e.Bounds.X, e.Bounds.Y + yOffset)); } } else { e.Graphics.FillRectangle(Brushes.Wheat, e.Bounds); if ((this.Items[e.Index]).Image != null) { e.Graphics.DrawString(((CustomControl.Item) this.Items[e.Index]).Value.ToString(), f, Brushes.Black, new Point(((CustomControl.Item) this.Items[e.Index]).Image.Width * 2, e.Bounds.Y + yOffset)); e.Graphics.DrawImage(((CustomControl.Item) this.Items[e.Index]).Image, new Point(e.Bounds.X, e.Bounds.Y + yOffset)); } else { e.Graphics.DrawString(((CustomControl.Item) this.Items[e.Index]).Value.ToString(), f, Brushes.Black, new Point(e.Bounds.X, e.Bounds.Y + yOffset)); } } }
private void listBox1_DrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e) { Brush brush; // Create the brush using the ForeColor specified by the DrawItemEventArgs if (foreColorBrush == null) { foreColorBrush = new SolidBrush(e.ForeColor); } else if (foreColorBrush.Color != e.ForeColor) { // The control's ForeColor has changed, so dispose of the cached brush and // create a new one. foreColorBrush.Dispose(); foreColorBrush = new SolidBrush(e.ForeColor); } // Select the appropriate brush depending on if the item is selected. // Since State can be a combinateion (bit-flag) of enum values, you can't use // "==" to compare them. if ((e.State & DrawItemState.Selected) == DrawItemState.Selected) { brush = SystemBrushes.HighlightText; } else { brush = foreColorBrush; } // Perform the painting. Font font = ((ListBoxFontItem)listBox1.Items[e.Index]).Font; e.DrawBackground(); e.Graphics.DrawString(font.Name, font, brush, e.Bounds); e.DrawFocusRectangle(); }
protected void BaseOnDrawItem(System.Windows.Forms.DrawItemEventArgs e) { base.OnDrawItem(e); }
private void LbScript_DrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e) { throw new System.NotImplementedException(); }
private void obj_DrawItem(System.Object sender, System.Windows.Forms.DrawItemEventArgs e) { this.OnChanged(sender); }
protected override void OnDrawItem(System.Windows.Forms.DrawItemEventArgs e) { int i1 = e.Index; if (i1 < 0) { return; } if (Items[i1].ToString() == "-----") { return; } bool flag = false; if (((i1 - 1) > 0) && Items[i1 - 1].ToString() == "-----") { flag = true; } if (!Enabled) { System.Drawing.Brush brush = new System.Drawing.SolidBrush(System.Drawing.SystemColors.Control); e.Graphics.FillRectangle(brush, ClientRectangle); brush.Dispose(); } else { e.DrawBackground(); } System.Drawing.Graphics graphics = e.Graphics; System.Drawing.Rectangle rectangle1 = e.Bounds; System.Drawing.Point point1 = rectangle1.Location; int i2 = point1.Y + _separatorWidth - 8; if (flag) { System.Drawing.Pen pen = new System.Drawing.Pen(_separatorColor, (float)_separatorWidth); pen.DashStyle = _separatorStyle; System.Drawing.Rectangle rectangle2 = e.Bounds; System.Drawing.Point point2 = rectangle2.Location; System.Drawing.Rectangle rectangle3 = e.Bounds; System.Drawing.Point point3 = rectangle3.Location; System.Drawing.Rectangle rectangle4 = e.Bounds; graphics.DrawLine(pen, point2.X + _separatorMargin, i2, point3.X + rectangle4.Width - _separatorMargin, i2); pen.Dispose(); } System.Drawing.Rectangle rectangle5 = e.Bounds; System.Drawing.Point point4 = rectangle5.Location; i2 = point4.Y + _separatorWidth; string s = Items[i1].ToString(); if (!System.String.IsNullOrEmpty(DisplayMember)) { System.Reflection.PropertyInfo propertyInfo = Items[i1].GetType().GetProperty(DisplayMember); s = propertyInfo.GetValue(Items[i1], null).ToString(); } System.Drawing.Color color = ForeColor; if (System.Windows.Forms.DrawItemState.Selected == (System.Windows.Forms.DrawItemState.Selected & e.State)) { color = System.Drawing.SystemColors.HighlightText; } if (System.Windows.Forms.DrawItemState.Disabled == (System.Windows.Forms.DrawItemState.Disabled & e.State)) { color = System.Drawing.SystemColors.GrayText; } System.Drawing.Rectangle rectangle6 = e.Bounds; System.Windows.Forms.TextRenderer.DrawText(graphics, s, e.Font, rectangle6.Location, color); base.OnDrawItem(e); }