devxlogo

ScaleWidth vs Width

ScaleWidth vs Width

Question:
I am resizing my widows during runtime. I also want my dialogboxes to resize with the window. My program is doing thiscorrectly. But it is not resizing the command buttons in thedialog box, which are the same width as the dialog box.I have given the command: Command1.Width = Dialog1.Width.

This gives me an error message of “Overflow!”. I guess I need to resize the text inside the command button. If that is so How do I do it? I have gone thru all the resources you have noted previous to this question page and have not seen anymention of this.

Answer:
Try doing this: Command1.Width = Dialog1.ScaleWidth. I would assume that Dialog1 is your form. The ScaleWidth property specifies the available width for controls within it. Most controls that can be used as containers have a ScaleWidth property also.

devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist