ОК. У меня есть круговая кнопка, которую я расширил в классе кнопок.См. Ниже:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
namespace CircleButton
{
public class CircleButton : Button
{
private Color _fillColor = Color.Red;
private Color _hoverColor = Color.Blue;
[Category("Custom")]
[Browsable(true)]
[Description("Sets the fill color of the round button")]
[Editor(typeof(System.Windows.Forms.Design.WindowsFormsComponentEditor), typeof(System.Drawing.Color))]
public Color FillColor
{
set
{
this._fillColor = value;
}
get
{
return this._fillColor;
}
}
[Category("Custom")]
[Browsable(true)]
[Description("Sets the Hover color of the round button")]
[Editor(typeof(System.Windows.Forms.Design.WindowsFormsComponentEditor), typeof(System.Drawing.Color))]
public Color HoverColor
{
set
{
this._hoverColor = value;
}
get
{
return this._hoverColor;
}
}
protected override void OnPaint(PaintEventArgs pevent)
{
GraphicsPath gp = new GraphicsPath();
gp.AddEllipse(0, 0, ClientSize.Width, ClientSize.Height);
this.Region = new System.Drawing.Region(gp);
base.OnPaint(pevent);
}
protected override void OnCreateControl()
{
this.FlatAppearance.MouseOverBackColor = this._hoverColor;
this.FlatAppearance.BorderSize = 0;
this.BackColor = this._fillColor;
this.FlatStyle = FlatStyle.Flat;
base.OnCreateControl();
}
}
В Visual Studio Designer все отлично работает, но когда я выбираю свойства FillColor и HoverColor во время разработки, цвета в элементе управления временем разработки не обновляются.
Сохранить впомните, что цвета действительно показывают соответствующие изменения во время выполнения.
Может быть, я пропускаю другую директиву или что-то?Я искал, но не смог найти ответ.Я потратил 2 дня на это.
Этот элемент управления будет передан другому разработчику и должен работать должным образом во время разработки.
Любая помощь будет наиболее ценной.