Vb.net Windows Forms and placement of buttons at Resize event

~OSD~ 2,196 Reputation points
2024-03-26T13:56:11.1466667+00:00

Hi,

I have a form where I have selected DPI under auto-scale property. However, when the screen resolution changes, the buttons (Button 1, 2, and 3) are dislocated.

Is it possible to place the buttons on approximately 75 percent of the entire form screen? So even if the resolution changes, the buttons should be in almost the same location.

User's image

VB
VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,728 questions
{count} votes

Accepted answer
  1. Anonymous
    2024-03-26T18:24:08.4833333+00:00

    Hi

    First of all, some confusion. Are you positioning Button1 vertically relevant to Label1.Height?

    In any case, once you have Button1 located to your liking, why not use that to set Button2 location: such as

    Button2.Location = New Point(Button1.Right + 20, Button1.Top)

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.