Custom Controls: Property shadowing, etc.

Source: Internet
Author: User
attribute hiding can be divided into three kinds of situations:

1. Some properties that are added by the designer, such as locked, must be custom designed to filter out

2. Use override to set its visibility to false for properties that can be overridden

3. With new, set its visibility to false for properties that cannot be overridden

4. Alternatively, you can define the Hashtable variable to hide the attribute and use the custom function to handle the

Related information

1 C # Custom controls from getting started to mastering

2) custom Control

Related information

1 C # Custom controls:

2) Graphic version: Http:// April 24, 2011 1. Adding controls to panels

Take Designerhosting (JXF) as an example:

1 Add Project in solution ' Shell, such as button

2 Add user control to project, type the name

3 After designing the button, add it to the panel.

4 Add a reference to the button inside the Toolbox

5) ToolboxXmlManager.cs Add the appropriate code to join the panel

Private type[]imagetooltypes = new type[]{

typeof (Gauge.mygauge),

typeof (Label.mylabel),

typeof (BUTTON.MYBTN),//The statement adds the Mybtn button among the buttons


6 Add a button reference in the shell

Taking Smartcontrol as an example

1) Add UserControl in Viguagelibrary

2 because to inherit commonlibrary inside the Iguagecontrol, so to add the appropriate reference in this project

3 in Videsigner ToolboxXmlManager.cs Modify the code to add the control to the panel April 25, 2011 1. Hide of Locked property

The Locked property is a property that is brought by the designer to add references in project to remove

The following code can be implemented

#region Remove locked attributes from the designer

public class CustomDigitalDesigner:System.Windows.Forms.Design.ControlDesigner


Protectedoverride voidpostfilterproperties (System.Collections.IDictionaryproperties)


Properties. Remove ("Locked");

Base. PostFilterProperties (properties);



[Designer (typeof (Customdigitaldesigner))]

#endregion April 27, 2011

The next task:

1. Add all Windows form\groupbox Label

2. Add dx.10.2:data\gaugecontrol\ Circularfull-circularhalf-circularquarter-circularthreefourth-linearhorizontal-linearvertical-circularwide

3. Change the control's icon


Remember to add the associated reference using System.Drawing

Note that some properties of icon icons to be modified, the following figure, the properties of the Circle box will be modified to embeded resource.
April 28, 2011

Key words:

Ø Custom Controls Add events

1. Add Events for custom controls

To add a centralized method of events to a custom control


2. The evaluation was written in detail


And the solution in the forum is different:


Most of the solution is to use the custom space in the form of the project creation, and our requirement is to use it on the panel of the result of our program running. April 29, 2011

Some controls that need to be added in the control library

Button, CheckBox, RadioButton, TextBox, CheckedListBox, HScrollBar, Label, Volt meter (Volt), thermometer (temperature)

Dial Element Analysis:



There are currently 24 controls

1 The control's Text property cannot be hidden

2 How the dial shows Float√ has been resolved May 4, 2011

Ø How to implement control transparency

This is not the same as the online description. In general, when you design form, you can directly know the cascade relationship between controls, you can set such as Parent property. The requirement of the project is to do a batch of controls, and the application of the control does not know where. Some things just can't be set.

Reference page: May 5, 2011

Ø Delegate Assignment

Necessary operations for communication between threads

Ø adding events for controls



There is also an important question: how to adjust the control's upper and lower layer relationships by the control hierarchy problem.

Keywords: control stacking order

Reference Document:

Http:// E6.pdf May 12, 2011

Serial Port Programming:

1 C # serial operation:

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: 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.