protected override void OnPaint(PaintEventArgs e) { Rectangle RBorder = DisplayRectangle; RBorder.Inflate(1, 1); using (Pen PBorder = new Pen(m_PaletteTabPageBorder.GetBorderColor1(PaletteState.Normal))) { e.Graphics.DrawRectangle(PBorder, RBorder); } if (this.TabCount > 0) { using (RenderContext renderContext = new RenderContext(this, e.Graphics, e.ClipRectangle, m_Renderer)) { renderContext.Graphics.CompositingQuality = CompositingQuality.HighQuality; renderContext.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; int selectedIndex = this.SelectedIndex; for (int index = 0; index <= this.TabCount - 1; index++) { if (index != selectedIndex) { this.PaintTab(index, renderContext); } } if (selectedIndex >= 0) { this.PaintTab(selectedIndex, renderContext); } } } }
void DrawGrid(Graphics g, Size offset) { Pen border = new Pen(paletteGrid.GetBorderColor1(PaletteState.Normal)); // Горизонтальные линии float y = 0; for (int i = 0; i <= dimension.Height; i++) { int y1 = (int)(Math.Round(y)) + offset.Height; g.DrawLine(border, 0, y1, ClientSize.Width, y1); if (i != dimension.Height) { y += real_size.Height; } } // Вертикальные линии float x = 0; for (int i = 0; i <= dimension.Width; i++) { if (i == dimension.Width) { x = ClientSize.Width - 1; } int x1 = (int)(Math.Round(x)); g.DrawLine(border, x1, offset.Height, x1, y + offset.Height); x += real_size.Width; } }
void DrawLines(ViewContext context, TreeNode node) { if (node == null) { return; } Rectangle rect = node.Bounds; TreeNode curNode = node; Pen pen = new Pen(paletteLines.GetBorderColor1(PaletteState.Normal)); while ((curNode != null) && (ShowRootLines || (curNode.Parent != null))) { int dx = ShowRootLines ? Indent + 3 : 0; int d = node.Level != 0 ? Indent + Indent * (curNode.Level - 1) + dx : dx; int x = d - (dx + ImageSizePM) / 2 + 5; if (!ShowRootLines) { x -= Indent - 11; } int width = d - x - 2; int y = rect.Top; int y2 = rect.Top + rect.Height; if (curNode == node) { int midy = y + rect.Height / 2; context.Graphics.DrawLine(pen, x, midy, x + width, midy); if (curNode.NextNode == null) { y2 = y + rect.Height / 2; } } if ((curNode.Parent == null) && (curNode.PrevNode == null) && (curNode == node)) { y = rect.Height / 2; } if (curNode.NextNode != null || curNode == node) { context.Graphics.DrawLine(pen, x, y, x, y2); } curNode = curNode.Parent; } }