Microsoft Communities

Welcome to WindowsClient.net | Sign in | Join


Using the RegionMaster Controls

by Mike harsh

The RegionMaster Controls are a set of UI components which make is easy to create great looking applications. They have strong designer support and the source code illustrates the power and flexibility of the Windows Forms designer architecture. If your project could use a little flash, these controls are just what you need. The image below shows an app that uses the RegionMaster controls and the Opacity property of Form.

This article provides a walk through of the properties and designer support of the CurvedPanel, BounceButton, and SolidClock controls. It will also cover using the RegionBuilder component to change the shape of a Form.

Table of Contents
CurvedPanel
CurvedPanel Designer Support
BounceButton
SolidClock
SolidClock Designer Support
RegionBuilder

CurvedPanel

The CurvedPanel control is a container for other controls. The surface area of the CurvedPanel can be set to shapes which can be filled, outlined, rotated and used as the shape of a Form. The target area of the curved panel is the area which can be filled, rotated, outlined, etc.

Properties

AddToFormRegionbool – This property is used by the RegionBuilder component to determine if the shape of this CurvedPanel is added to the shape of the Form. See the RegionBuilder section of this document for more details.

AntiAliasbool – Setting this property to true enables ant aliasing on the line drawn around the target area of the CurvedPanel.

BottomMargin, LeftMargin, RightMargin, TopMarginint – These properties controls the amount of padding between the edge of the CurvedPanel and the target area.

DrawBorderbool – Setting this property to true draws a line around the target area of the CurvedPanel. The width of the line drawn is controlled by the LineThickness property.

LineThickness - bool – This property controls the width of the line drawn around the CurvedPanel’s target area.

FillColorColor – This is the color used to fill the target area of the CurvedPanel.

FillImageImage – This is the image used to fill the target area of the CurvedPanel. The FillImage property takes precedence over the FillColor property.

FillTransparencydouble – Controls how transparent the target area of the CurvedPanel is. Setting this to 0 lets all of the CurvedPanel’s BackgroundColor or BackgroundImage show through. Setting this to 1.0 makes the target area opaque.

FormBehaviorFormBehaviors – This property controls the behavior of the CurvedPanel when a user clicks and / or drags it. The following values of the FormBehaviors enum are supported:

  • None – This value has no affect on the CurvedPanel’s behavior.
  • Close – Clicking the CurvedPanel will close the Form.
  • Drag – Clicking and dragging the CurvedPanel will move the Form.
  • Maximize – Clicking the CurvedPanel will maximize the Form.
  • Minimize – Clicking the CurvedPanel will minimize the Form.
  • ResizeLowerRight – Clicking and dragging the CurvedPanel will enlarge the Form to the right and bottom.

ShowFormBehaviorGlyphbool – Setting this to true will draw the appropriate FormBehavior glyph in the center of the CurvedPanel. Glyphs will be drawn for FormBehaviors.Close, FormBehaviors.Maximize and FormBehaviors.Minimize.

FormBehaviorGlyphSizeint – Controls the size of the glyph drawn if ShowFormBehavoirGlyph is true and the FormBehavior property is set to either FormBehaviors.Close, FormBehaviors.Maximize or FormBehaviors.Minimize.

RotationAnglefloat – This is the angle, in degrees, that the target area of the CurvedPanel is rotated.

LowerLeftCornerRadius, LowerRightCornerRadius, UpperLeftCornerRadius, UpperRightCornerRadiusint – This is the value in pixels of the radius of the corresponding corner of the CurvedPanel’s target area.

LowerLeftCornerType, LowerRightCornerType, UpperLeftCornerType, UpperRightCornerTypeCornerTypes – This is the types of corner used for the corresponding corner of the CurvedPanel’s target area. The values are either CornerTypes.Curve or CornerTypes.Line.

CurvedPanel Designer Support

In-situ Corner Radius Editing
In the designer, mouse over one of the corners and click and drag when the mouse cursor becomes a resize arrow.

CurvedPanel Verbs

The following designer verbs are available in the property grid for the CurvedPanel

Increase Margins – This verb adds one to each of the BottomMargin, LeftMargin, RightMargin, TopMargin properties.

Decrease Margins – This verb subtracts one from each of the BottomMargin, LeftMargin, RightMargin, TopMargin properties.

Reset Margins – This verb sets each of the BottomMargin, LeftMargin, RightMargin, TopMargin properties to 5.

Increase Line Thickness – This verb adds one to the LineThickness property.

Decrease Line Thickness – This verb removes one from the LineThickness property.

Reset Line Thickness – This verb sets the LineThickness property to the default value of one.

Reset Corners – This verb sets each corner’s radius to be 50 and each corner’s type to be CornerTypse.Curve.

Bounce Button

The BounceButton is a button control that can take an image and scales the image on a timer to give the appearance the button is bouncing when the mouse cursor is over it.

Properties

ImageImage – This is the image displayed on the button.

AutoSizeImagebool – Controls whether the image is automatically sized to fit the area of the control. The default is true.

BounceMaxSizefloat – This is the maximum and also the minimum size the image will be scaled to. The default is 1.3, which corresponds to a minimum scale of .7.

BounceRatefloat – This is the amount of scaling that is either added or subtracted per step when scaling. The default is .05.

EnableBouncebool – setting this to true enables the image to scale when the mouse is hovering over the button. The default is true.

SolidClock

The SolidClock is a clock control which displays time in the form of an outer arc and an inner pie. The SolidClock can display either the current minutes and seconds or hours and minutes.

Properties

AddToFormRegionbool – This property is used by the RegionBuilder component to determine if the shape of this CurvedPanel is added to the shape of the Form. See the RegionBuilder section of this document for more details.

AntiAliasbool – Setting this property to true enables ant aliasing on the line drawn around the target area of the CurvedPanel.

ClockIntervalClockInterval – This is the value to display on the clock. Values can be either ClockInterval.HoursAndMinutes or ClockInterval.MinutesAndSeconds. The default is ClockInterval. MinutesAndSeconds.

FillClockbool – Setting this to true fills the regions of the clock with the ForColor. If set to false, a single pixel outline in the ForeColor is drawn. The default is true.

IntraArcPaddingint – The amount of space, in pixels, between the outer arc and the inner pie. The default is 7 pixels.

OuterArcThicknessint – The thickness, in pixels, of the outer arc displayed by the clock. The default is 15 pixels.

SolidClock Designer Support

The SolidClock supports many designer verbs to make the editing experience easier.

SolidClock Verbs

The following designer verbs are available in the property grid for the SolidClock.

Increase Outer Ring Thickness – This verb adds one to the OuterRingThickness property.

Decrease Outer Ring Thickness Thickness – This verb removes one from the OuterRingThickness property.

Increase Intra Arc Padding Thickness – This verb adds one to the IntraArcPadding property.

Decrease Intra Arc Padding Thickness – This verb removes one from the IntraArcPadding property.

RegionBuilder Component

The RegionBuilder is a component which interacts with all controls that implement the IRegionControl interface. The RegionBuilder can modify the shape of it’s parent Form to be the union of all Controls on the Form which declare that they want to be part of the shape of the Form.

Properties

ParentFormForm – This is the Form the RegionBuilder will be modifying the shape of. In the property grid, double clicking the ParentForm property name will set the property to the first available Form.

MakeFormRegionbool – Setting this property will change the Form’s region at runtime to be the union of all controls on the ParentForm which implement IRegionControl and have their AddToFormRegion property set to true. This property has no affect at design time. The default for MakeFormRegion is false.



Page view counter