Hi,
I'm trying to limit the size of image inside a RadButtonElement, but after build it returns to original image file size.
I set the Image size in RadButtonElement (in RadRibbonBar) by using the ImagePrimitive properties:
- Click on the smart tag of your RadButton and choose "Edit UI elements"
- In the Control element structure navigate to ImagePrimitive.
- Change MinSize and MaxSize's Height and Width properties to 48 (image size is 225x225 in PNG file type)
- Change ImageLayout to Strech
Theme is "Fluent".
Here is what is generated in the designer file:
this
.radButtonElementExecute.AutoSize =
false
;
this
.radButtonElementExecute.AutoSizeMode = Telerik.WinControls.RadAutoSizeMode.Auto;
this
.radButtonElementExecute.AutoToolTip =
true
;
this
.radButtonElementExecute.BackColor = System.Drawing.Color.FromArgb(((
int
)(((
byte
)(229)))), ((
int
)(((
byte
)(239)))), ((
int
)(((
byte
)(255)))));
this
.radButtonElementExecute.Bounds =
new
System.Drawing.Rectangle(0, 0, 57, 69);
this
.radButtonElementExecute.DefaultSize =
new
System.Drawing.Size(0, 0);
this
.radButtonElementExecute.Font =
new
System.Drawing.Font(
"Segoe UI"
, 8.25F);
this
.radButtonElementExecute.ForeColor = System.Drawing.Color.FromArgb(((
int
)(((
byte
)(21)))), ((
int
)(((
byte
)(66)))), ((
int
)(((
byte
)(139)))));
this
.radButtonElementExecute.Image = ((System.Drawing.Image)(resources.GetObject(
"radButtonElementExecute.Image"
)));
this
.radButtonElementExecute.ImageAlignment = System.Drawing.ContentAlignment.TopCenter;
this
.radButtonElementExecute.ImageIndex = -1;
this
.radButtonElementExecute.MaxSize =
new
System.Drawing.Size(57, 69);
this
.radButtonElementExecute.MinSize =
new
System.Drawing.Size(0, 0);
this
.radButtonElementExecute.Name =
"radButtonElementExecute"
;
this
.radButtonElementExecute.StretchHorizontally =
false
;
this
.radButtonElementExecute.StretchVertically =
false
;
this
.radButtonElementExecute.Text =
"Execute"
;
this
.radButtonElementExecute.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter;
this
.radButtonElementExecute.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;
this
.radButtonElementExecute.TextOrientation = System.Windows.Forms.Orientation.Horizontal;
this
.radButtonElementExecute.ToolTipText =
"Execute"
;
this
.radButtonElementExecute.Click +=
new
System.EventHandler(
this
.radButtonRunExecution_Click);
((Telerik.WinControls.Primitives.ImagePrimitive)(
this
.radButtonElementExecute.GetChildAt(1).GetChildAt(0))).ImageLayout = System.Windows.Forms.ImageLayout.Stretch;
((Telerik.WinControls.Primitives.ImagePrimitive)(
this
.radButtonElementExecute.GetChildAt(1).GetChildAt(0))).AutoSize =
false
;
((Telerik.WinControls.Primitives.ImagePrimitive)(
this
.radButtonElementExecute.GetChildAt(1).GetChildAt(0))).MinSize =
new
System.Drawing.Size(48, 48);
((Telerik.WinControls.Primitives.ImagePrimitive)(
this
.radButtonElementExecute.GetChildAt(1).GetChildAt(0))).MaxSize =
new
System.Drawing.Size(48, 48);
thanks