BoldDesk®Customer service software offering ticketing, live chat, and omnichannel support, starting at $49/mo. for 10 agents. Try it for free.
Hello,
I have an SfButton with following options:
this.sfButton1.AccessibleName = "Button";
this.sfButton1.AutoSize = true;
this.sfButton1.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.sfButton1.Location = new System.Drawing.Point(164, 394);
this.sfButton1.Name = "sfButton1";
this.sfButton1.Padding = new System.Windows.Forms.Padding(7, 0, 7, 0);
this.sfButton1.Size = new System.Drawing.Size(260, 28);
this.sfButton1.Style.Image = global::NET.Properties.Resources.icon_logout_48;
this.sfButton1.TabIndex = 10;
this.sfButton1.Text = "sfButton1";
this.sfButton1.UseVisualStyleBackColor = true;
When I type a larger text to Intellisense Text property, the control resize itself to the new width -> thats ok:
After that when I type smaller text than the previous, the width of the button not changing:
I think the button width in this case wrong, it should be smaller.
Can you help me please how can I set button autosize that depends on the width of the image + text + padding + margin?
Thank you very much!
BR, SZL
Hi SZL,
Regards,
Bagavathi Perumal A
Hi,
Thank you, I think the Microsoft should fix this. :)
But for workaround I have an idea:
button1.AutoSize = false;
button1.Width = 5;
button1.Text = "";
button1.AutoSize = true;
button1.Text = "small text";
With this the above problem fixed.
Can you integrate a similar solution inside the SfButton code in the future or I should use this workaround everywhere?
Thank you!
BR, SZL
Hi SZL,
We cannot include this workaround in our control, please use this workaround in the application.
Regards,
Bagavathi Perumal A
Hi,
Ok, I created my custom control with this fix, it works well.
Thank you for help!
BR, SZL
Hi SZL,
Regards,
Gokul T