/// <summary> /// Update the current value based on the state of the UI controls. /// </summary> private void UpdateCurrentValue() { if (!updateCurrentValue) { return; } ToolStripStatusLabelBorderSides valueSide = ToolStripStatusLabelBorderSides.None; if (allCheckBox.Checked) { valueSide |= ToolStripStatusLabelBorderSides.All; Value = valueSide; allChecked = true; noneChecked = false; return; } if (noneCheckBox.Checked) { valueSide |= ToolStripStatusLabelBorderSides.None; } if (topCheckBox.Checked) { valueSide |= ToolStripStatusLabelBorderSides.Top; } if (bottomCheckBox.Checked) { valueSide |= ToolStripStatusLabelBorderSides.Bottom; } if (leftCheckBox.Checked) { valueSide |= ToolStripStatusLabelBorderSides.Left; } if (rightCheckBox.Checked) { valueSide |= ToolStripStatusLabelBorderSides.Right; } if (valueSide == ToolStripStatusLabelBorderSides.None) { allChecked = false; noneChecked = true; noneCheckBox.Checked = true; } if (valueSide == (ToolStripStatusLabelBorderSides.Left | ToolStripStatusLabelBorderSides.Right | ToolStripStatusLabelBorderSides.Top | ToolStripStatusLabelBorderSides.Bottom)) { allChecked = true; noneChecked = false; allCheckBox.Checked = true; } Value = valueSide; }
/// <summary> /// Allows to select proper values.. /// </summary> private void SetCheckBoxCheckState(ToolStripStatusLabelBorderSides sides) { ResetCheckBoxState(); if ((sides & ToolStripStatusLabelBorderSides.All) == ToolStripStatusLabelBorderSides.All) { allCheckBox.Checked = true; topCheckBox.Checked = true; bottomCheckBox.Checked = true; leftCheckBox.Checked = true; rightCheckBox.Checked = true; allCheckBox.Checked = true; } else { noneCheckBox.Checked = (sides & ToolStripStatusLabelBorderSides.None) == ToolStripStatusLabelBorderSides.None; topCheckBox.Checked = (sides & ToolStripStatusLabelBorderSides.Top) == ToolStripStatusLabelBorderSides.Top; bottomCheckBox.Checked = (sides & ToolStripStatusLabelBorderSides.Bottom) == ToolStripStatusLabelBorderSides.Bottom; leftCheckBox.Checked = (sides & ToolStripStatusLabelBorderSides.Left) == ToolStripStatusLabelBorderSides.Left; rightCheckBox.Checked = (sides & ToolStripStatusLabelBorderSides.Right) == ToolStripStatusLabelBorderSides.Right; } }
public KenPanel() { 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; }
/// <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; }
public void Start(IWindowsFormsEditorService edSvc, object value) { this.edSvc = edSvc; this.originalValue = this.currentValue = value; ToolStripStatusLabelBorderSides sides = (ToolStripStatusLabelBorderSides)value; this.SetCheckBoxCheckState(sides); this.updateCurrentValue = true; }
/// <summary> /// Triggered whenever the user drops down the editor. /// </summary> public void Start(IWindowsFormsEditorService edSvc, object value) { Debug.Assert(edSvc != null); Debug.Assert(value is ToolStripStatusLabelBorderSides); EditorService = edSvc; originalValue = Value = value; ToolStripStatusLabelBorderSides currentSides = (ToolStripStatusLabelBorderSides)value; SetCheckBoxCheckState(currentSides); updateCurrentValue = true; }
private void UpdateCurrentValue() { if (this.updateCurrentValue) { ToolStripStatusLabelBorderSides none = ToolStripStatusLabelBorderSides.None; if (this.allCheckBox.Checked) { none |= ToolStripStatusLabelBorderSides.All; this.currentValue = none; this.allChecked = true; this.noneChecked = false; } else { if (this.noneCheckBox.Checked) { none = none; } if (this.topCheckBox.Checked) { none |= ToolStripStatusLabelBorderSides.Top; } if (this.bottomCheckBox.Checked) { none |= ToolStripStatusLabelBorderSides.Bottom; } if (this.leftCheckBox.Checked) { none |= ToolStripStatusLabelBorderSides.Left; } if (this.rightCheckBox.Checked) { none |= ToolStripStatusLabelBorderSides.Right; } if (none == ToolStripStatusLabelBorderSides.None) { this.allChecked = false; this.noneChecked = true; this.noneCheckBox.Checked = true; } if (none == ToolStripStatusLabelBorderSides.All) { this.allChecked = true; this.noneChecked = false; this.allCheckBox.Checked = true; } this.currentValue = none; } } }
private void checkedListBox1_ItemCheck(object sender, ItemCheckEventArgs e) { CheckedListBox ctrl = (CheckedListBox)sender; ToolStripStatusLabelBorderSides totalSelection = ToolStripStatusLabelBorderSides.None; foreach (string item in ctrl.CheckedItems) { ToolStripStatusLabelBorderSides selection = (ToolStripStatusLabelBorderSides)Enum.Parse(typeof(ToolStripStatusLabelBorderSides), item); totalSelection = totalSelection | selection; } ToolStripStatusLabel lbl = (ToolStripStatusLabel)ctrl.Parent.Tag; lbl.BorderSides = totalSelection; }
private void SetCheckBoxCheckState(ToolStripStatusLabelBorderSides sides) { this.ResetCheckBoxState(); if ((sides & ToolStripStatusLabelBorderSides.All) == ToolStripStatusLabelBorderSides.All) { this.allCheckBox.Checked = true; this.topCheckBox.Checked = true; this.bottomCheckBox.Checked = true; this.leftCheckBox.Checked = true; this.rightCheckBox.Checked = true; this.allCheckBox.Checked = true; } else { this.noneCheckBox.Checked = 0 == 0; this.topCheckBox.Checked = (sides & ToolStripStatusLabelBorderSides.Top) == ToolStripStatusLabelBorderSides.Top; this.bottomCheckBox.Checked = (sides & ToolStripStatusLabelBorderSides.Bottom) == ToolStripStatusLabelBorderSides.Bottom; this.leftCheckBox.Checked = (sides & ToolStripStatusLabelBorderSides.Left) == ToolStripStatusLabelBorderSides.Left; this.rightCheckBox.Checked = (sides & ToolStripStatusLabelBorderSides.Right) == ToolStripStatusLabelBorderSides.Right; } }
/// <summary> /// Generates an object from its XML representation. /// </summary> /// <param name="reader">The <see cref="T:System.Xml.XmlReader"/> stream from which the object is deserialized. </param> public void ReadXml(XmlReader reader) { var doc = new XmlDocument(); doc.Load(reader); if (doc.GetElementsByTagName("BorderLineStyle").Count > 0) { BorderLineStyle = (DashStyle)Enum.Parse(typeof(DashStyle), doc.GetElementsByTagName("BorderLineStyle")[0].InnerText); } if (doc.GetElementsByTagName("BorderVisibility").Count > 0) { BorderVisibility = (ToolStripStatusLabelBorderSides) Enum.Parse(typeof(ToolStripStatusLabelBorderSides), doc.GetElementsByTagName("BorderVisibility")[0].InnerText); } if (doc.GetElementsByTagName("CornerShape").Count > 0) { string xml = "<CornerShape>" + doc.GetElementsByTagName("CornerShape")[0].InnerXml + "</CornerShape>"; CornerShape.ReadXml(new XmlTextReader(xml, XmlNodeType.Document, null)); } }
public ToolStripStatusLabelBorder(string name, ToolStripStatusLabelBorderSides border) : this() { Name = name; BorderSides = border; }
static public ToolStripStatusLabel StatusLabelBorder(string name, string text, ToolStripStatusLabelBorderSides sides) { ToolStripStatusLabel ctl = new ToolStripStatusLabel(); ctl.Name = name; ctl.Text = text; ctl.BorderSides = sides; return(ctl); }
internal static void DrawBorder(Graphics g, RectangleF rect, CornerShape bShape, ToolStripStatusLabelBorderSides bVisibility, DashStyle bLineStyle, int cornerRadius, Color borderColor, Brush borderBrush, Region excRegion) { if (bVisibility == ToolStripStatusLabelBorderSides.None) { return; } if (excRegion != null) { g.ExcludeClip(excRegion); } var pen = borderBrush != null ? new Pen(borderBrush, 1f) : new Pen(borderColor, 1f); var smoothingMode = g.SmoothingMode; pen.DashStyle = bLineStyle; var num = 2 * cornerRadius; if (bVisibility == ToolStripStatusLabelBorderSides.All) { var path = GetDrawingPath(rect, bShape, cornerRadius); g.DrawPath(pen, path); path.Dispose(); g.SmoothingMode = smoothingMode; pen.Dispose(); return; } if ((bVisibility & ToolStripStatusLabelBorderSides.Left) > ToolStripStatusLabelBorderSides.None) { g.DrawLine(pen, rect.X, rect.Y + cornerRadius, rect.X, (rect.Y + rect.Height) - cornerRadius); } if ((bVisibility & ToolStripStatusLabelBorderSides.Top) > ToolStripStatusLabelBorderSides.None) { g.DrawLine(pen, rect.X + cornerRadius, rect.Y, (rect.X + rect.Width) - cornerRadius, rect.Y); } if ((bVisibility & ToolStripStatusLabelBorderSides.Right) > ToolStripStatusLabelBorderSides.None) { g.DrawLine(pen, rect.X + rect.Width, rect.Y + cornerRadius, rect.X + rect.Width, (rect.Y + rect.Height) - cornerRadius); } if ((bVisibility & ToolStripStatusLabelBorderSides.Bottom) > ToolStripStatusLabelBorderSides.None) { g.DrawLine(pen, rect.X + cornerRadius, rect.Y + rect.Height, (rect.X + rect.Width) - cornerRadius, rect.Y + rect.Height); } if (((bVisibility & ToolStripStatusLabelBorderSides.Left) > ToolStripStatusLabelBorderSides.None) || ((bVisibility & ToolStripStatusLabelBorderSides.Top) > ToolStripStatusLabelBorderSides.None)) { switch (bShape.TopLeft) { case CornerType.Sliced: g.DrawLine(pen, rect.X, rect.Y + cornerRadius, rect.X + cornerRadius, rect.Y); break; case CornerType.Square: if (((bVisibility & ToolStripStatusLabelBorderSides.Left) <= ToolStripStatusLabelBorderSides.None) || ((bVisibility & ToolStripStatusLabelBorderSides.Top) > ToolStripStatusLabelBorderSides.None)) { if (((bVisibility & ToolStripStatusLabelBorderSides.Left) <= ToolStripStatusLabelBorderSides.None) && ((bVisibility & ToolStripStatusLabelBorderSides.Top) > ToolStripStatusLabelBorderSides.None)) { g.DrawLine(pen, rect.X, rect.Y, rect.X + cornerRadius, rect.Y); } else { g.DrawLine(pen, rect.X, rect.Y + cornerRadius, rect.X, rect.Y); g.DrawLine(pen, rect.X, rect.Y, rect.X + cornerRadius, rect.Y); } } else { g.DrawLine(pen, rect.X, rect.Y + cornerRadius, rect.X, rect.Y); } break; } if (((bVisibility & ToolStripStatusLabelBorderSides.Top) > ToolStripStatusLabelBorderSides.None) || ((bVisibility & ToolStripStatusLabelBorderSides.Right) > ToolStripStatusLabelBorderSides.None)) { switch (bShape.TopRight) { case CornerType.Sliced: g.DrawLine(pen, (rect.X + rect.Width) - cornerRadius, rect.Y, rect.X + rect.Width, rect.Y + cornerRadius); break; case CornerType.Square: if (((bVisibility & ToolStripStatusLabelBorderSides.Right) > ToolStripStatusLabelBorderSides.None) || ((bVisibility & ToolStripStatusLabelBorderSides.Top) <= ToolStripStatusLabelBorderSides.None)) { if (((bVisibility & ToolStripStatusLabelBorderSides.Right) > ToolStripStatusLabelBorderSides.None) && ((bVisibility & ToolStripStatusLabelBorderSides.Top) <= ToolStripStatusLabelBorderSides.None)) { g.DrawLine(pen, rect.X + rect.Width, rect.Y, rect.X + rect.Width, rect.Y + cornerRadius); } else { g.DrawLine(pen, (rect.X + rect.Width) - cornerRadius, rect.Y, rect.X + rect.Width, rect.Y); g.DrawLine(pen, rect.X + rect.Width, rect.Y, rect.X + rect.Width, rect.Y + cornerRadius); } } else { g.DrawLine(pen, (rect.X + rect.Width) - cornerRadius, rect.Y, rect.X + rect.Width, rect.Y); } break; } if (((bVisibility & ToolStripStatusLabelBorderSides.Right) > ToolStripStatusLabelBorderSides.None) || ((bVisibility & ToolStripStatusLabelBorderSides.Bottom) > ToolStripStatusLabelBorderSides.None)) { switch (bShape.BottomRight) { case CornerType.Sliced: g.DrawLine(pen, rect.X + rect.Width, (rect.Y + rect.Height) - cornerRadius, (rect.X + rect.Width) - cornerRadius, rect.Y + rect.Height); break; case CornerType.Square: if (((bVisibility & ToolStripStatusLabelBorderSides.Right) <= ToolStripStatusLabelBorderSides.None) || ((bVisibility & ToolStripStatusLabelBorderSides.Bottom) > ToolStripStatusLabelBorderSides.None)) { if (((bVisibility & ToolStripStatusLabelBorderSides.Right) <= ToolStripStatusLabelBorderSides.None) && ((bVisibility & ToolStripStatusLabelBorderSides.Bottom) > ToolStripStatusLabelBorderSides.None)) { g.DrawLine(pen, (rect.X + rect.Width), (rect.Y + rect.Height), (rect.X + rect.Width) - cornerRadius, (rect.Y + rect.Height)); } else { g.DrawLine(pen, (rect.X + rect.Width), ((rect.Y + rect.Height) - cornerRadius), rect.X + rect.Width, (rect.Y + rect.Height)); g.DrawLine(pen, (rect.X + rect.Width), (rect.Y + rect.Height), (rect.X + rect.Width) - cornerRadius, (rect.Y + rect.Height)); } } else { g.DrawLine(pen, rect.X + rect.Width, (rect.Y + rect.Height) - cornerRadius, rect.X + rect.Width, rect.Y + rect.Height); } break; } if (((bVisibility & ToolStripStatusLabelBorderSides.Bottom) > ToolStripStatusLabelBorderSides.None) || ((bVisibility & ToolStripStatusLabelBorderSides.Left) > ToolStripStatusLabelBorderSides.None)) { switch (bShape.BottomLeft) { case CornerType.Sliced: g.DrawLine(pen, rect.X + cornerRadius, rect.Y + rect.Height, rect.X, (rect.Y + rect.Height) - cornerRadius); g.SmoothingMode = smoothingMode; pen.Dispose(); return; case CornerType.Square: if (((bVisibility & ToolStripStatusLabelBorderSides.Left) > ToolStripStatusLabelBorderSides.None) || ((bVisibility & ToolStripStatusLabelBorderSides.Bottom) <= ToolStripStatusLabelBorderSides.None)) { if (((bVisibility & ToolStripStatusLabelBorderSides.Left) > ToolStripStatusLabelBorderSides.None) && ((bVisibility & ToolStripStatusLabelBorderSides.Bottom) <= ToolStripStatusLabelBorderSides.None)) { g.DrawLine(pen, rect.X, rect.Y + rect.Height, rect.X, (rect.Y + rect.Height) - cornerRadius); } else { g.DrawLine(pen, rect.X + cornerRadius, rect.Y + rect.Height, rect.X, rect.Y + rect.Height); g.DrawLine(pen, rect.X, rect.Y + rect.Height, rect.X, (rect.Y + rect.Height) - cornerRadius); } } else { g.DrawLine(pen, rect.X + cornerRadius, rect.Y + rect.Height, rect.X, rect.Y + rect.Height); } g.SmoothingMode = smoothingMode; pen.Dispose(); return; } g.DrawArc(pen, rect.X, (rect.Y + rect.Height) - num, num, num, 90f, 90f); } g.DrawArc(pen, (rect.X + rect.Width) - num, (rect.Y + rect.Height) - num, num, num, 0f, 90f); } g.DrawArc(pen, (rect.X + rect.Width) - num, rect.Y, num, num, 270f, 90f); } g.DrawArc(pen, rect.X, rect.Y, num, num, 180f, 90f); } }
internal void Assign(BorderAppearance borderAppearance) { CornerShape.Assign((CornerShape)borderAppearance.cornerShape.Clone()); BorderLineStyle = borderAppearance.borderLineStyle; BorderVisibility = borderAppearance.borderVisibility; }
/// <summary> /// Resets current object to default values. /// </summary> public virtual void Reset() { cornerShape = new CornerShape(); borderLineStyle = DashStyle.Solid; borderVisibility = ToolStripStatusLabelBorderSides.All; }
internal static void DrawBorder(Graphics g, RectangleF rect, CornerShape bShape, ToolStripStatusLabelBorderSides bVisibility, DashStyle bLineStyle, int cornerRadius, Brush borderBrush, Region excRegion) { DrawBorder(g, rect, bShape, bVisibility, bLineStyle, cornerRadius, Color.Empty, borderBrush, excRegion); }
/// <summary> /// Resets value of <see cref="BorderVisibility" /> to default value. /// </summary> protected void ResetBorderVisibility() { borderVisibility = ToolStripStatusLabelBorderSides.All; }
internal static void DrawBorder(Graphics g, RectangleF rect, CornerShape bShape, ToolStripStatusLabelBorderSides bVisibility, DashStyle bLineStyle, int cornerRadius, Color borderColor, Brush borderBrush, Region excRegion) { if (bVisibility == ToolStripStatusLabelBorderSides.None) { return; } if (excRegion != null) { g.ExcludeClip(excRegion); } var pen = borderBrush != null ? new Pen(borderBrush, 1f) : new Pen(borderColor, 1f); var smoothingMode = g.SmoothingMode; pen.DashStyle = bLineStyle; var num = 2*cornerRadius; if (bVisibility == ToolStripStatusLabelBorderSides.All) { var path = GetDrawingPath(rect, bShape, cornerRadius); g.DrawPath(pen, path); path.Dispose(); g.SmoothingMode = smoothingMode; pen.Dispose(); return; } if ((bVisibility & ToolStripStatusLabelBorderSides.Left) > ToolStripStatusLabelBorderSides.None) { g.DrawLine(pen, rect.X, rect.Y + cornerRadius, rect.X, (rect.Y + rect.Height) - cornerRadius); } if ((bVisibility & ToolStripStatusLabelBorderSides.Top) > ToolStripStatusLabelBorderSides.None) { g.DrawLine(pen, rect.X + cornerRadius, rect.Y, (rect.X + rect.Width) - cornerRadius, rect.Y); } if ((bVisibility & ToolStripStatusLabelBorderSides.Right) > ToolStripStatusLabelBorderSides.None) { g.DrawLine(pen, rect.X + rect.Width, rect.Y + cornerRadius, rect.X + rect.Width, (rect.Y + rect.Height) - cornerRadius); } if ((bVisibility & ToolStripStatusLabelBorderSides.Bottom) > ToolStripStatusLabelBorderSides.None) { g.DrawLine(pen, rect.X + cornerRadius, rect.Y + rect.Height, (rect.X + rect.Width) - cornerRadius, rect.Y + rect.Height); } if (((bVisibility & ToolStripStatusLabelBorderSides.Left) > ToolStripStatusLabelBorderSides.None) || ((bVisibility & ToolStripStatusLabelBorderSides.Top) > ToolStripStatusLabelBorderSides.None)) { switch (bShape.TopLeft) { case CornerType.Sliced: g.DrawLine(pen, rect.X, rect.Y + cornerRadius, rect.X + cornerRadius, rect.Y); break; case CornerType.Square: if (((bVisibility & ToolStripStatusLabelBorderSides.Left) <= ToolStripStatusLabelBorderSides.None) || ((bVisibility & ToolStripStatusLabelBorderSides.Top) > ToolStripStatusLabelBorderSides.None)) { if (((bVisibility & ToolStripStatusLabelBorderSides.Left) <= ToolStripStatusLabelBorderSides.None) && ((bVisibility & ToolStripStatusLabelBorderSides.Top) > ToolStripStatusLabelBorderSides.None)) { g.DrawLine(pen, rect.X, rect.Y, rect.X + cornerRadius, rect.Y); } else { g.DrawLine(pen, rect.X, rect.Y + cornerRadius, rect.X, rect.Y); g.DrawLine(pen, rect.X, rect.Y, rect.X + cornerRadius, rect.Y); } } else { g.DrawLine(pen, rect.X, rect.Y + cornerRadius, rect.X, rect.Y); } break; } if (((bVisibility & ToolStripStatusLabelBorderSides.Top) > ToolStripStatusLabelBorderSides.None) || ((bVisibility & ToolStripStatusLabelBorderSides.Right) > ToolStripStatusLabelBorderSides.None)) { switch (bShape.TopRight) { case CornerType.Sliced: g.DrawLine(pen, (rect.X + rect.Width) - cornerRadius, rect.Y, rect.X + rect.Width, rect.Y + cornerRadius); break; case CornerType.Square: if (((bVisibility & ToolStripStatusLabelBorderSides.Right) > ToolStripStatusLabelBorderSides.None) || ((bVisibility & ToolStripStatusLabelBorderSides.Top) <= ToolStripStatusLabelBorderSides.None)) { if (((bVisibility & ToolStripStatusLabelBorderSides.Right) > ToolStripStatusLabelBorderSides.None) && ((bVisibility & ToolStripStatusLabelBorderSides.Top) <= ToolStripStatusLabelBorderSides.None)) { g.DrawLine(pen, rect.X + rect.Width, rect.Y, rect.X + rect.Width, rect.Y + cornerRadius); } else { g.DrawLine(pen, (rect.X + rect.Width) - cornerRadius, rect.Y, rect.X + rect.Width, rect.Y); g.DrawLine(pen, rect.X + rect.Width, rect.Y, rect.X + rect.Width, rect.Y + cornerRadius); } } else { g.DrawLine(pen, (rect.X + rect.Width) - cornerRadius, rect.Y, rect.X + rect.Width, rect.Y); } break; } if (((bVisibility & ToolStripStatusLabelBorderSides.Right) > ToolStripStatusLabelBorderSides.None) || ((bVisibility & ToolStripStatusLabelBorderSides.Bottom) > ToolStripStatusLabelBorderSides.None)) { switch (bShape.BottomRight) { case CornerType.Sliced: g.DrawLine(pen, rect.X + rect.Width, (rect.Y + rect.Height) - cornerRadius, (rect.X + rect.Width) - cornerRadius, rect.Y + rect.Height); break; case CornerType.Square: if (((bVisibility & ToolStripStatusLabelBorderSides.Right) <= ToolStripStatusLabelBorderSides.None) || ((bVisibility & ToolStripStatusLabelBorderSides.Bottom) > ToolStripStatusLabelBorderSides.None)) { if (((bVisibility & ToolStripStatusLabelBorderSides.Right) <= ToolStripStatusLabelBorderSides.None) && ((bVisibility & ToolStripStatusLabelBorderSides.Bottom) > ToolStripStatusLabelBorderSides.None)) { g.DrawLine(pen, (rect.X + rect.Width), (rect.Y + rect.Height), (rect.X + rect.Width) - cornerRadius, (rect.Y + rect.Height)); } else { g.DrawLine(pen, (rect.X + rect.Width), ((rect.Y + rect.Height) - cornerRadius), rect.X + rect.Width, (rect.Y + rect.Height)); g.DrawLine(pen, (rect.X + rect.Width), (rect.Y + rect.Height), (rect.X + rect.Width) - cornerRadius, (rect.Y + rect.Height)); } } else { g.DrawLine(pen, rect.X + rect.Width, (rect.Y + rect.Height) - cornerRadius, rect.X + rect.Width, rect.Y + rect.Height); } break; } if (((bVisibility & ToolStripStatusLabelBorderSides.Bottom) > ToolStripStatusLabelBorderSides.None) || ((bVisibility & ToolStripStatusLabelBorderSides.Left) > ToolStripStatusLabelBorderSides.None)) { switch (bShape.BottomLeft) { case CornerType.Sliced: g.DrawLine(pen, rect.X + cornerRadius, rect.Y + rect.Height, rect.X, (rect.Y + rect.Height) - cornerRadius); g.SmoothingMode = smoothingMode; pen.Dispose(); return; case CornerType.Square: if (((bVisibility & ToolStripStatusLabelBorderSides.Left) > ToolStripStatusLabelBorderSides.None) || ((bVisibility & ToolStripStatusLabelBorderSides.Bottom) <= ToolStripStatusLabelBorderSides.None)) { if (((bVisibility & ToolStripStatusLabelBorderSides.Left) > ToolStripStatusLabelBorderSides.None) && ((bVisibility & ToolStripStatusLabelBorderSides.Bottom) <= ToolStripStatusLabelBorderSides.None)) { g.DrawLine(pen, rect.X, rect.Y + rect.Height, rect.X, (rect.Y + rect.Height) - cornerRadius); } else { g.DrawLine(pen, rect.X + cornerRadius, rect.Y + rect.Height, rect.X, rect.Y + rect.Height); g.DrawLine(pen, rect.X, rect.Y + rect.Height, rect.X, (rect.Y + rect.Height) - cornerRadius); } } else { g.DrawLine(pen, rect.X + cornerRadius, rect.Y + rect.Height, rect.X, rect.Y + rect.Height); } g.SmoothingMode = smoothingMode; pen.Dispose(); return; } g.DrawArc(pen, rect.X, (rect.Y + rect.Height) - num, num, num, 90f, 90f); } g.DrawArc(pen, (rect.X + rect.Width) - num, (rect.Y + rect.Height) - num, num, num, 0f, 90f); } g.DrawArc(pen, (rect.X + rect.Width) - num, rect.Y, num, num, 270f, 90f); } g.DrawArc(pen, rect.X, rect.Y, num, num, 180f, 90f); } }
static public ToolStripStatusLabel StatusLabelBorder(string text, ToolStripStatusLabelBorderSides sides) { return(StatusLabelBorder(String.Empty, text, sides)); }
/// <summary> /// 获取边框是否设置 /// </summary> /// <param name="sides">所有边框</param> /// <param name="side">当前边框</param> /// <returns>是否有当前边框</returns> public static bool GetValue(this ToolStripStatusLabelBorderSides sides, ToolStripStatusLabelBorderSides side) { return((sides & side) == side); }
/// <summary> /// Resets value of <see cref="BorderVisibility"/> to default value. /// </summary> protected void ResetBorderVisibility() { borderVisibility = ToolStripStatusLabelBorderSides.All; }