简体   繁体   中英

Button Sizes in Designer Different than in Debug VB.NET Visual Studio

I have a VB.NET project which has a ToolStrip containing multiple ToolStripButtons .

I have just recently increased the width of these buttons by ~30% to account for an increase in their text sizes. In the designer this width change has been reflected and looks good.

The issue is when I run the application in debug mode the changes have not been reflected. The text is changed but overflows because the buttons are not the correct width.

Looking through the Designer.vb code the correct System.Drawing.Size is specified and AutoSize is set to false for each button.

Does anyone have any ideas as to why the width of these buttons will not increase?

Most of the time, when this issue happens, there are 2 options:

  1. It is either a glitch (which is a rare event)
  2. You have other code that overrides the one you want.

If it is a glitch, restart your project or try it on another computer. The main thing is if it is not. When I encounter this type of problem, I delete the objects in this case your entire ToolStrip . What I do then is remove any code related to it in any way. After that, insert another ToolStrip and write the code you want. Most of the time this works with me. If it doesn't, you have one more option:

The code you have could be something similar to this: (It happened to me once after lots of Find and Replace)

 Dim picBig as boolean
 Dim picSmall as boolean
 'Some code to change a picturebox's size. There was an outline label that detects if it is over limit

 If Picturebox4.IntersectsWith(Outline.Bounds) Then
    picBig = True
 'Code for a message box
 'Code to make the picturebox smaller.
 End If
 If Picturebox4.IntersectsWith(Outline.Bounds) Then
   picSmall = True
  '... and so on as above.
 End If

As you can see, my program doesn't make sense. The second was meant to be sOutline.Bounds , but I made this mistake after repeatedly removing, copying, and pasting chunks of code here and there. Try looking for some of those, because otherwise the debugger does it exaclty what is in your code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM