0

I am developping a software for my company. I am coding everything in VB.NET in Visual Studio Professionnal 2019. At some point, I make a Control window in which I include a Panel object. I then add a browser in this Panel object in order to display a web content in the panel of my interface.

Here is the code managing this part in the Show() method of my Control object :

 Me.PanelWebBrowser.Controls.Add(browser)
 browser.Size = PanelWebBrowser.Size
 browser.LoadUrl("https://my-http.com")
 browser.Show()

My panel is defined as follows :

 Me.PanelWebBrowser.Controls.Add(Me.label_3D_visualization)
 Me.PanelWebBrowser.Location = New System.Drawing.Point(1001, 222)
 Me.PanelWebBrowser.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5)
 Me.PanelWebBrowser.Name = "PanelWebBrowser"
 Me.PanelWebBrowser.Size = New System.Drawing.Size(724, 600)
 Me.PanelWebBrowser.TabIndex = 18

I noticed that depending on the screen parameters, the content is not always displayed well in the panel.

For a screen of small size, the Windows parameters for text size are 150% and in that case the browser is not well displayed : enter image description here

For a wider screen however, the text size in the windows parameters is 100% and in that case the browser is perfectly displayed: enter image description here

What I would like is to have the 2nd picture's display all the time ! What can I do to make the content adapt to the screen size and display well ? I am new to VB.NET so please help me accordingly :)

Lalastro
  • 151
  • 2
  • 10
  • 1
    Your application must be DpiAware (`PerMonitorV2`). If you're targeting .NET Framework, as it appears, see [High DPI support in Windows Forms](https://learn.microsoft.com/en-us/dotnet/desktop/winforms/high-dpi-support-in-windows-forms) and, e.g., [How to configure an app to run correctly on a machine with a high DPI setting (e.g. 150%)?](https://stackoverflow.com/q/13228185/7444103) -- The Controls on the right seem to be direct child of the hosting Form. You need to setup a container (as a Panel) for those, too -- Designing at 100% scale can help, until you get the hand of it – Jimi Jun 01 '23 at 13:24

0 Answers0