Let's take a look at the attribute window of a user control PaneCaption in IssueVision In the visualization designer.
Let's look at the attribute window when using StaffPane, another user control:
You will find that many attributes are added. These attributes are attributes that were originally inherited from the control, such as InactiveTextColor and InactiveTextColor. How are they implemented? Let's take a look at the user control code PaneCaption. cs.
Namespace IssueVision
{
// Custom control that draws the caption for each pane. Contains an active
// State and draws the caption different for each state. Caption is drawn
// With a gradient fill and antialias font.
Public class PaneCaption: UserControl
{
Private class Consts
{
......
We can see that it is composed of System. windows. forms. userControl is inherited. Figure 1 shows its default attributes. next we will proceed to PaneCaption. cs code to see how properties or events are displayed in the visualization designer.
[Defavaluvalueattribute (typeof (Color), "3, 55,145")]
[DescriptionAttribute ("Low color of the inactive gradient.")]
[CategoryAttribute ("Appearance")]
Public Color InactiveGradientLowColor
{
Get
{
Return m_colorInactiveLow;
}
Set
{
If (value = Color. Empty)
{
Value = Color. FromArgb (3, 55,145 );
}
M_colorInactiveLow = value;
CreateGradientBrushes (); // custom method for creating linear gradient brushes
Invalidate (); // Control. Invalidate method to Invalidate a specific area of the Control and send a draw message to the Control
}
}
[CategoryAttribute ("Appearance")]
[DescriptionAttribute ("High color of the inactive gradient.")]