A suggestion for property cleanup
opened this issue · comments
For custom controls, replace hidden properties with a ControlDesigner. I have created an example for you, which can be readily used with the DarkRadioButton
control. This way anything in the "Property Region" that isn't custom can be removed.
using System.Collections;
using System.Collections.Generic;
using System.Windows.Forms.Design;
namespace DarkUI.Controls.Design
{
public class DarkUIRadioButtonDesigner : ControlDesigner
{
protected override void PreFilterProperties(IDictionary Properties)
{
List<string> PropList = new List<string>
{
"Appearance",
"AutoEllipsis",
"BackgroundImage",
"BackgroundImageLayout",
"FlatAppearance",
"FlatStyle",
"Image",
"ImageAlign",
"ImageIndex",
"ImageKey",
"ImageList",
"TextAlign",
"TextImageRelation",
"UseCompatibleTextRendering",
"UseVisualStyleBackColor"
};
if (Properties != null)
{
foreach (string Item in PropList)
{
Properties.Remove(Item);
}
}
base.PreFilterProperties(Properties);
}
}
}
Usage:
using DarkUI.Config;
using DarkUI.Controls.Designer;
using System;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
namespace DarkUI.Controls
{
[Designer(typeof(DarkUIRadioButtonDesigner))]
public class DarkRadioButton : RadioButton
{
}
Excuse my editing, I can't get the grip on .MD clearly. Thanks.