protected CustomList(string name) { this.name=name; SetStyle(ControlStyles.AllPaintingInWmPaint|ControlStyles.DoubleBuffer|ControlStyles.UserPaint,true); collection = new ArrayList(); vert = new VScrollBar(); vert.Height=Height; vert.Location=new Point(Width-vert.Width,0); vert.Minimum=0; vert.Maximum=1; vert.Scroll+=new ScrollEventHandler(scroll); Controls.Add(vert); strList = new string[]{"Edit","Delete"}; border = Border3DStyle.Etched; bStyle=BorderStyle.None; properties = new StrPropertyList(); StrProperty.Update+=new NoArgsDelegate(Refresh); // allowedChars = new Hashtable(); // allowedChars[Keys.Space]=' '; }
protected CustomList(string name) { this.name = name; SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.DoubleBuffer | ControlStyles.UserPaint, true); collection = new ArrayList(); vert = new VScrollBar(); vert.Height = Height; vert.Location = new Point(Width - vert.Width, 0); vert.Minimum = 0; vert.Maximum = 1; vert.Scroll += new ScrollEventHandler(scroll); Controls.Add(vert); strList = new string[] { "Edit", "Delete" }; border = Border3DStyle.Etched; bStyle = BorderStyle.None; properties = new StrPropertyList(); StrProperty.Update += new NoArgsDelegate(Refresh); // allowedChars = new Hashtable(); // allowedChars[Keys.Space]=' '; }
public KenPanel() { this.borderMode = BorderMode.None; this.borderColor = Color.Black; this.border3DStyle = System.Windows.Forms.Border3DStyle.Etched; this.borderSide = ToolStripStatusLabelBorderSides.All; }
/// <summary> /// ... /// </summary> /// <param name="borderStyle"></param> /// <returns></returns> public static Size GetBorder3DSize(Border3DStyle border3DStyle) { // offset the grid control's borders switch (border3DStyle) { case Border3DStyle.Bump: case Border3DStyle.Etched: case Border3DStyle.Raised: case Border3DStyle.Sunken: // get the dimensions, in pixels, of a three-dimensional (3-D) border. return(SystemInformation.Border3DSize); case Border3DStyle.Flat: case Border3DStyle.RaisedInner: case Border3DStyle.RaisedOuter: case Border3DStyle.SunkenInner: case Border3DStyle.SunkenOuter: // get the width and height, in pixels, of a window border. return(SystemInformation.BorderSize); case Border3DStyle.Adjust: return(new Size(0, 0)); default: return(new Size(0, 0)); } }
/// <summary> /// CSharpToolBarクラスのインスタンスを初期化 /// </summary> public CSharpToolBar() { // // TODO: コンストラクタ ロジックをここに追加してください。 // buttons = new CSharpToolBarButtonCollection(this); appearance = CSharpToolBarAppearance.Normal; borderStyle = Border3DStyle.Adjust; textAlign = ToolBarTextAlign.Underneath; imageList = null; buttonSize = new Size(80, 25); autoToolBarSize = false; autoAdjustSize = true; wrappable = true; allowDragButton = true; // ちらつきを押さえるために各スタイルを設定 SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.DoubleBuffer | ControlStyles.UserPaint, true); //this.BackColor = Color.Transparent; //Dock = DockStyle.Top; }
/// <summary> /// /// </summary> /// <param name="g"></param> /// <param name="style"></param> /// <param name="color"></param> /// <param name="x"></param> /// <param name="y"></param> /// <param name="width"></param> /// <param name="height"></param> public static void DrawBorder(this Graphics g, Border3DStyle style, Color color, int x, int y, int width, int height) { switch (style) { case Border3DStyle.Flat: DrawBorderFlat(g, color, x, y, width, height); break; case Border3DStyle.Raised: DrawBorderRaised(g, color, x, y, width, height); break; case Border3DStyle.RaisedInner: DrawBorderRaisedInner(g, color, x, y, width, height); break; case Border3DStyle.Sunken: DrawBorderSunken(g, color, x, y, width, height); break; case Border3DStyle.SunkenOuter: DrawBorderSunkenOuter(g, color, x, y, width, height); break; } }
private int Border3dStyleToBorder(Border3DStyle border) { switch (border) { case Border3DStyle.RaisedOuter: return(1); case Border3DStyle.SunkenOuter: return(2); case Border3DStyle.RaisedInner: return(4); case Border3DStyle.Raised: return(5); case Border3DStyle.Etched: return(6); case Border3DStyle.SunkenInner: return(8); case Border3DStyle.Bump: return(9); case Border3DStyle.Sunken: return(10); case Border3DStyle.Flat: return(0x4000); } return(0); }
protected void PaintTab(BpTabPage page, Graphics g) { Rectangle bounds = GetTabRect(page); VisualStyleElement element = GetElement(page); if (Application.RenderWithVisualStyles && VisualStyleRenderer.IsElementDefined(element)) { VisualStyleRenderer renderer = new VisualStyleRenderer(element); renderer.DrawBackground(g, bounds); bounds = renderer.GetBackgroundContentRectangle(g, bounds); } else { ControlPaint.DrawBorder3D(g, bounds, Border3DStyle.Raised, Border3DSide.Left | Border3DSide.Top | Border3DSide.Right | Border3DSide.Middle); } if (IncludesCloseButton(page)) { Rectangle closerect = GetTabCloseRect(page, bounds); element = VisualStyleElement.ToolTip.Close.Normal; Border3DStyle borderstyle = Border3DStyle.Flat; if (hoverClose) { if (clickClose == page) { element = VisualStyleElement.ToolTip.Close.Pressed; borderstyle = Border3DStyle.Sunken; } else if (clickClose == null) { element = VisualStyleElement.ToolTip.Close.Hot; borderstyle = Border3DStyle.Raised; } } if (Application.RenderWithVisualStyles && VisualStyleRenderer.IsElementDefined(element)) { VisualStyleRenderer renderer = new VisualStyleRenderer(element); renderer.DrawBackground(g, closerect); } else { if (borderstyle != Border3DStyle.Flat) { ControlPaint.DrawBorder3D(g, closerect, borderstyle); } Font closefont = new Font("Marlett", SystemFonts.MenuFont.Size); Point pos = closerect.Location; pos.X += SystemInformation.Border3DSize.Width; pos.Y += SystemInformation.Border3DSize.Height; TextRenderer.DrawText(g, "r", closefont, pos, Color.Black); } } bounds = GetTabContentRect(page, bounds); TabPaintEventArgs ea = new TabPaintEventArgs(g, bounds, page); OnTabPaint(ea); page.CallTabPaint(ea); }
protected override void OnPaint(PaintEventArgs e) { if (_borderStyle == borderStyle.etched) { base.OnPaint(e); } else { Graphics g = e.Graphics; SolidBrush sb = new SolidBrush(this.BackColor); try { SizeF sz = g.MeasureString(this.Text, this.Font); int hh = (int)(sz.Height / 2); Rectangle rr = this.ClientRectangle; Rectangle r = new Rectangle(rr.Left, rr.Top + hh, rr.Width, rr.Height - hh); Border3DStyle bs = Border3DStyle.Etched; Pen p; Rectangle r2; switch (_borderStyle) { case borderStyle.black: p = new Pen(Color.Black); r2 = new Rectangle(r.Left, r.Top, r.Width - 1, r.Height - 1); g.DrawRectangle(p, r2); p.Dispose(); break; case borderStyle.gray: p = new Pen(Color.Gray); r2 = new Rectangle(r.Left, r.Top, r.Width - 1, r.Height - 1); g.DrawRectangle(p, r2); p.Dispose(); break; case borderStyle.raised: bs = Border3DStyle.Raised; ControlPaint.DrawBorder3D(g, r, bs); break; case borderStyle.sunken: bs = Border3DStyle.Sunken; ControlPaint.DrawBorder3D(g, r, bs); break; } sb.Color = this.BackColor; g.FillRectangle(sb, new RectangleF(9f, 0, sz.Width, sz.Height)); sb.Color = this.ForeColor; g.DrawString(this.Text, this.Font, sb, new PointF(9f, 0)); } finally { sb.Dispose(); } } // }
/// <summary> /// /// </summary> public CPanelPlus() : base() { InitializeComponent(); this.borderMode = BorderMode.None; this.borderColor = Color.Black; this.border3DStyle = System.Windows.Forms.Border3DStyle.Etched; this.borderSide = ToolStripStatusLabelBorderSides.All; }
/// <summary> /// 构造函数 /// </summary> public PanelEx() { this.borderIsSingleMode = true; this.borderColor = Color.Black; this.border3DStyle = Border3DStyle.Etched; this.borderSide = ToolStripStatusLabelBorderSides.None; this.cornerRadius = 5; }
public static void DrawBorder3D(Graphics graphics, Rectangle rectangle, Border3DStyle style) { DrawBorder3D(graphics, rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height, style, Border3DSide.Left | Border3DSide.Top | Border3DSide.Right | Border3DSide.Bottom); }
public LayerFormOption() { IsShow = true; BorderType = BorderStyle.Fixed3D; Border3DStyle = System.Windows.Forms.Border3DStyle.RaisedInner; BorderSingleStyle = ButtonBorderStyle.Solid; BorderColor = Color.DarkGray; }
public static void DrawBorder3D(Graphics graphics, int x, int y, int width, int height, Border3DStyle style) { DrawBorder3D(graphics, x, y, width, height, style, Border3DSide.Left | Border3DSide.Top | Border3DSide.Right | Border3DSide.Bottom); }
public CollapsibleSplitter() { base.MinSize = 0; lastGoodSplitPosition = null; border3DStyle = Border3DStyle.Flat; base.BorderStyle = BorderStyle.None; BorderStyle = BorderStyle.Fixed3D; gripLength = 90; minSize = 25; }
public CollapsibleSplitter() { base.MinSize = 0; lastGoodSplitPosition = null; border3DStyle = Border3DStyle.Flat; base.BorderStyle = BorderStyle.None; BorderStyle = BorderStyle.Fixed3D; gripLength = 90; minSize = 25; }
/// <summary> /// Initializes a new instance of the <see cref="BevelControl"/> class. /// </summary> public BevelControl() { // This call is required by the Windows.Forms Form Designer. InitializeComponent(); SetStyle(ControlStyles.ResizeRedraw, true); SetStyle(ControlStyles.DoubleBuffer, true); style = DefaultStyle; sides = DefaultShape; }
public static void DrawBorder3D(Graphics graphics, int x, int y, int width, int height, Border3DStyle style, Border3DSide sides) { ThemeManager.MainPainter.DrawBorder3D (graphics, x, y, width, height, SystemColors.InactiveBorder, SystemColors.Control, style, sides); }
/// <summary> /// /// </summary> public CFloatPopupBaseForm() { InitializeComponent(); //初始化基类属性 this.InitBaseProperties(); //初始化边框相关 this.defaultBorderType = BorderStyle.Fixed3D; this.defaultBorder3DStyle = System.Windows.Forms.Border3DStyle.RaisedInner; this.defaultBorderSingleStyle = ButtonBorderStyle.Solid; this.defaultBorderColor = Color.DarkGray; //初始化消息筛选器。添加和移除在显示/隐藏时负责 this.defaultMousMessageFilter = new MouseMessageFilter(this); }
private void SwitchTrackedLabel(Border3DStyle regular, Border3DStyle alternate) { bool hasSunkenTag = false; try { hasSunkenTag = ("sunken" == (string)trackedLabel.Tag); } catch (InvalidCastException) { } trackedLabel.BorderStyle = (hasSunkenTag ? regular : alternate); this.statusStrip.Refresh(); }
/// <summary> implement ControlPaint.DrawBorder3D. /// This is a basic implementation, using DrawEdge. For now, it is good enough for /// the sunken style we need. /// </summary> /// <param name="graphics"></param> /// <param name="rectangle"></param> /// <param name="style"></param> internal static void DrawBorder3D(Graphics graphics, Rectangle rectangle, Border3DStyle style) { RECT rc = new RECT(); rc.left = rectangle.Left; rc.top = rectangle.Top; rc.right = rectangle.Right; rc.bottom = rectangle.Bottom; IntPtr hdc = graphics.GetHdc(); // Border3DStyle flags are the same values as DrawEdge flags NativeWindowCommon.DrawEdge(hdc, ref rc, (uint)style, NativeWindowCommon.BF_RECT); graphics.ReleaseHdc(hdc); }
//构造函数 public FloatLayerBase() { //初始化消息筛选器。添加和移除在显示/隐藏时负责 _mouseMsgFilter = new AppMouseMessageHandler(this); //初始化基类属性 InitBaseProperties(); //初始化边框相关 _borderType = BorderStyle.Fixed3D; _border3DStyle = System.Windows.Forms.Border3DStyle.RaisedInner; _borderSingleStyle = ButtonBorderStyle.Solid; _borderColor = Color.DarkGray; }
/// <summary>Paints the rule.</summary> protected override void OnPaint(PaintEventArgs e) { // Create a local version of the graphics object for the Bevel. Graphics g = e.Graphics; Rectangle r = ClientRectangle; if (Style != BevelStyle.Flat) { Border3DStyle style = Border3DStyle.SunkenOuter; if (Style == BevelStyle.Raised) { style = Border3DStyle.RaisedInner; } // Draw the Bevel. switch (Shape) { case Border3DSide.All: ControlPaint.DrawBorder3D(g, r.Left, r.Top, r.Width, r.Height, style); break; case Border3DSide.Left: ControlPaint.DrawBorder3D(g, r.Left, r.Top, 2, r.Height, style); break; case Border3DSide.Top: ControlPaint.DrawBorder3D(g, r.Left, r.Top, r.Width, 2, style); break; case Border3DSide.Bottom: ControlPaint.DrawBorder3D(g, r.Left, r.Bottom - 2, r.Width, 2, style); break; case Border3DSide.Middle: break; case Border3DSide.Right: ControlPaint.DrawBorder3D(g, r.Right - 2, r.Top, 2, r.Height, style); break; default: Debug.Assert(false); break; } } // Calling the base class OnPaint base.OnPaint(e); }
/// <summary> /// /// </summary> /// <param name="border3DStyle"></param> /// <param name="color"></param> /// <param name="targets"></param> public void AddBorder3D(Border3DStyle border3DStyle, Color color, params Control[] targets) { if (targets == null) { throw new ArgumentNullException("targets"); } foreach (var target in targets) { borderEffects.Add(new Border3DEffect(target) { Border3DStyle = border3DStyle, Color = color }); } }
/// <summary> /// ProgressCtrlクラスのインスタンスを初期化 /// </summary> public ProgressCtrl() { // // TODO: コンストラクタ ロジックをここに追加してください。 // SetStyle(ControlStyles.UserPaint, true); SetStyle(ControlStyles.AllPaintingInWmPaint, true); SetStyle(ControlStyles.DoubleBuffer, true); SetStyle(ControlStyles.ResizeRedraw, true); border = Border3DStyle.SunkenOuter; minimum = 0; position = 0; maximum = 100; step = 1; }
private static void DrawBorder(Border3DStyle Style, Color BorderColor, Graphics g, Rectangle r) { using (var normal = GetNormalBrush(BorderColor)) using (var light = GetLightBrush(BorderColor)) using (var dark = GetDarkBrush(BorderColor)) using (var darkdark = GetDarkDarkBrush(BorderColor)) { switch (Style) { case Border3DStyle.Sunken: { DrawSunkenBorder(g, dark, r, darkdark, light, normal); break; } case Border3DStyle.Raised: { DrawRaisedBorder(g, dark, r, darkdark, light, normal); break; } case Border3DStyle.RaisedInner: { RaisedInnerBorder(g, dark, r, light); break; } case Border3DStyle.SunkenOuter: { DrawSunkenOuterBorder(g, dark, r, light); break; } case Border3DStyle.Etched: { break; } default: break; } } }
protected override void OnPaintBackground(PaintEventArgs e) { // draw the background color for our control image LinearGradientBrush brush = new LinearGradientBrush(ClientRectangle, BackColor, (BackColorEnd == Color.Empty) ? BackColor : BackColorEnd, (IsSplitterVertical()) ? LinearGradientMode. Horizontal : LinearGradientMode. Vertical); e.Graphics.FillRectangle(brush, ClientRectangle); Border3DStyle style = border3DStyle; switch (BorderStyle) { case BorderStyle.FixedSingle: style = Border3DStyle.Flat; break; case BorderStyle.None: return; } if (IsSplitterVertical()) { ControlPaint.DrawBorder3D(e.Graphics, ClientRectangle, style, Border3DSide.Left | Border3DSide.Right); } else { ControlPaint.DrawBorder3D(e.Graphics, ClientRectangle, style, Border3DSide.Top | Border3DSide.Bottom); } return; }
/// <summary> /// TabButtonControl クラスのインスタンスを初期化。 /// </summary> public TabButtonControl() { // // TODO: コンストラクタ ロジックをここに追加してください。 // buttons = new TabButtonCollection(this); borderStyle = Border3DStyle.Adjust; buttonStyle = TabButtonStyle.Flat; autoAdjustButtonSize = true; autoAdjustControlHeight = true; wrappable = true; imageList = null; hotTrack = true; hotTrackColor = SystemColors.ControlDark; buttonSize = new Size(80, 20); // ちらつきを押さえるために各スタイルを設定 SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.DoubleBuffer | ControlStyles.UserPaint, true); }
protected override void OnPaint(PaintEventArgs pe) { base.OnPaint(pe); text = this.Text; if (textX == 100 && textY == 25) { textX = ((this.Width) / 3) + 10; textY = (this.Height / 2) - 1; } Color c1 = Color.FromArgb(color1Transparent, color1); Color c2 = Color.FromArgb(color2Transparent, color2); //drawing string & filling gradient rectangle Brush b = new System.Drawing.Drawing2D.LinearGradientBrush(ClientRectangle, c1, c2, angle); Point p = new Point(textX, textY); SolidBrush frcolor = new SolidBrush(this.ForeColor); Border3DStyle borderStyle = Border3DStyle.SunkenInner; pe.Graphics.FillRectangle(b, ClientRectangle); pe.Graphics.DrawString(text, this.Font, frcolor, p); ControlPaint.DrawBorder3D(pe.Graphics, ClientRectangle, borderStyle); b.Dispose(); }
/// <summary> /// /// </summary> /// <param name="style"></param> /// <returns></returns> public static int CalcBorderWidth(this Border3DStyle style) { switch (style) { case Border3DStyle.Flat: return(1); case Border3DStyle.Raised: return(2); case Border3DStyle.RaisedInner: return(1); case Border3DStyle.Sunken: return(2); case Border3DStyle.SunkenOuter: return(1); } throw new NotSupportedException(String.Format(CultureInfo.InvariantCulture, "Style {0} is not supported.", style)); }
private static void DrawBorder(Border3DStyle Style, Color BorderColor, Graphics g, Rectangle r) { using (SolidBrush normal = GetNormalBrush(BorderColor)) using (SolidBrush light = GetLightBrush(BorderColor)) using (SolidBrush dark = GetDarkBrush(BorderColor)) using (SolidBrush darkdark = GetDarkDarkBrush(BorderColor)) { switch (Style) { case Border3DStyle.Sunken: { DrawSunkenBorder(g, dark, r, darkdark, light, normal); break; } case Border3DStyle.Raised: { DrawRaisedBorder(g, dark, r, darkdark, light, normal); break; } case Border3DStyle.RaisedInner: { RaisedInnerBorder(g, dark, r, light); break; } case Border3DStyle.SunkenOuter: { DrawSunkenOuterBorder(g, dark, r, light); break; } case Border3DStyle.Etched: { break; } default: break; } } }
public static void DrawBorder3D(Graphics graphics, int x, int y, int width, int height, Border3DStyle style, Border3DSide sides) { if (graphics == null) { throw new ArgumentNullException("graphics"); } int edge = ((int) style) & 15; int flags = (int) (sides | ((Border3DSide) ((int) (style & ~(Border3DStyle.Sunken | Border3DStyle.Raised))))); System.Windows.Forms.NativeMethods.RECT rect = System.Windows.Forms.NativeMethods.RECT.FromXYWH(x, y, width, height); if ((flags & 0x2000) == 0x2000) { Size size = SystemInformation.Border3DSize; rect.left -= size.Width; rect.right += size.Width; rect.top -= size.Height; rect.bottom += size.Height; flags &= -8193; } using (WindowsGraphics graphics2 = WindowsGraphics.FromGraphics(graphics)) { System.Windows.Forms.SafeNativeMethods.DrawEdge(new HandleRef(graphics2, graphics2.DeviceContext.Hdc), ref rect, edge, flags); } }
public static void DrawBorder3D(Graphics graphics, Rectangle rectangle, Border3DStyle style, Border3DSide sides) { DrawBorder3D(graphics, rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height, style, sides); }
internal static void PrintBorder(Graphics graphics, Rectangle bounds, BorderStyle style, Border3DStyle b3dStyle) { if (graphics == null) { throw new ArgumentNullException("graphics"); } switch (style) { case BorderStyle.None: break; case BorderStyle.FixedSingle: DrawBorder(graphics, bounds, Color.FromKnownColor(KnownColor.WindowFrame), ButtonBorderStyle.Solid); return; case BorderStyle.Fixed3D: DrawBorder3D(graphics, bounds, b3dStyle); break; default: return; } }
public abstract void CPDrawBorder3D(Graphics graphics, Rectangle rectangle, Border3DStyle style, Border3DSide sides);
public override void CPDrawBorder3D (Graphics graphics, Rectangle rectangle, Border3DStyle style, Border3DSide sides) { CPDrawBorder3D(graphics, rectangle, style, sides, ColorControl); }
void DrawHeader(Graphics g, int index, Rectangle rc, Border3DStyle style) { string bandName = bands[index].Text; using (Brush b = new SolidBrush(ColorUtil.VSNetControlColor)) { g.FillRectangle(b, rc); } if (ColorUtil.UsingCustomColor) { if (style == Border3DStyle.RaisedInner) { using (var p = new Pen(ColorUtil.VSNetBorderColor)) g.DrawRectangle(p, rc.Left, rc.Top, rc.Width - 1, rc.Height - 1); } else { using (Brush fillColor = new SolidBrush(ColorUtil.VSNetSelectionColor)) g.FillRectangle(fillColor, rc); using (var p = new Pen(ColorUtil.VSNetBorderColor)) g.DrawRectangle(p, rc.Left, rc.Top, rc.Width - 1, rc.Height - 1); } } else { ControlPaint.DrawBorder3D(g, rc, style); } using (StringFormat stringFormat = new StringFormat()) { stringFormat.LineAlignment = StringAlignment.Center; stringFormat.Alignment = StringAlignment.Center; g.DrawString(bandName, Font, SystemBrushes.WindowText, rc, stringFormat); } }
public static void DrawBorder3D(System.Drawing.Graphics graphics, int x, int y, int width, int height, Border3DStyle style, Border3DSide sides) {}
public ToolStripStatusLabel(Image image) : base(null, image, false, null) { this.borderStyle = Border3DStyle.Flat; }
public ToolStripStatusLabel() { this.borderStyle = Border3DStyle.Flat; }
// public override void CPDrawBorder3D (Graphics graphics, Rectangle rectangle, Border3DStyle style, Border3DSide sides) { // CPDrawBorder3D(graphics, rectangle, style, sides, ColorControl); // } public override void CPDrawBorder3D (Graphics graphics, Rectangle rectangle, Border3DStyle style, Border3DSide sides, Color control_color) { Pen penTopLeft; Pen penTopLeftInner; Pen penBottomRight; Pen penBottomRightInner; Rectangle rect= new Rectangle (rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height); if ((style & Border3DStyle.Adjust) != 0) { rect.Y -= 2; rect.X -= 2; rect.Width += 4; rect.Height += 4; } penTopLeft = penTopLeftInner = penBottomRight = penBottomRightInner = ResPool.GetPen (control_color); CPColor cpcolor = ResPool.GetCPColor (control_color); switch (style) { case Border3DStyle.Raised: penTopLeftInner = ResPool.GetPen (cpcolor.LightLight); penBottomRight = ResPool.GetPen (cpcolor.Dark); penBottomRightInner = ResPool.GetPen (BorderColor); break; case Border3DStyle.Sunken: penTopLeft = ResPool.GetPen (BorderColor); penTopLeftInner = ResPool.GetPen (cpcolor.Dark); penBottomRight = ResPool.GetPen (cpcolor.LightLight); break; case Border3DStyle.Etched: penTopLeft = penBottomRightInner = ResPool.GetPen (BorderColor); penTopLeftInner = penBottomRight = ResPool.GetPen (cpcolor.LightLight); break; case Border3DStyle.RaisedOuter: penBottomRight = ResPool.GetPen (cpcolor.Dark); break; case Border3DStyle.SunkenOuter: penTopLeft = ResPool.GetPen (BorderColor); penBottomRight = ResPool.GetPen (cpcolor.LightLight); break; case Border3DStyle.RaisedInner: penTopLeft = ResPool.GetPen (cpcolor.LightLight); penBottomRight = ResPool.GetPen (BorderColor); break; case Border3DStyle.SunkenInner: penTopLeft = ResPool.GetPen (cpcolor.Dark); break; case Border3DStyle.Flat: penTopLeft = penBottomRight = ResPool.GetPen (BorderColor); break; case Border3DStyle.Bump: penTopLeftInner = penBottomRight = ResPool.GetPen (cpcolor.Dark); break; default: break; } if ((sides & Border3DSide.Middle) != 0) { graphics.FillRectangle (ResPool.GetSolidBrush (control_color), rect); } if ((sides & Border3DSide.Left) != 0) { graphics.DrawLine (penTopLeft, rect.Left, rect.Bottom - 2, rect.Left, rect.Top); graphics.DrawLine (penTopLeftInner, rect.Left + 1, rect.Bottom - 2, rect.Left + 1, rect.Top); } if ((sides & Border3DSide.Top) != 0) { graphics.DrawLine (penTopLeft, rect.Left, rect.Top, rect.Right - 2, rect.Top); graphics.DrawLine (penTopLeftInner, rect.Left + 1, rect.Top + 1, rect.Right - 3, rect.Top + 1); } if ((sides & Border3DSide.Right) != 0) { graphics.DrawLine (penBottomRight, rect.Right - 1, rect.Top, rect.Right - 1, rect.Bottom - 1); graphics.DrawLine (penBottomRightInner, rect.Right - 2, rect.Top + 1, rect.Right - 2, rect.Bottom - 2); } if ((sides & Border3DSide.Bottom) != 0) { graphics.DrawLine (penBottomRight, rect.Left, rect.Bottom - 1, rect.Right - 1, rect.Bottom - 1); graphics.DrawLine (penBottomRightInner, rect.Left + 1, rect.Bottom - 2, rect.Right - 2, rect.Bottom - 2); } }
/// <summary> /// Default constructor of the control /// </summary> public InfoBarLite() { m_Image = null; m_ImageAlignment = ImageAlignment.TopLeft; m_BackStyle = BackStyle.Solid; m_GradientMode = LinearGradientMode.Horizontal; m_GradientStartColor = Color.DeepSkyBlue; m_GradientEndColor = Color.White; m_BorderStyle = Border3DStyle.Etched; m_BorderSide = Border3DSide.Bottom; m_Text1 = "Peace at home, peace in the world!"; m_Text1ForeColor = SystemColors.ControlText; m_Text2 = "The quick brown fox lazily jumped over the bridge."; m_Text2ForeColor = SystemColors.ControlText; try { m_Text1Font = new Font("Tahoma", 8, FontStyle.Bold, GraphicsUnit.Point); m_Text2Font = new Font("Tahoma", 8); } catch { m_Text1Font = Font; m_Text2Font = Font; } m_ImageOffsetX = 2; m_ImageOffsetY = 0; m_Text1OffsetX = 0; m_Text1OffsetY = 0; m_Text2OffsetX = 20; m_Text2OffsetY = 0; BackColor = SystemColors.Window; ResizeRedraw = true; SetStyle(ControlStyles.UserPaint, true); SetStyle(ControlStyles.AllPaintingInWmPaint, true); SetStyle(ControlStyles.DoubleBuffer, true); }
public static void DrawBorder3D( Graphics graphics, Rectangle rectangle, Border3DStyle style, Border3DSide sides) { ThemeEngine.Current.CPDrawBorder3D (graphics, rectangle, style, sides); }
/// <summary> /// /// </summary> /// <param name="g"></param> /// <param name="style"></param> /// <param name="color"></param> /// <param name="x"></param> /// <param name="y"></param> /// <param name="width"></param> /// <param name="height"></param> public static void DrawBorder(this Graphics g, Border3DStyle style, Color color, int x, int y, int width, int height) { switch (style) { case Border3DStyle.Flat: DrawBorderFlat(g, color, x, y, width, height); break; case Border3DStyle.Raised: DrawBorderRaised(g, color, x, y, width, height); break; case Border3DStyle.RaisedInner: DrawBorderRaisedInner(g, color, x, y, width, height); break; case Border3DStyle.Sunken: DrawBorderSunken(g, color, x, y, width, height); break; case Border3DStyle.SunkenOuter: DrawBorderSunkenOuter(g, color, x, y, width, height); break; } }
public static void DrawBorder3D(System.Drawing.Graphics graphics, System.Drawing.Rectangle rectangle, Border3DStyle style, Border3DSide sides) {}
public ToolStripStatusLabel(string text, Image image) : base(text, image, false, null) { this.borderStyle = Border3DStyle.Flat; }
public ToolStripStatusLabel(string text, Image image, EventHandler onClick, string name) : base(text, image, false, onClick, name) { this.borderStyle = Border3DStyle.Flat; }
public abstract void CPDrawBorder3D (Graphics graphics, Rectangle rectangle, Border3DStyle style, Border3DSide sides, Color control_color);
private void DrawHeader( Graphics g, int index, Rectangle rc, Border3DStyle style ) { string bandName = bands[ index ].Text; Brush b = ( index == lastHighlightedHeader ) ? ColorUtil.VSNetSelectionBrush : ColorUtil.VSNetControlBrush; g.FillRectangle( b, rc ); if( ColorUtil.UsingCustomColor ) { Pen p = ColorUtil.VSNetBorderPen; if( style != Border3DStyle.RaisedInner ) { g.FillRectangle( ColorUtil.VSNetSelectionBrush, rc ); } g.DrawRectangle( p, rc.Left, rc.Top, rc.Width-1, rc.Height-1 ); } else { ControlPaint.DrawBorder3D( g, rc, style ); } StringFormat stringFormat = new StringFormat(); stringFormat.LineAlignment = StringAlignment.Center; stringFormat.Alignment = StringAlignment.Center; stringFormat.FormatFlags |= StringFormatFlags.LineLimit; stringFormat.Trimming = StringTrimming.EllipsisCharacter; g.DrawString( bandName, Font, SystemBrushes.WindowText, rc, stringFormat ); }
public abstract void CPDrawBorder3D (Graphics graphics, Rectangle rectangle, Border3DStyle style, Border3DSide sides);
public override void CPDrawBorder3D (Graphics graphics, Rectangle rectangle, Border3DStyle style, Border3DSide sides, Color control_color) { Pen penTopLeft; Pen penTopLeftInner; Pen penBottomRight; Pen penBottomRightInner; Rectangle rect= new Rectangle (rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height); bool is_ColorControl = control_color.ToArgb () == ColorControl.ToArgb () ? true : false; if ((style & Border3DStyle.Adjust) != 0) { rect.Y -= 2; rect.X -= 2; rect.Width += 4; rect.Height += 4; } penTopLeft = penTopLeftInner = penBottomRight = penBottomRightInner = is_ColorControl ? SystemPens.Control : ResPool.GetPen (control_color); CPColor cpcolor = CPColor.Empty; if (!is_ColorControl) cpcolor = ResPool.GetCPColor (control_color); switch (style) { case Border3DStyle.Raised: penTopLeftInner = is_ColorControl ? SystemPens.ControlLightLight : ResPool.GetPen (cpcolor.LightLight); penBottomRight = is_ColorControl ? SystemPens.ControlDarkDark : ResPool.GetPen (cpcolor.DarkDark); penBottomRightInner = is_ColorControl ? SystemPens.ControlDark : ResPool.GetPen (cpcolor.Dark); break; case Border3DStyle.Sunken: penTopLeft = is_ColorControl ? SystemPens.ControlDark : ResPool.GetPen (cpcolor.Dark); penTopLeftInner = is_ColorControl ? SystemPens.ControlDarkDark : ResPool.GetPen (cpcolor.DarkDark); penBottomRight = is_ColorControl ? SystemPens.ControlLightLight : ResPool.GetPen (cpcolor.LightLight); break; case Border3DStyle.Etched: penTopLeft = penBottomRightInner = is_ColorControl ? SystemPens.ControlDark : ResPool.GetPen (cpcolor.Dark); penTopLeftInner = penBottomRight = is_ColorControl ? SystemPens.ControlLightLight : ResPool.GetPen (cpcolor.LightLight); break; case Border3DStyle.RaisedOuter: penBottomRight = is_ColorControl ? SystemPens.ControlDarkDark : ResPool.GetPen (cpcolor.DarkDark); break; case Border3DStyle.SunkenOuter: penTopLeft = is_ColorControl ? SystemPens.ControlDark : ResPool.GetPen (cpcolor.Dark); penBottomRight = is_ColorControl ? SystemPens.ControlLightLight : ResPool.GetPen (cpcolor.LightLight); break; case Border3DStyle.RaisedInner: penTopLeft = is_ColorControl ? SystemPens.ControlLightLight : ResPool.GetPen (cpcolor.LightLight); penBottomRight = is_ColorControl ? SystemPens.ControlDark : ResPool.GetPen (cpcolor.Dark); break; case Border3DStyle.SunkenInner: penTopLeft = is_ColorControl ? SystemPens.ControlDarkDark : ResPool.GetPen (cpcolor.DarkDark); break; case Border3DStyle.Flat: penTopLeft = penBottomRight = is_ColorControl ? SystemPens.ControlDark : ResPool.GetPen (cpcolor.Dark); break; case Border3DStyle.Bump: penTopLeftInner = penBottomRight = is_ColorControl ? SystemPens.ControlDarkDark : ResPool.GetPen (cpcolor.DarkDark); break; default: break; } bool inner = ((style != Border3DStyle.RaisedOuter) && (style != Border3DStyle.SunkenOuter)); if ((sides & Border3DSide.Middle) != 0) { Brush brush = is_ColorControl ? SystemBrushes.Control : ResPool.GetSolidBrush (control_color); graphics.FillRectangle (brush, rect); } if ((sides & Border3DSide.Left) != 0) { graphics.DrawLine (penTopLeft, rect.Left, rect.Bottom - 2, rect.Left, rect.Top); if ((rect.Width > 2) && inner) graphics.DrawLine (penTopLeftInner, rect.Left + 1, rect.Bottom - 2, rect.Left + 1, rect.Top); } if ((sides & Border3DSide.Top) != 0) { graphics.DrawLine (penTopLeft, rect.Left, rect.Top, rect.Right - 2, rect.Top); if ((rect.Height > 2) && inner) graphics.DrawLine (penTopLeftInner, rect.Left + 1, rect.Top + 1, rect.Right - 3, rect.Top + 1); } if ((sides & Border3DSide.Right) != 0) { graphics.DrawLine (penBottomRight, rect.Right - 1, rect.Top, rect.Right - 1, rect.Bottom - 1); if ((rect.Width > 3) && inner) graphics.DrawLine (penBottomRightInner, rect.Right - 2, rect.Top + 1, rect.Right - 2, rect.Bottom - 2); } if ((sides & Border3DSide.Bottom) != 0) { graphics.DrawLine (penBottomRight, rect.Left, rect.Bottom - 1, rect.Right - 1, rect.Bottom - 1); if ((rect.Height > 3) && inner) graphics.DrawLine (penBottomRightInner, rect.Left + 1, rect.Bottom - 2, rect.Right - 2, rect.Bottom - 2); } }
/// <summary></summary> public StyledBorderPainter() { border = Border3DStyle.Raised; }
public abstract void CPDrawBorder3D(Graphics graphics, Rectangle rectangle, Border3DStyle style, Border3DSide sides, Color control_color);
public static void Draw3DBorder(Graphics g, Rectangle rect, Color color, Border3DStyle style) { var pen = new Pen(ControlPaint.Dark(color, 0.1f)); var pen2 = new Pen(ControlPaint.Dark(color, 0.5f)); var pen3 = new Pen(color); var pen4 = new Pen(ControlPaint.Light(color, 0.9f)); using (pen) { using (pen2) { using (pen3) { using (pen4) { var points = new[] { new Point(rect.Left, rect.Bottom - 2), new Point(rect.Left, rect.Top), new Point(rect.Right - 2, rect.Top) }; var pointArray2 = new[] { new Point(rect.Left + 1, rect.Bottom - 3), new Point(rect.Left + 1, rect.Top + 1), new Point(rect.Right - 3, rect.Top + 1) }; var pointArray3 = new[] { new Point(rect.Left + 1, rect.Bottom - 2), new Point(rect.Right - 2, rect.Bottom - 2), new Point(rect.Right - 2, rect.Top + 1) }; var pointArray4 = new[] { new Point(rect.Left, rect.Bottom - 1), new Point(rect.Right - 1, rect.Bottom - 1), new Point(rect.Right - 1, rect.Top) }; if (style == Border3DStyle.Sunken) { if (rect.Width >= 1) { g.DrawLines(pen, points); } if (rect.Width >= 4) { g.DrawLines(pen2, pointArray2); } if (rect.Width >= 3) { g.DrawLines(pen3, pointArray3); } if (rect.Width >= 2) { g.DrawLines(pen4, pointArray4); } } else if (style == Border3DStyle.Raised) { if (rect.Width >= 1) { g.DrawLines(pen3, points); } if (rect.Width >= 4) { g.DrawLines(pen4, pointArray2); } if (rect.Width >= 3) { g.DrawLines(pen, pointArray3); } if (rect.Width >= 2) { g.DrawLines(pen2, pointArray4); } } } } } } }
public static void DrawBorder3D(Graphics graphics, Rectangle rectangle, Border3DStyle style) { DrawBorder3D(graphics, rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height, style, Border3DSide.Bottom | Border3DSide.Right | Border3DSide.Top | Border3DSide.Left); }
private static void DrawBorder(Border3DStyle Style, Color BorderColor, Graphics g, Rectangle r) { SolidBrush normal = new SolidBrush(BorderColor); SolidBrush light; if (BorderColor.GetBrightness() > 0.6) light = new SolidBrush(MixColors(BorderColor, Color.White, 1)); else light = new SolidBrush(MixColors(BorderColor, Color.White, 0.5)); SolidBrush dark; SolidBrush darkdark; if (BorderColor.GetBrightness() < 0.5) { dark = new SolidBrush(MixColors(BorderColor, Color.Black, 0.7)); darkdark = new SolidBrush(MixColors(BorderColor, Color.Black, 1)); } else { dark = new SolidBrush(MixColors(BorderColor, Color.Black, 0.4)); darkdark = new SolidBrush(MixColors(BorderColor, Color.Black, 0.6)); } switch (Style) { case Border3DStyle.Sunken: { g.FillRectangle(dark, r.Left, r.Top, r.Width, 1); g.FillRectangle(dark, r.Left, r.Top, 1, r.Height); g.FillRectangle(darkdark, r.Left + 1, r.Top + 1, r.Width - 2, 1); g.FillRectangle(darkdark, r.Left + 1, r.Top + 1, 1, r.Height - 2); g.FillRectangle(light, r.Right - 1, r.Top + 1, 1, r.Height - 1); g.FillRectangle(light, r.Left + 1, r.Bottom - 1, r.Width - 1, 1); g.FillRectangle(normal, r.Right - 2, r.Top + 2, 1, r.Height - 3); g.FillRectangle(normal, r.Left + 2, r.Bottom - 2, r.Width - 3, 1); break; } case Border3DStyle.Raised: { g.FillRectangle(normal, r.Left, r.Top, r.Width - 1, 1); g.FillRectangle(normal, r.Left, r.Top, 1, r.Height - 1); g.FillRectangle(light, r.Left + 1, r.Top + 1, r.Width - 2, 1); g.FillRectangle(light, r.Left + 1, r.Top + 1, 1, r.Height - 2); g.FillRectangle(darkdark, r.Right - 1, r.Top, 1, r.Height); g.FillRectangle(darkdark, r.Left, r.Bottom - 1, r.Width, 1); g.FillRectangle(dark, r.Right - 2, r.Top + 1, 1, r.Height - 2); g.FillRectangle(dark, r.Left + 1, r.Bottom - 2, r.Width - 2, 1); break; } case Border3DStyle.RaisedInner: { g.FillRectangle(light, r.Left, r.Top, r.Width - 1, 1); g.FillRectangle(light, r.Left, r.Top, 1, r.Height - 1); // g.FillRectangle (light,r.Left+1,r.Top+1,r.Width -2,1); // g.FillRectangle (light,r.Left+1,r.Top+1,1,r.Height -2); g.FillRectangle(dark, r.Right - 1, r.Top, 1, r.Height); g.FillRectangle(dark, r.Left, r.Bottom - 1, r.Width, 1); // g.FillRectangle (dark,r.Right -2,r.Top+1,1,r.Height -2); // g.FillRectangle (dark,r.Left +1,r.Bottom-2,r.Width -2,1); break; } case Border3DStyle.SunkenOuter: { g.FillRectangle(dark, r.Left, r.Top, r.Width, 1); g.FillRectangle(dark, r.Left, r.Top, 1, r.Height); // g.FillRectangle (darkdark,r.Left+1,r.Top+1,r.Width -2,1); // g.FillRectangle (darkdark,r.Left+1,r.Top+1,1,r.Height -2); g.FillRectangle(light, r.Right - 1, r.Top + 1, 1, r.Height - 1); g.FillRectangle(light, r.Left + 1, r.Bottom - 1, r.Width - 1, 1); // g.FillRectangle (normal,r.Right -2,r.Top+2,1,r.Height -3); // g.FillRectangle (normal,r.Left +2,r.Bottom-2,r.Width -3,1); break; } case Border3DStyle.Etched: { break; } default: break; } normal.Dispose(); light.Dispose(); dark.Dispose(); darkdark.Dispose(); }
public static void DrawBorder3D(Graphics graphics, int x, int y, int width, int height, Border3DStyle style) { DrawBorder3D(graphics, x, y, width, height, style, Border3DSide.Bottom | Border3DSide.Right | Border3DSide.Top | Border3DSide.Left); }
/// <summary> /// /// </summary> /// <param name="g"></param> /// <param name="style"></param> /// <param name="color"></param> /// <param name="rect"></param> public static void DrawBorder(this Graphics g, Border3DStyle style, Color color, Rectangle rect) { DrawBorder(g, style, color, rect.X, rect.Y, rect.Width, rect.Height); }
public static void DrawBorder3D(Graphics graphics, Rectangle rectangle, Border3DStyle style) { DrawBorder3D(graphics, rectangle, style, Border3DSide.Left | Border3DSide.Right | Border3DSide.Top | Border3DSide.Bottom); }
public static void DrawBorder3D( Graphics graphics, int x, int y, int width, int height, Border3DStyle style,Border3DSide sides) { DrawBorder3D( graphics, new Rectangle(x, y, width, height), style, sides); }