question

RodneyOvercash-1917 avatar image
0 Votes"
RodneyOvercash-1917 asked JackJJun-MSFT commented

Desktop form application form resolution error

I have an old VB desktop application written prior to VS2017 that I am attempting to convert to 2019. It runs fine, except when I launch a form from within another form when the form being opened resizes to very tiny and all open forms (and any forms opened after) reduce to the new form's resolution. I can then manually resize forms and the form itself will resize but the objects within stay tiny and don't move.

If I build the application and install it on my development machine and/or client's machine, it works fine. It is only when running it within VS. I tried different settings on the Layout.autosizemode parameter, and I've run VS in DPI on and off mode. Nothing changes this behavior.

The code within the startup form to launch other forms is"

Dim frmForm as Form
frmForm = new frmRequisition
frmForm.ShowDialog()

The execution of ShowDialog causes the parent form to change resolution inappropriately. I do have a HDMI monitor attached, but I can unattach it, shut down everything, reboot and nothing helps.

windows-forms
· 8
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

First image: Rendering prior to launching a second form.
130826-vs1.png


Second image: After second form launches, just before second form appears, the launching form switches to a higher resolution and shrinks too small to see
130748-vs2.png

Third image: Even after closing the second form and resizing the first form's boundaries, the resolution remains too high and contents too small to see
130740-vs3.png


0 Votes 0 ·
vs1.png (126.2 KiB)
vs2.png (104.7 KiB)
vs3.png (140.2 KiB)

@RodneyOvercash-1917, Could you upload a sample project to the Github or Onedrive? It will be better for me to analyze your problem.

0 Votes 0 ·

Thank you so much for the offer to help. I can, but I need more info on where to upload and how. I have been programming in VS for many years but I am new here. Also, I assume you would just need to see the code, it will not function for you without the database. I would remove the connection strings anyway.

0 Votes 0 ·

This is a two project solution. A main project, and a second project that adds custom tools to the toolbox. These tools are just classes that inherit the layout and code from existing VS VB controls. The classes add features to the tools they inherit from. Stepping through the code I can visually see the main form resize after launching a second form and as I am stepping through the code of the second form. Both forms use these custom controls.

0 Votes 0 ·

Here is a sample of a routine in one of these custom tools. I can watch the main form resolution change while stepping through this code. The strange thing is that the main form shrinks at different points in this code. That suggests to me that there must be code still running from a function used to build this control. It might be still running after control is returned to my main code and while I’m stepping down through. (Maybe code within the system.drawing.size routine?)

 Public Class T3NavigationBarCombo
     Inherits Forms.BindingNavigator
     ' define navigation boxes
    
     Dim btnFirst = New System.Windows.Forms.ToolStripButton("new", Nothing, New eventhandler(AddressOf MenuNavigation))
    
         btnFirst.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
         btnFirst.Image = My.Resources.First
         btnFirst.Name = "btnFirst"
         btnFirst.RightToLeftAutoMirrorImage = True
         btnFirst.Size = New System.Drawing.Size(23, 22)
         btnFirst.Text = "",
    
         BindingNavigatorSeparator2.Name = "BindingNavigatorSeparator2"
         **BindingNavigatorSeparator2.Size = New System.Drawing.Size(6, 25**)


0 Votes 0 ·
Show more comments

0 Answers