private void SetControlColorTable() { CaptureImageToolColorTable colorTable = ColorTable; ToolStripRendererEx renderer = new ToolStripRendererEx(colorTable); contextMenuStrip.Renderer = renderer; drawToolsControl.ColorTable = colorTable; colorSelector.ColorTable = colorTable; }
protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); Graphics g = e.Graphics; g.SmoothingMode = SmoothingMode.AntiAlias; g.FillRectangle(mybrush, 0, 0, Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height); if (SelectImageRect.Width != 0 && SelectImageRect.Height != 0) { Rectangle rect = SelectImageRect; DrawSelectedImage(g); CaptureImageToolColorTable colorTable = ColorTable; if (_mouseDown) { if (!SelectedImage || SizeGrip != SizeGrip.None) { using (SolidBrush brush = new SolidBrush( Color.FromArgb(90, colorTable.BackColorNormal))) { g.FillRectangle(brush, rect); } DrawImageSizeInfo(g, rect); } } using (Pen pen = new Pen(colorTable.BorderColor)) { g.DrawRectangle(pen, rect); using (SolidBrush brush = new SolidBrush(colorTable.BackColorPressed)) { foreach (Rectangle sizeGripRect in SizeGripRectList.Values) { g.FillRectangle( brush, sizeGripRect); } } } DrawOperate(g); if (DrawStyle != DrawStyle.None) { DrawTools(g, _endPoint); } } }
public ToolStripRendererEx(CaptureImageToolColorTable colorTable) : base() { _colorTable = colorTable; }