duminică, 12 septembrie 2010
joi, 9 septembrie 2010
Improve appearance/behavior of Properties for a Custom Control at design time using attributes
Improve appearance/behavior of Properties for a Custom Control at design time using attributes
- Description
- Category
- set the cathegory under which the property appears
- DefaultValue
- AmbientValue (true|false)
- indicates that the value for a property is derived from parent control
- Browsable (true|false)
- if false, the property should not be shown in the Properties window
- DesignOnly (true|false)
- if true, the property is only available at design time
- ImmutableObject
- Shows if subproperties of this object are displayed as read-only (e.g.: Point with X,Y properties)
- Localizable
- Shows if the design time va;lue for thios property is stored in a resource file instead of in the generated code
- MergableProperty
- Configures how the properties window behaves when more than one instance of this control is selected at once
- NotifyParentProperty (true|false)
- Notify the parent property about changes of property(for example Size property should be inform when Height or Width has been changed)
- ParenthesisPropertyName
- name of the property is displayed in parenthesis
- ReadOnly
- RefreshProperty
- you could specify if the rest of property should be updated when this property is changed
- Attributes to be applied at the class level
- DefaultEvent
- When the control is double-clicked in designed an event is automatically added to the code
- DefaultyProperty
- Default property highlighted in Properties win
References:
Matthew MacDonald, User Interfaces in C#—Windows Forms and Custom Controls, Chapter 8: Design-Time Support for Custom
Controls
joi, 2 septembrie 2010
How to change the Shape of your appli...
How to change the Shape of your application?
- Create a Form
- Add namespace System.Drawing.Drawing2D
- Assign a new shape to its Region Property
You can do this on Load event:
private void Form1_Load(object sender, EventArgs e)
{
GraphicsPath _graphicsPath = new GraphicsPath();
_graphicsPath.AddArc(0, 0, Width, Height, 20, -270);
Region = new Region(_graphicsPath);
}
This is the result:
Abonați-vă la:
Postări (Atom)