Just for the fun of it I have created a Windows Forms application on a Windows 10 desktop using Visual Basic 2019 to enter contact details such as name, address, city, etc. The data is then stored in SQL Server. That part works flawlessly.
I use one main Form with a split container control (vertically split). The left panel holds fixed menu option buttons whilst in the right panel I store the various forms linked to the menu options. The first time a form is shown in this panel it is loaded and when another form is required I hide it and load or show the new form. The real action on these forms is done in the Form_Enter event. Nearly all forms are created holding a TableLayoutPanel to cope with different screen resolutions. Some forms also have Panel controls e.g. when Radio Button Groups are used. The main form's AutoScaleMode is set to 'Font' - other options do not do the job properly!
I use two identical monitors one of which is on 125% text size and the other on 100%. When I move the app from one monitor to the other the main form adapts to the resolution immediately so also this part runs without problems.
One of the forms shows all contact details that can then be created, edited, or deleted. This includes a label design of which the layout follows international rules. The user can print this label to an installed label printer. In my case that is a Dymo Labelwriter 400. The printing itself functions as desired but there is a side effect the reason of which I do not understand. What happens is that as soon as the required label is opened (see code below) the main form's size is reduced to 100% text. So when I startb the app on the 100% monitor nothing changes but when I start on the 125% monitor is dimishes in a split second to 100%. And it stays like this until a new run.
I have simplified the label printing code but even then the odd behavior occurs. The code:
Dim myLabel As DYMO.Label.Framework.ILabel
myLabel = DYMO.Label.Framework.Framework.Open(Application.StartupPath & "\rvds.label")
Line 2 causes the problem.
Is there anyone who might know why this happens? I would appreciate your help!