Form maximizes when seen via Remote Desktop
Asked Answered
D

1

7

I have written an HMI (Human Machine Interface) program for some kind of machine. The program runs on a touch panel with "Windows Standard Embedded 7". I guess it makes no difference to my problem that it is an embedded version of Windows 7.

  • The WindowState of the main form of my program is set to Normal, and the size set to match the resolution of the touch panel (1280x800).
  • The FormBorderStyle is set to None.
  • The StartPosition is set to CenterScreen.

The issue is:

  • when starting the program directly on the touch screen the program is shown as it should, filling the screen completely from top/left to right/bottom. This is OK!

  • when the program is NOT running and you log on to the touch panel via Remote Desktop (with a bigger screen, let's say 1920x1200), and THEN start the program (through the rdp session) the program also starts as expected, shown in the middle of the screen with the size of 1280x800. This is OK!

  • when logging on via rdp WHILE THE PROGRAM IS ALREADY RUNNING the program is shown as maximized, filling up the whole screen (1920x1200). This is not good, as the whole layout of my program is made for 1280x800!

Does anyone have an idea why my program is behaving like this, or is the problem somehow related to the rdp session?

Dodd answered 22/1, 2013 at 8:25 Comment(10)
Interesting test: does the SizeChanged event fire when you RDP to the application already running? If so.. you could subscribe and re-size the form..Adames
Welcome to StackOverflow! I took the liberty of modifying your post a bit so that it uses the formatting thingies better. You can see what I modified by clicking the time above my name. If you feel that your post was better or if you want to improve/change it more, click the edit button to the left to modify it.Conversationalist
Oh, hitting ENTER posts the comment right away... I changed the speed setting of the rdp connection from a low band width to a higher, and for now the problem disappeared. Unfortunately I am not able to reproduce the problem, as it does not reoccur when setting the band width to low again. I will power cycle the touch panel as soon as I get to it (the panel is installed in another location) to try to reproduce the issue.Dodd
I just restarted the panel, but the problem simply does not show up anymore. A bit strange since we have had the problem for quite a long time. I can't event reproduce the issue when doing rdp from other computers than mine. Is it OK to keep the question open for a while hoping that the problem reoccurs?Dodd
Does this happen with other applications or just yours? Why not make your application support resolutions other than 1200 x 800?Garrettgarrick
Have you tried running the program locally and changing the desktop resolution while it's already running? Does the problem occur?Ara
You could try resizing it to the System.Windows.Forms.Screen.PrimaryScreen.WorkingArea instead of actually maximizing it. Might be a complete fix, or if you really want it maximized, it might focus you to the right direction.Labyrinth
Have you tried setting the forms maximum width and height properties as well as the width and height? These should keep the form size right no matter what happens..Noonan
I just found out that the issue also sometimes occurs when running the program on a laptop and then closing and opening the screen (cover of the laptop). Still investigating...Dodd
And the Resize event is firing when this happens...Dodd
P
1

This is probably caused by system trying to keep windows layout relative to the borders of screen. I've noticed this few times with some applications. If the app is not maximized but takes 100% of screen width after RDPing with bigger resolution it keeps it 100%.

If you want to prevent this you try can setting MinimumSize and MaximumSize propreties od the form to 1280x800 in the Form constructor. It should work

Poaceous answered 10/6, 2013 at 17:55 Comment(1)
I will let the thread open until I finish the current project I'm working on, as I use the same program base for this project. If I don't see the problem again it it must have been solved by e.g. an update of Visual Studio or Windows. Interesting comments by the way.Dodd

© 2022 - 2024 — McMap. All rights reserved.