ImageSettings in Windows Forms ButtonAdv(Classic)

26 Apr 20211 minute to read

ButtonAdv supports two types of images. They are,

  • BackgroundImage
  • Image

BackgroundImage

BackgroundImage is the image used as the Background for the control, which is set using the BackgroundImage property. This BackgroundImage can be laid in various manner with the BackgroundImageLayout property.

Windows Forms Tools Overview Image71

Image

Image that will be displayed on the control.

Overview_img73

The Images can be added to the ButtonAdv control in two ways. Either Image property can be used or the below properties.

Properties Description
ImageList Sets the image list used for this control.
ImageAlign Sets the alignment of the image inside the control. The options are,
TopLeft,
TopCenter,
TopRight
MiddleLeft,
MiddleCenter,
MiddleRight,
BottomLeft,
BottomCenter and
BottomRight.
ImageIndex Specifies the index for the image in the control.
Text Sets the text for the ButtonAdv.
TextAlign Sets the alignment of the text in the control. The options are,
TopLeft,
TopCenter,
TopRight
MiddleLeft,
MiddleCenter,
MiddleRight,
BottomLeft,
BottomCenter and
BottomRight.
TextImageRelation Sets the relative location of the image to the text. The options are,
Overlay,
ImageBeforeText,
TextBeforeImage,
ImageAboveText and
TextAboveImage.

Overview_img73

NOTE

The Image settings will be effective only when ButtonType is set to Normal.

this.btnAlignment.Image = ((System.Drawing.Bitmap)(resources.GetObject("btnAlignment.Image")));
this.btnAlignment.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnAlignment.ImageIndex = 3;
this.btnAlignment.ImageList = this.imageList1;
Me.btnAlignment.Image = CType((resources.GetObject("btnAlignment.Image")), System.Drawing.Bitmap) 
Me.btnAlignment.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft 
Me.btnAlignment.ImageIndex = 3 
Me.btnAlignment.ImageList = Me.imageList1

Overview_img75