private void UnloadPopup(object sender, System.EventArgs e) { ButtonItem item = sender as ButtonItem; if (item.Name == "bTextColor") { DevComponents.DotNetBar.PopupContainerControl container = item.PopupContainerControl as PopupContainerControl; ColorPicker clr = container.Controls[0] as ColorPicker; if (clr.SelectedColor != Color.Empty) { frmDocument activedocument = this.ActiveMdiChild as frmDocument; if (activedocument != null) { activedocument.ExecuteCommand(item.Name, clr.SelectedColor); } } } else if (item.Name == "bTabColor") { DevComponents.DotNetBar.PopupContainerControl container = item.PopupContainerControl as PopupContainerControl; ColorPicker clr = container.Controls[0] as ColorPicker; if (clr.SelectedColor != Color.Empty) { tabStrip1.ColorScheme.TabBackground = ControlPaint.LightLight(clr.SelectedColor); tabStrip1.ColorScheme.TabBackground2 = clr.SelectedColor; tabStrip1.Refresh(); } // Close popup menu, since it is not closed when Popup Container is closed... item.Parent.Expanded = false; } }
private void DrawTime(Graphics g) { TimeSpan tsSpan = DateTime.Now.AddHours(Math.Abs(this.SeekerPosition - 1.0F)) - DateTime.Now; GraphicsPath gpSeekTime = new GraphicsPath(); string strText = String.Empty; Color clForecolor = Color.White; if (tsSpan.TotalSeconds == 0) { strText = "Live"; clForecolor = ControlPaint.Light(ControlPaint.LightLight(Color.LightSeaGreen)); } else { strText = String.Format("-{0:00}:{1:00}:{2:00}", tsSpan.Hours, tsSpan.Minutes, tsSpan.Seconds); clForecolor = Color.White; } SizeF szText = g.MeasureString(strText, new Font("Arial", 12)); gpSeekTime.AddString(strText, new FontFamily("Arial"), 0, 12, new PointF(2, -szText.Height + 4), StringFormat.GenericTypographic); this.DrawBwShape(g, gpSeekTime, this.ButtonOpacity, 4.0F, Color.Black, clForecolor); gpSeekTime.Dispose(); }
private void fillcolor() { color = Properties.Settings.Default.Color; // Properties.Settings.Default.GridText = dataGridView1.Rows[0].Cells[0].Value.ToString(); // Color C = Properties.Settings.Default.myColor; //menuStrip1.BackColor = color; //MenuItem2ToolStripMenuItem.BackColor = color; btnAdd2.BackColor = color; btnNew.BackColor = color; btnCancel2.BackColor = color; btnAdd2.BackColor = color; btnNew.BackColor = color; //menuStrip1.BackColor = color; btnNew.BackColor = color; btnAdd2.BackColor = color; DataGridView.ColumnHeadersDefaultCellStyle.BackColor = color; DataGridView.RowsDefaultCellStyle.SelectionBackColor = ControlPaint.LightLight(color); DataGridView.AlternatingRowsDefaultCellStyle.BackColor = ControlPaint.LightLight(ControlPaint.LightLight(ControlPaint.LightLight(ControlPaint.LightLight(color)))); this.Size = new Size(this.Size.Width, 450); pnlWeeklyHour.Visible = true; pnlWeeklyHour.Location = pnlHoliday.Location; this.Size = new Size(this.Size.Width, 450); }
/// <summary> /// Construtor. /// </summary> /// <param name="control">Control.</param> public MakeHighlightInfo(Control control) { _control = control; _backupBackColor = control.BackColor; _control.BackColor = ControlPaint.LightLight(_control.BackColor); if (control is Button button) { _backupBorderColor = button.FlatAppearance.BorderColor; button.FlatAppearance.BorderColor = ControlPaint.LightLight(button.FlatAppearance.BorderColor); _backupMouseDownBackColor = button.FlatAppearance.MouseDownBackColor; button.FlatAppearance.MouseDownBackColor = ControlPaint.LightLight(button.FlatAppearance.MouseDownBackColor); _backupMouseOverBackColor = button.FlatAppearance.MouseOverBackColor; button.FlatAppearance.MouseOverBackColor = ControlPaint.LightLight(button.FlatAppearance.MouseOverBackColor); } _timer = new Timer { Interval = 500, Enabled = false }; _timer.Tick += TimerOnTick; }
protected virtual void DrawInnerBevel(Graphics g, Rectangle rect, int depth, Color buttonColor) { Color color2 = ControlPaint.LightLight(buttonColor); Color color1 = ControlPaint.Dark(buttonColor); Blend blend = new Blend(); blend.Positions = new float[6] { 0.0f, 0.2f, 0.4f, 0.6f, 0.8f, 1f }; blend.Factors = new float[6] { 0.2f, 0.4f, 0.6f, 0.6f, 1f, 1f }; Rectangle rect1 = rect; rect1.Inflate(1, 1); FillShape(g, (object)new LinearGradientBrush(rect1, color1, color2, GetLightAngle(50f)) { Blend = blend }, rect); }
public static RadShimControl CreateOutlineForm1(Bitmap image, Color color) { RadShimControl radShimControl = new RadShimControl(); try { radShimControl.Size = new Size(0, 0); } catch { radShimControl = new RadShimControl(); } if (color != Color.Empty) { radShimControl.BackColor = color; } if (DWMAPI.IsAlphaBlendingSupported) { radShimControl.Opacity = 0.5; } else { radShimControl.BackColor = ControlPaint.LightLight(SystemColors.Highlight); } radShimControl.Text = ""; radShimControl.Enabled = false; radShimControl.Visible = false; if (image != null) { radShimControl.BackgroundImage = (Image)image; } radShimControl.CreateControl(); return(radShimControl); }
private void DDB_Draw3DBorder(Graphics g, Rectangle r, bool raised) { if ((base.Control.BackColor != SystemColors.Control) && SystemInformation.HighContrast) { if (raised) { Color leftColor = ControlPaint.LightLight(base.Control.BackColor); ControlPaint.DrawBorder(g, r, leftColor, 1, ButtonBorderStyle.Outset, leftColor, 1, ButtonBorderStyle.Outset, leftColor, 2, ButtonBorderStyle.Inset, leftColor, 2, ButtonBorderStyle.Inset); } else { ControlPaint.DrawBorder(g, r, ControlPaint.Dark(base.Control.BackColor), ButtonBorderStyle.Solid); } } else if (raised) { Color color2 = ControlPaint.Light(base.Control.BackColor); ControlPaint.DrawBorder(g, r, color2, 1, ButtonBorderStyle.Solid, color2, 1, ButtonBorderStyle.Solid, base.Control.BackColor, 2, ButtonBorderStyle.Outset, base.Control.BackColor, 2, ButtonBorderStyle.Outset); Rectangle bounds = r; bounds.Offset(1, 1); bounds.Width -= 3; bounds.Height -= 3; color2 = ControlPaint.LightLight(base.Control.BackColor); ControlPaint.DrawBorder(g, bounds, color2, 1, ButtonBorderStyle.Solid, color2, 1, ButtonBorderStyle.Solid, color2, 1, ButtonBorderStyle.None, color2, 1, ButtonBorderStyle.None); } else { ControlPaint.DrawBorder(g, r, ControlPaint.Dark(base.Control.BackColor), ButtonBorderStyle.Solid); } }
private void show_step_2() { // show Step 2 instructions this.step1Label.ForeColor = ControlPaint.LightLight(SystemColors.ActiveCaption); this.step2Label.ForeColor = ControlPaint.Dark(SystemColors.ActiveCaption); this.step3Label.ForeColor = ControlPaint.Dark(SystemColors.ActiveCaption); }
public void renkKoyulastir(int si, int sj) { Color renk = Form1.kareler[si, sj].BackColor; Color lightRed = ControlPaint.LightLight(renk); Form1.kareler[si, sj].BackColor = lightRed; }
protected override void OnPaint(PaintEventArgs e) { if (button_enabled) { if ((!mouse_down) && (!mouse_over) && (!Focused)) { draw_button(e.Graphics, Active_Border_Color, Active_Fill_Color, Active_Text_Color); } else { if (mouse_down) { draw_button(e.Graphics, Mouse_Down_Border_Color, Mouse_Down_Fill_Color, Mouse_Down_Text_Color); } else { draw_button(e.Graphics, Active_Border_Color, ControlPaint.LightLight(Active_Fill_Color), Active_Text_Color); } } } else { draw_button(e.Graphics, Inactive_Border_Color, Inactive_Fill_Color, Inactive_Text_Color); } base.OnPaint(e); }
/// <summary> /// Draws the frame selection if Selected property is true. /// </summary> /// <param name="document">Informations transferred from DrawingPanel.</param> /// <param name="e">PaintEventArgs.</param> virtual protected void DrawSelection(IDocument document, PaintEventArgs e) { if (!_shape.Selected || !IsValidGeometric(_shape.Geometric)) { return; } Rectangle outside = Rectangle.Round(_shape.Geometric.GetBounds()); Rectangle inside = outside; outside.Inflate(_grabberDimension / 2, _grabberDimension / 2); inside.Inflate(-_grabberDimension / 2, -_grabberDimension / 2); ControlPaint.DrawSelectionFrame(e.Graphics, true, outside, inside, document.DrawingControl.BackColor); Color color = Color.Black; if (Jx.Drawing.Common.Select.LastSelectedShape == _shape) { color = ControlPaint.LightLight(color); } using (SolidBrush solidBrush = new SolidBrush(color)) { Rectangle[] grabbers = _shape.GetGrabbers(); foreach (Rectangle grabber in grabbers) { e.Graphics.FillRectangle(solidBrush, grabber); } } }
public virtual void DrawPopupHotCheckBox(Graphics g, Rectangle bounds, Color backColor, Color foreColor, CheckState state) { Rectangle checkbox_rectangle; Rectangle fill_rectangle; // clip one pixel from bottom right for non popup rendered checkboxes checkbox_rectangle = new Rectangle(bounds.X, bounds.Y, Math.Max(bounds.Width - 1, 0), Math.Max(bounds.Height - 1, 0)); fill_rectangle = new Rectangle(checkbox_rectangle.X + 1, checkbox_rectangle.Y + 1, Math.Max(checkbox_rectangle.Width - 3, 0), Math.Max(checkbox_rectangle.Height - 3, 0)); g.FillRectangle(ResPool.GetSolidBrush(ControlPaint.LightLight(backColor)), fill_rectangle); // draw sunken effect ThemeEngine.Current.CPDrawBorder3D(g, checkbox_rectangle, Border3DStyle.SunkenInner, Border3DSide.Left | Border3DSide.Right | Border3DSide.Top | Border3DSide.Bottom, backColor); bounds.Offset(-1, 0); if (state == CheckState.Checked) { DrawCheck(g, bounds, Color.Black); } else if (state == CheckState.Indeterminate) { DrawCheck(g, bounds, SystemColors.ControlDarkDark); } }
public void GetAllCurrentColorsAsArgbTest() { DayCellAppearance target = new DayCellAppearance(); target.BackConceptionDay = Color.DeepSkyBlue; target.BackPregnancyDay = Color.LightCyan; target.BackMenstruationDay = Color.LightPink; target.BackPredictedMenstruationDay = ControlPaint.LightLight(Color.LightPink); target.BackOvulationDay = Color.Gold; target.BackSafeSex = Color.LightGreen; target.BackEmpty = Color.White; target.BackHadSex = Color.White; target.BackHaveNote = Color.White; target.BackBoyDay = Color.White; target.BackGirlDay = Color.White; int[] expected = new int[11]; expected[0] = 16760576; expected[1] = 16777184; expected[2] = 12695295; expected[3] = 14736383; expected[4] = 55295; expected[5] = 9498256; expected[6] = 16777215; expected[7] = 16777215; expected[8] = 16777215; expected[9] = 16777215; expected[10] = 16777215; int[] actual; actual = target.GetAllCurrentColorsAsArgb(); Assert.AreEqual(expected.Length, actual.Length); for (int i = 0; i < expected.Length; i++) { Assert.AreEqual(expected[i], actual[i]); } }
protected override void OnRenderItemText(ToolStripItemTextRenderEventArgs e) { if (e.Item.IsOnDropDown) { base.OnRenderItemText(e); } else { if (_smoothText) { e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit; } if (_overrideText) { e.TextColor = _overrideColor; } Color colorMenuHighLight = ControlPaint.LightLight(SystemColors.MenuHighlight); int imageLocationX = 4; int imageLocationY = 2; int textLocationX = 6; int textLocationY = (int)Math.Round((e.Item.ContentRectangle.Height - e.Graphics.MeasureString(e.Item.Text, e.Item.Font).Height) / 2); SolidBrush textBrush = new SolidBrush(e.TextColor); Rectangle imageRect = new Rectangle(imageLocationX, imageLocationY, 16, 16); if (e.Item.Image != null) { if (e.Item.DisplayStyle == ToolStripItemDisplayStyle.ImageAndText) { if (e.Item.Enabled) { e.Graphics.DrawImage(e.Item.Image, imageRect); } else { ControlPaint.DrawImageDisabled(e.Graphics, e.Item.Image, imageRect.X, imageRect.Y, e.Item.BackColor); } e.Graphics.DrawString(e.Item.Text, e.Item.Font, textBrush, new Point(textLocationX + 14, textLocationY), stringFormat); } else if (e.Item.DisplayStyle == ToolStripItemDisplayStyle.Image) { if (e.Item.Enabled) { e.Graphics.DrawImage(e.Item.Image, imageRect); } else { ControlPaint.DrawImageDisabled(e.Graphics, e.Item.Image, imageRect.X, imageRect.Y, e.Item.BackColor); } } else if (e.Item.DisplayStyle == ToolStripItemDisplayStyle.Text) { e.Graphics.DrawString(e.Item.Text, e.Item.Font, textBrush, new Point(textLocationX, textLocationY), stringFormat); } } else { e.Graphics.DrawString(e.Item.Text, e.Item.Font, textBrush, new Point(textLocationX, textLocationY), stringFormat); } textBrush.Dispose(); } }
// 请求给出Item文字参数 public int DtlpItemText(string strPath, Int32 nMask, out string strFontFace, out int nFontSize, out FontStyle FontStyle, ref Color ForeColor) { strFontFace = ""; nFontSize = 0; FontStyle = FontStyle.Regular; if ((nMask & DtlpChannel.TypeStdbase) != 0) { /* * strFontFace = "宋体"; * nFontSize = 12; * FontStyle = FontStyle.Bold; * ForeColor = Color.Red; */ return(0); } else { ForeColor = ControlPaint.LightLight(ForeColor); return(1); } }
protected override void OnPaint(PaintEventArgs e) { Color backColor = this.BackColor; switch (this.Dock) { case DockStyle.Right: using (Pen penD = new Pen(ControlPaint.Dark(backColor)), penDD = new Pen(ControlPaint.DarkDark(backColor))) { e.Graphics.DrawLine(penD, this.Width - 2, 0, this.Width - 2, this.Height); e.Graphics.DrawLine(penDD, this.Width - 1, 0, this.Width - 1, this.Height); } break; case DockStyle.Left: using (Pen penLL = new Pen(ControlPaint.LightLight(backColor))) e.Graphics.DrawLine(penLL, 1, 0, 1, this.Height); break; case DockStyle.Bottom: using (Pen penD = new Pen(ControlPaint.Dark(backColor)), penDD = new Pen(ControlPaint.DarkDark(backColor))) { e.Graphics.DrawLine(penD, 0, this.Height - 2, this.Width, this.Height - 2); e.Graphics.DrawLine(penDD, 0, this.Height - 1, this.Width, this.Height - 1); } break; case DockStyle.Top: using (Pen penLL = new Pen(ControlPaint.LightLight(backColor))) e.Graphics.DrawLine(penLL, 0, 1, this.Width, 1); break; } }
public virtual void InitStandardColors() { colors[Office2003Color.Button1] = GetMiddleRGB(SystemColors.Control, SystemColors.Window, 22); colors[Office2003Color.Button2] = GetMiddleRGB(SystemColors.Control, SystemColors.Window, 96); colors[Office2003Color.Border] = SystemColors.Highlight; colors[Office2003Color.Button2Hot] = colors[Office2003Color.Button1Hot] = GetRealColor(GetLightColor(-2, 30, 72)); colors[Office2003Color.Button1Pressed] = colors[Office2003Color.Button2Pressed] = GetRealColor(GetLightColor(14, 44, 40)); colors[Office2003Color.Text] = SystemColors.ControlText; colors[Office2003Color.TextDisabled] = SystemColors.GrayText; colors[Office2003Color.Header] = GetMiddleRGB(this[Office2003Color.Button1], this[Office2003Color.Button2], 50); colors[Office2003Color.Header2] = ControlPaint.Dark(this[Office2003Color.Button2], 0.5f); colors[Office2003Color.GroupRow] = SystemColors.Control; colors[Office2003Color.LinkBorder] = CalcColor(SystemColors.Window, .29f, SystemColors.Control, .72f); colors[Office2003Color.NavBarBackColor1] = CalcNavColor(-10); colors[Office2003Color.NavBarBackColor2] = CalcNavColor(-29); colors[Office2003Color.NavBarGroupClientBackColor] = ControlPaint.LightLight(SystemColors.InactiveCaption); colors[Office2003Color.NavBarLinkTextColor] = CalcNavColor(-50); colors[Office2003Color.NavBarLinkHightlightedTextColor] = ControlPaint.Light(CalcNavColor(-50)); colors[Office2003Color.NavBarGroupCaptionBackColor1] = SystemColors.Window; colors[Office2003Color.NavBarGroupCaptionBackColor2] = ControlPaint.LightLight(SystemColors.Highlight); colors[Office2003Color.NavBarExpandButtonRoundColor] = SystemColors.ControlDark; colors[Office2003Color.NavPaneBorderColor] = ControlPaint.Dark(GetLightColor(40, 0, 0), 0.05f); colors[Office2003Color.NavBarNavPaneHeaderBackColor] = GetLightColor(40, 0, 0); if (this[Office2003Color.NavBarLinkTextColor] == Color.FromArgb(0, 0x15, 0x5b)) { colors[Office2003Color.NavBarLinkDisabledTextColor] = Color.Gray; } else { colors[Office2003Color.NavBarLinkDisabledTextColor] = ControlPaint.LightLight(CalcNavColor(-50)); } }
private void LoadEditorSettings(GlobalProperties settings) { codebox.ShowScrollBars = settings.ScrollBars; codebox.AutoCompleteBrackets = settings.AutoCompleteBrackets; if (settings.TabSize != 0) { codebox.TabLength = settings.TabSize; } if (!string.IsNullOrEmpty(settings.FontFamily) && settings.FontSize != 0.0) { codebox.Font = new Font(settings.FontFamily, settings.FontSize); } codebox.ShowFoldingLines = settings.ShowFoldingLines; codebox.ShowLineNumbers = settings.ShowLineNumbers; codebox.HighlightFoldingIndicator = settings.HighlightFolding; codebox.FindEndOfFoldingBlockStrategy = settings.FoldingStrategy; codebox.BracketsHighlightStrategy = settings.BracketsStrategy; codebox.CaretVisible = settings.ShowCaret; codebox.ShowFoldingLines = settings.ShowFoldingLines; codebox.LeftPadding = settings.PaddingWidth; codebox.VirtualSpace = settings.EnableVirtualSpace; codebox.WideCaret = settings.BlockCaret; codebox.WordWrap = settings.WordWrap; if (settings.ImeMode) { codebox.ImeMode = ImeMode.On; } if (settings.ShowChangedLine) { codebox.ChangedLineColor = ControlPaint.LightLight(codebox.CurrentLineColor); } }
private void DrawHeader(Graphics g, Color color) { DrawBackGround(g, new Rectangle(_x, _y, _w, DefaultConfigs.SECTIONHEADERHEIGHT), color); using (Brush b = new SolidBrush(color)) { //g.FillRectangle(b, _x, _y, _w, DefaultConfigs.SECTIONHEADERHEIGHT); Color backlight = ControlPaint.Light(SystemColors.Control); Color backlightlight = ControlPaint.LightLight(SystemColors.Control); Color backdark = ControlPaint.Dark(SystemColors.Control); Color backdarkdark = ControlPaint.DarkDark(SystemColors.Control); using (Brush brushlight = new SolidBrush(backlight)) using (Brush brushdark = new SolidBrush(backdark)) using (Pen penlight = new Pen(brushlight, 1)) using (Pen pendark = new Pen(brushdark, 1)) using (Brush brushlightlight = new SolidBrush(backlightlight)) using (Brush brushdarkdark = new SolidBrush(backdarkdark)) using (Pen penlightlight = new Pen(brushlightlight, 1)) using (Pen pendarkdark = new Pen(brushdarkdark, 1)) { g.DrawLine(pendark, _x, _y, _x + _w - 2, _y); g.DrawLine(pendark, _x, _y, _x, _y + DefaultConfigs.SECTIONHEADERHEIGHT - 2); g.DrawLine(pendarkdark, _x + 1, _y + 1, _x + _w - 3, _y + 1); g.DrawLine(pendarkdark, _x + 1, _y + 1, _x + 1, _y + DefaultConfigs.SECTIONHEADERHEIGHT - 3); g.DrawLine(penlightlight, _x, _y + DefaultConfigs.SECTIONHEADERHEIGHT - 1, _x + _w - 1, _y + DefaultConfigs.SECTIONHEADERHEIGHT - 1); g.DrawLine(penlightlight, _x + _w - 1, _y + DefaultConfigs.SECTIONHEADERHEIGHT - 1, _x + _w - 1, _y); g.DrawLine(penlight, _x + 1, _y + DefaultConfigs.SECTIONHEADERHEIGHT - 2, _x + _w - 2, _y + DefaultConfigs.SECTIONHEADERHEIGHT - 2); g.DrawLine(penlight, _x + _w - 2, _y + DefaultConfigs.SECTIONHEADERHEIGHT - 2, _x + _w - 2, _y + 1); } } }
void SetColorOnControlButton(Color color) { var lightColor = ControlPaint.LightLight(color); ControlButton.OverrideDefault.Back.Color2 = color; ControlButton.OverrideDefault.Back.Color1 = lightColor; ControlButton.OverrideFocus.Back.Color2 = color; ControlButton.OverrideFocus.Back.Color1 = lightColor; ControlButton.StateCommon.Back.Color2 = color; ControlButton.StateCommon.Back.Color1 = lightColor; ControlButton.StateNormal.Back.Color2 = color; ControlButton.StateNormal.Back.Color1 = lightColor; ControlButton.StatePressed.Back.Color2 = color; ControlButton.StatePressed.Back.Color1 = lightColor; ControlButton.StateTracking.Back.Color2 = color; ControlButton.StateTracking.Back.Color1 = lightColor; ControlButton.StateCheckedNormal.Back.Color2 = color; ControlButton.StateCheckedNormal.Back.Color1 = lightColor; ControlButton.StateCheckedPressed.Back.Color2 = color; ControlButton.StateCheckedPressed.Back.Color1 = lightColor; ControlButton.StateCheckedTracking.Back.Color2 = color; ControlButton.StateCheckedTracking.Back.Color1 = lightColor; ControlButton.Update(); }
protected virtual void DrawSelection(IDocument document, PaintEventArgs e) { if (this._shape.Selected && this.IsValidGeometric(this._shape.Geometric)) { Rectangle rectangle = Rectangle.Round(this._shape.Geometric.GetBounds()); Rectangle insideRect = rectangle; rectangle.Inflate(this._grabberDimension / 2, this._grabberDimension / 2); insideRect.Inflate(-this._grabberDimension / 2, -this._grabberDimension / 2); ControlPaint.DrawSelectionFrame(e.Graphics, true, rectangle, insideRect, document.DrawingControl.BackColor); Color color = Color.Green; if (Select.LastSelectedShape == this._shape) { color = ControlPaint.LightLight(color); } using (SolidBrush solidBrush = new SolidBrush(color)) { Rectangle[] grabbers = this._shape.GetGrabbers(); Rectangle[] array = grabbers; for (int i = 0; i < array.Length; i++) { Rectangle rect = array[i]; e.Graphics.FillRectangle(solidBrush, rect); } } } }
public void ControlPaint_DrawBorder_Inset_Rendering() { using var emf = new EmfScope(); DeviceContextState state = new DeviceContextState(emf); using Graphics graphics = Graphics.FromHdc((IntPtr)emf.HDC); Rectangle bounds = new Rectangle(10, 10, 10, 10); ControlPaint.DrawBorder(graphics, bounds, Color.Gray, ButtonBorderStyle.Inset); // For whatever reason GDI+ renders as polylines scaled 16x with a 1/16th world transform applied. // For test readability we'll transform the points from our coordinates to the logical coordinates. Matrix3x2 oneSixteenth = Matrix3x2.CreateScale(0.0625f); Matrix3x2 times16 = Matrix3x2.CreateScale(16.0f); // This is the default pen style GDI+ renders polylines with Gdi32.PS penStyle = Gdi32.PS.SOLID | Gdi32.PS.JOIN_ROUND | Gdi32.PS.COSMETIC | Gdi32.PS.ENDCAP_FLAT | Gdi32.PS.JOIN_MITER | Gdi32.PS.GEOMETRIC; emf.Validate( state, // Top Validate.Polyline16( bounds: null, PointArray(times16, 10, 10, 19, 10), State.Pen(16, ControlPaint.DarkDark(Color.Gray), penStyle), State.Transform(oneSixteenth)), // Left Validate.Polyline16( bounds: null, PointArray(times16, 10, 10, 10, 19), State.Pen(16, ControlPaint.DarkDark(Color.Gray), penStyle), State.Transform(oneSixteenth)), // Bottom Validate.Polyline16( bounds: null, PointArray(times16, 10, 19, 19, 19), State.Pen(16, ControlPaint.LightLight(Color.Gray), penStyle), State.Transform(oneSixteenth)), // Right Validate.Polyline16( bounds: null, PointArray(times16, 19, 10, 19, 19), State.Pen(16, ControlPaint.LightLight(Color.Gray), penStyle), State.Transform(oneSixteenth)), // Top inset Validate.Polyline16( bounds: null, PointArray(times16, 11, 11, 18, 11), State.Pen(16, ControlPaint.Light(Color.Gray), penStyle), State.Transform(oneSixteenth)), // Left inset Validate.Polyline16( bounds: null, PointArray(times16, 11, 11, 11, 18), State.Pen(16, ControlPaint.Light(Color.Gray), penStyle), State.Transform(oneSixteenth)) ); }
private void DrawChevron(Graphics g, Point[] chevron1, Point[] chevron2) { g.SmoothingMode = SmoothingMode.None; using (Pen glyphPen = new Pen(TabForeColor, 1)) { if (!Enabled) { Color c = ParentInternal.InactiveTabForeColor; int luminosity = 0; int num1 = c.R; int num2 = c.G; int num3 = c.B; int num4 = Math.Max(Math.Max(num1, num2), num3); int num5 = Math.Min(Math.Min(num1, num2), num3); int num6 = (num4 + num5); luminosity = (((num6 * 240) + 255) / 510); if (luminosity == 0) { glyphPen.Color = ControlPaint.LightLight(c); } else if (luminosity < 120) { glyphPen.Color = ControlPaint.Light(c, 0.5f); } else { glyphPen.Color = ControlPaint.Light(c, 0.5f); } } glyphPen.StartCap = LineCap.Square; glyphPen.EndCap = LineCap.Square; g.DrawLines(glyphPen, chevron1); g.DrawLines(glyphPen, chevron2); } g.SmoothingMode = SmoothingMode.AntiAlias; }
private void setcolor() { color = Properties.Settings.Default.Color; gbEnergy.BackColor = ControlPaint.LightLight(ControlPaint.LightLight((ControlPaint.LightLight(color)))); button1.BackColor = color; button2.BackColor = color; }
private void setcolor() { color = Properties.Settings.Default.Color; gbConnectToBank.BackColor = ControlPaint.LightLight(ControlPaint.LightLight(ControlPaint.LightLight(ControlPaint.LightLight((ControlPaint.LightLight(color)))))); button2.BackColor = button1.BackColor = button3.BackColor = color; }
private void SetColor() { color = Properties.Settings.Default.Color; grdIntermittenc.ColumnHeadersDefaultCellStyle.BackColor = color; //toolStripMenuItem1.BackColor = toolStripMenuItem2.BackColor = toolStripMenuItem3.BackColor = toolStripMenuItem4.BackColor = toolStripMenuItem5.BackColor grdIntermittenc.RowsDefaultCellStyle.SelectionBackColor = ControlPaint.LightLight(color); grdIntermittenc.AlternatingRowsDefaultCellStyle.BackColor = ControlPaint.LightLight(ControlPaint.LightLight(ControlPaint.LightLight(ControlPaint.LightLight(color)))); }
private void executeButton_Button_Pressed(object sender, EventArgs e) { if (this.executeButton.Button_Text.ToUpper().Equals("EXECUTE")) { // Change color on both the 'step3' and 'step 4 labels this.step3Label.ForeColor = ControlPaint.LightLight(SystemColors.ActiveCaption); this.step4Label.ForeColor = ControlPaint.LightLight(SystemColors.ActiveCaption); // Toggle the button text this.executeButton.Button_Text = "STOP"; this.cancelButton.Button_Text = "CLEAR"; // Make sure there are rows in the data table if (this.excelDataTbl.Rows.Count >= 0) { if (!Validate_Columns()) { this.executeButton.Button_Text = "EXECUTE"; this.cancelButton.Button_Text = "EXIT"; return; } else { // Import Records this.Import_Records(this.excelDataTbl); } } else { this.executeButton.Button_Text = "EXECUTE"; } } else if (this.executeButton.Button_Text.ToUpper().Equals("STOP")) { // Toggle the button text this.Disable_FormControls(); this.cancelButton.Button_Enabled = true; try { // check if the Processor thread is running if ((processThread != null) && (processThread.ThreadState == ThreadState.Running)) { // Set flag to indicate that the Process thread will be // aborted tbe next time through the delegate method: // processor_Volume_Processed(). this.processor.StopThread = true; Thread.Sleep(100); } } catch { } } }
private void InitSettings() { YnoteThemeReader.ApplyTheme(Globals.Settings.ThemeFile, Highlighter, codebox); codebox.AllowDrop = true; codebox.ShowScrollBars = Globals.Settings.ScrollBars; codebox.AutoCompleteBrackets = Globals.Settings.AutoCompleteBrackets; codebox.TabLength = Globals.Settings.TabSize; codebox.Font = new Font(Globals.Settings.FontFamily, Globals.Settings.FontSize); codebox.ShowFoldingLines = Globals.Settings.ShowFoldingLines; codebox.ShowLineNumbers = Globals.Settings.ShowLineNumbers; codebox.HighlightFoldingIndicator = Globals.Settings.HighlightFolding; codebox.FindEndOfFoldingBlockStrategy = Globals.Settings.FoldingStrategy; codebox.BracketsHighlightStrategy = Globals.Settings.BracketsStrategy; codebox.CaretVisible = Globals.Settings.ShowCaret; codebox.ShowFoldingLines = Globals.Settings.ShowFoldingLines; codebox.LineInterval = Globals.Settings.LineInterval; codebox.LeftPadding = Globals.Settings.PaddingWidth; codebox.VirtualSpace = Globals.Settings.EnableVirtualSpace; codebox.WideCaret = Globals.Settings.BlockCaret; codebox.WordWrap = Globals.Settings.WordWrap; codebox.Zoom = Globals.Settings.Zoom; codebox.HotkeysMapping = HotkeysMapping.Parse(File.ReadAllText(GlobalSettings.SettingsDir + "Editor.ynotekeys")); if (Globals.Settings.ImeMode) { codebox.ImeMode = ImeMode.On; } if (Globals.Settings.ShowChangedLine) { codebox.ChangedLineColor = ControlPaint.LightLight(codebox.CurrentLineColor); } if (Globals.Settings.ShowDocumentMap) { CreateDocumentMap(); } if (Globals.Settings.WrapWidth > 0) { codebox.WordWrapMode = WordWrapMode.WordWrapPreferredWidth; codebox.PreferredLineWidth = Globals.Settings.WrapWidth; } if (!Globals.Settings.ShowRuler) { return; } var ruler = new Ruler { Dock = DockStyle.Top, Location = new Point(0, 0), Size = new Size(284, 24), TabIndex = 1, Target = codebox }; Controls.Add(ruler); }
void DrawFile(Graphics offScreenDC, RectangleF rect, string text, bool highlight, DiskItem fileObject) { //if (fileObject.Depth > detailLevel) return; float x = rect.X; float y = rect.Y; float width = rect.Width; float height = rect.Height; stringFormat.Alignment = StringAlignment.Center; stringFormat.LineAlignment = StringAlignment.Center; stringFormat.Trimming = StringTrimming.Character; stringFormat.FormatFlags = StringFormatFlags.NoWrap; Color color = GetFileTypeColor(fileObject.Name); contrast = ControlPaint.Light(color); Color bright = ControlPaint.LightLight(Color.WhiteSmoke); Color dull = ControlPaint.Light(bright); //if (fileObject.IsHidden && fileObject.IsSystem) color = ControlPaint.Dark(color); //else // if (fileObject.IsHidden) // color = ControlPaint.Dark(color); //else // if (fileObject.IsSystem) // color = ControlPaint.Dark(color); if (rect.Height >= 2 && rect.Width >= 2) { using (GraphicsPath path = new GraphicsPath()) { path.AddRectangle(rect); using (PathGradientBrush fileBrush = new PathGradientBrush(path)) { Color[] colors = { highlight?contrast : color }; fileBrush.SurroundColors = colors; fileBrush.CenterColor = dull;// highlight ? bright : dull; offScreenDC.FillPath(fileBrush, path); } } } else { if (rect.Height > 0 && rect.Width > 0) { using (Brush fileBrush = new SolidBrush(highlight ? contrast : color)) offScreenDC.FillRectangle(fileBrush, rect.X, rect.Y, rect.Width, rect.Height); } } WriteCaption(offScreenDC, text + Environment.NewLine + FormatSize(fileObject.Size), new RectangleF(x + 2, y, width, height - 2), GetContrast(color), highlight, 7f); using (Pen pen = new Pen(highlight ? dull : Color.Gray)) offScreenDC.DrawRectangle(pen, rect.X, rect.Y, rect.Width, rect.Height); }
private void lvTaskList_DrawItem(object sender, DrawListViewItemEventArgs e) { //Get the task associated with the list view item WlbScheduledTask task = TaskFromItem(e.Item); //Set the row color based on the Opt Mode Color color = GetTaskOptMode(task) == WlbPoolPerformanceMode.MaximizePerformance ? COLOR_MAX_PERFORMANCE : COLOR_MAX_DENSITY; if (!task.Enabled) { color = COLOR_DISABLED_TASK; } // Fill the full width of the control, not just to the end of the column headers. Rectangle rect = e.Bounds; int i = 0; foreach (ColumnHeader col in lvTaskList.Columns) { i += col.Width; } // Fill from the right of the rightmost item to the end of the control rect.Width = Math.Max(i, lvTaskList.ClientSize.Width); rect.X = i; if (e.Item.Selected) { SolidBrush brush = new SolidBrush(SystemColors.Highlight); e.Graphics.FillRectangle(brush, rect); } else { Rectangle topRect = new Rectangle(rect.X, rect.Y, rect.Width, rect.Height / 2); Rectangle botRect = new Rectangle(rect.X, rect.Y + topRect.Height, rect.Width, rect.Height / 2); if (e.ItemIndex == 0 || (e.ItemIndex > 0 && lvTaskList.Items[e.ItemIndex - 1].SubItems[2].Text != e.Item.SubItems[2].Text)) { using (LinearGradientBrush brush = new LinearGradientBrush(topRect, COLOR_NEW_DAY, ControlPaint.LightLight(color), 90f)) // SystemBrushes.Highlight; { e.Graphics.FillRectangle(brush, topRect); } } else { using (LinearGradientBrush brush = new LinearGradientBrush(topRect, color, ControlPaint.LightLight(color), 90f)) // SystemBrushes.Highlight; { e.Graphics.FillRectangle(brush, topRect); } } using (LinearGradientBrush brush = new LinearGradientBrush(botRect, ControlPaint.LightLight(color), color, 90f)) // SystemBrushes.Highlight; { e.Graphics.FillRectangle(brush, botRect); } } }