הערה
הגישה לדף זה מחייבת הרשאה. באפשרותך לנסות להיכנס או לשנות מדריכי כתובות.
הגישה לדף זה מחייבת הרשאה. באפשרותך לנסות לשנות מדריכי כתובות.
Question
Thursday, February 1, 2018 8:31 PM
This is what I am trying:
tStrip.ImageScalingSize = New System.Drawing.Size(tSize * 1.3, tSize * 1.3)
For Each obj As Object In tStrip.Items
If TypeOf obj Is ToolStripButton Then
obj.Size = New System.Drawing.Size(tSize, tSize)
ElseIf TypeOf obj Is ToolStripSplitButton Then
obj.Size = New System.Drawing.Size(tSize * obj.width / obj.height, tSize)
End If
Next
The size change for the ToolStripButtons are working just fine,
but the ToolStripSplitButton do not want to join in.
Suggestions?
Appleforce
All replies (5)
Friday, February 2, 2018 3:17 AM
Hi
Have you tried experimenting with ToolStrip.AutoSize = False and ToolStripSplitButton.AutoSize = False
Some combination would probably work.
Regards Les, Livingston, Scotland
Friday, February 2, 2018 6:20 AM
Hi appleforce,
If you change AutoSize
property of ToolStripButton to false
, you'll be able to change the width of button.
If you change AutoSize
property of ToolStrip to false
, you'll be able to change its height and the ToolStripButton will change its height automatically to fit into the tool strip.
If you want to increase not only size of the button, but also the size of the button image, you must either use the bigger image, or you can try to resize the original one. Then you must also change toolstrip's ImageScalingSize
property. Try to use the following code:
So you need to set ToolStripButton's AutoSize=false, ToolStripSplitButton's AutoSize=false.
Here is the same thread , you could refer to:
https://stackoverflow.com/questions/3432025/how-to-increase-the-size-of-the-buttons-on-a-tool-strip
Best Regards,
Cherry
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
Friday, February 2, 2018 8:04 AM
Thanks, but using the autosize property does not help.
And, as I mentioned, the resizing of the ToolStrip and the ToolStripButtons are working just fine, without touching the autosize property.
Appleforce
Friday, February 2, 2018 10:57 AM
Setting the AutoSize property to False and the Size property of the Buttons, even split buttons, seems to work for me.
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
ToolStripSplitButton1.AutoSize = False
ToolStripSplitButton1.Size = New Size(140, 80)
ToolStripSplitButton1.DropDownButtonWidth = 20
ToolStripButton1.AutoSize = False
ToolStripButton1.Size = New Size(140, 80)
End Sub
End Class
As you can see, the button on the left is a split button.
If you say it can`t be done then i`ll try it
Friday, February 2, 2018 12:09 PM
If you have an image you need to adjust those things.
Plus the order of the statements seems to affect the results.
Public Class Form2
Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load
ToolStrip1.AutoSize = True
ToolStrip1.ImageScalingSize = New Size(20, 20)
ToolStripSplitButton1.ImageScaling = ToolStripItemImageScaling.SizeToFit
ToolStripSplitButton1.AutoSize = True
ToolStripSplitButton1.Image = New Bitmap("c:\bitmaps\cr logo icon.png")
End Sub
Private Sub ToolStripSplitButton1_ButtonClick(sender As Object, e As EventArgs) Handles ToolStripSplitButton1.ButtonClick
If ToolStripSplitButton1.AutoSize Then
ToolStripSplitButton1.AutoSize = False
ToolStrip1.ImageScalingSize = New Size(50, 50)
ToolStripSplitButton1.Size = New Size(50, 50)
Else
ToolStrip1.ImageScalingSize = New Size(20, 20)
ToolStripSplitButton1.AutoSize = True
End If
End Sub
End Class