dbicButton Send comments on this topic.
Developing with dbicButton - Using Transparency and Irregular Shaped Masks

Glossary Item Box

The dbicButton control provides advanced properties and behavior to allow the developer to implement transparency. This technique provides the developer with the ability to make the button control appear as if it were embedded in the form. In addition to the transparency support, the dbicButton control provides properties to display different images based on the state of the control (Picture, PictureOver, and PictureDown), allowing the developer to implement custom presentations of the button, also referred to as “skinning” or “theming” of objects in a GUI. 

 

To implement transparency on a dbicButton control:

 

  1. Assign an image to the picture property of the dbicButton control.
  2. Set the MaskColor of the dbicButton control to the color in the bitmap to appear transparent.
  3. Set the BackColor property of the dbicButton control to Transparent
  4. Set the Border properties (BorderType, BorderOver, BorderDown) of the control to none.

 

To implement images that do not conform to the rectangular shape of the control or images that have masking within the border of the picture being rendered the ActiveOnMask property must be set to false.  This tells the control not to respond to events on the parts of the image painted with the MaskColor value.

 

  1. Set the ActiveOnMask Property of the control to false.

 

NOTE: By default the control responds to events based on its entire (masked and non-masked area).  This behavior can be overridden by setting the ActiveOnMask property to false.  The ActiveOnMask property determines if the control responses to events such as Click, MouseOver, etc. on masked areas of the control.  This is required when using irregular shaped images in the control. 

 

NOTE: The default masking behavior of the mask color is provided by the Picture in the Picture property of the control.  This behavior can be modified by applying a picture to the PictureMask property. The picture in the PictureMask property provides the map by which the control responds to events. In the situation where the developer wants to display one image but have only certain parts of that image respond to events, the custom behavior can be described in the PictureMask property.

 

NOTE: The masking behavior applies to all the picture properties in the control; Picture, PictureOver, and PictureDown.

 

NOTE: The properties of the control can be set in design-time using the property inspector or at runtime in code.

 

Example:

VB.NET

Me.dbicButton1.Picture = <path to picture file or resource property>

Me.dbicButton1.BorderType = Dbi.enumBorderType.None

Me.dbicButton1.BorderOver = Dbi.enumBorderType.None

Me.dbicButton1.BorderDown = Dbi.enumBorderType.None

Me.dbicButton1.BackColor = Color.Transparent

Me.dbicButton1.MaskColor = <color to mask in the image in the button>

Me.dbicButton1.ActiveOnMask = False

<Optional>

Me.dbicButton1.PictureOver = <path to picture file or resource property>

Me.dbicButton1.PictureDown = <path to picture file or resource property>

Me.dbicButton1.PictureMask = <path to picture file or resource property>

 

 

C#

this.dbicButton1.Picture = <path to picture file or resource property>

this.dbicButton1.BorderType = Dbi.enumBorderType.None

this.dbicButton1.BorderOver = Dbi.enumBorderType.None

this.dbicButton1.BorderDown = Dbi.enumBorderType.None

this.dbicButton1.BackColor = Color.Transparent

this.dbicButton1.MaskColor = <color to mask in the image in the button>

this.dbicButton1.ActiveOnMask = False

<Optional>

this.dbicButton1.PictureOver = <path to picture file or resource property>

this.dbicButton1.PictureDown = <path to picture file or resource property>

this.dbicButton1.PictureMask = <path to picture file or resource property>