/// <summary> /// Initializes the border pens and brushes. Should also be called when the parent background color changes. /// </summary> public void InitBorderPens() { this.borderFocusPen = new Pen(this.BorderColor, this.BorderSize); this.borderClearPen = new Pen(this.Parent != null ? this.Parent.BackColor : Color.Black, this.BorderSize); this.borderDragBrush = new SolidBrush(ColorsCommon.DarkerColor(this.borderColor, 0.2f)); }
/// <summary> /// Sets the new drape color, but first ensures it's different from the transparency key color value. /// </summary> /// <param name="color">The new color value for the drape.</param> private void SetDrapeColor(Color color) { this.BackColor = ColorsCommon.EnsureDifferentColor(color, this.TransparencyKey); // Ensure the color is different from the transparency color FocusControl.ForEach(this, (control) => { control.InitBorderPens(); }); // Reinitialize the border pens of each focus control this.Invalidate(true); // Force the redrawing of the drape }
/// <summary> /// Event: Menu -> Color -> Random Color /// Sets a random drape color. /// </summary> /// <param name="sender">The sender of the event.</param> /// <param name="e">Empty event data.</param> private void EventMenuColorRandomClick(object sender, EventArgs e) { this.SetDrapeColor(ColorsCommon.GetRandomColor()); }