[Original] IssueVision learning notes (2) ----- add custom attributes and events to the control

Source: Internet
Author: User

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.")]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.