protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); int y = base.AutoScrollPosition.Y; int width = e.ClipRectangle.Width; bool flag = this.hasFocus(); e.Graphics.Clear(Color.White); System.Drawing.Font font = new System.Drawing.Font(this.Font, FontStyle.Bold); SolidBrush solidBrush = new SolidBrush(Color.White); Pen pen = new Pen(this.LineColour); Pen pen1 = new Pen(Color.Black); Pen pen2 = new Pen(Color.Black) { DashStyle = DashStyle.Dot }; Point[] point = new Point[] { new Point(this.MarginSize / 2 - 3, this.LineHeight / 2 + 3), new Point(this.MarginSize / 2 + 3, this.LineHeight / 2 - 3), new Point(this.MarginSize / 2 + 3, this.LineHeight / 2 + 3) }; Point[] pointArray = new Point[] { new Point(this.MarginSize / 2 - 1, this.LineHeight / 2 - 3), new Point(this.MarginSize / 2 - 1, this.LineHeight / 2 + 3), new Point(this.MarginSize / 2 + 2, this.LineHeight / 2) }; int x = e.ClipRectangle.X; e.Graphics.TranslateTransform(0f, (float)base.AutoScrollPosition.Y); foreach (PropertyGrid.Section section in this.Sections) { solidBrush.Color = section.MarginColor; e.Graphics.FillRectangle(solidBrush, x, 0, width, this.LineHeight); if (this.DrawLines) { e.Graphics.DrawLine(pen, x, 0, width + x, 0); e.Graphics.DrawLine(pen, x, this.LineHeight, width + x, this.LineHeight); } solidBrush.Color = pen1.Color; if (!section.Collapsed) { e.Graphics.FillPolygon(solidBrush, point); } else { e.Graphics.DrawPolygon(pen1, pointArray); } int marginSize = this.MarginSize + 4; int num = 1; if ((this.mFocusedSection != section ? false : this.mFocusedItem == null) & flag) { System.Drawing.Size size = TextRenderer.MeasureText(section.Name, font); e.Graphics.DrawRectangle(pen2, marginSize, num, size.Width, size.Height); } solidBrush.Color = section.TextColour; TextRenderer.DrawText(e.Graphics, NativeTranslte.getTransSection(section.Name), font, new Point(marginSize, num + (int)e.Graphics.Transform.OffsetY), section.TextColour); e.Graphics.TranslateTransform(0f, (float)this.LineHeight); if (!section.Collapsed) { int num1 = 0; foreach (PropertyGrid.Item item in section.Items) { if (e.Graphics.Transform.OffsetY > (float)(-this.LineHeight)) { solidBrush.Color = section.MarginColor; e.Graphics.FillRectangle(solidBrush, x, 0, this.MarginSize, this.LineHeight + 1); if (!(this.mFocusedItem == item & flag)) { solidBrush.Color = ((num1 & 1) == 0 ? section.BackColour1 : section.BackColour2); e.Graphics.FillRectangle(solidBrush, this.MarginSize, 1, width - this.MarginSize + x, this.LineHeight - 1); } else { solidBrush.Color = this.FocusColour; e.Graphics.FillRectangle(solidBrush, this.MarginSize, 1, this.DividerPosition - this.MarginSize, this.LineHeight - 1); solidBrush.Color = ((num1 & 1) == 0 ? section.BackColour1 : section.BackColour2); e.Graphics.FillRectangle(solidBrush, this.DividerPosition, 1, width - this.DividerPosition + x, this.LineHeight - 1); } if (this.DrawLines) { e.Graphics.DrawLine(pen, this.MarginSize, this.LineHeight, width + x, this.LineHeight); } e.Graphics.DrawLine(pen, this.DividerPosition, 0, this.DividerPosition, this.LineHeight); Color color = (this.mFocusedItem == item & flag ? this.FocusText : item.TextColour); Rectangle rectangle = new Rectangle(this.MarginSize, (int)e.Graphics.Transform.OffsetY + 1, this.DividerPosition - this.MarginSize, this.LineHeight - 1); TextRenderer.DrawText(e.Graphics, item.Name, this.Font, rectangle, color, TextFormatFlags.Default); CustomProperty property = item.Property ?? this.DefaultType; property.Paint(this, item, e.Graphics, new Rectangle(this.DividerPosition + 1, 0, base.Width - this.DividerPosition - 1, this.LineHeight)); } e.Graphics.TranslateTransform(0f, (float)this.LineHeight); if (e.Graphics.Transform.OffsetY <= (float)base.Height) { num1++; } else { return; } } } } }