Closed valimaties closed 2 years ago
Are you looking for the Rectangle
provided by RestoreBounds. It's unusual to obtain the location of a form when it is minimized. How are you obtaining those values? When are you obtaining those values?
Are you looking for the
Rectangle
provided by RestoreBounds. It's unusual to obtain the location of a form when it is minimized. How are you obtaining those values? When are you obtaining those values?
Hi @VolatilePulse, IMO, the location of form, before minimize or maximize, is the last position known before those actions.
Edit: Yes, I think I must change my approach and to keep
Edit2: RestoreBounds
values. Thank you @VolatilePulseRestoreBounds
store the position and size of form at launch. It doesn't change when form changes size or location, so I don't think anymore that RestoreBounds
is a solution. I've Re-Opened this issue.
I had another look at this today. RestoreBounds is designed to store the position of the window, but it is only updated prior to being maximized or minimized. The current location and size can be derived from Size and Location. However, minimized windows don't set the location and size like you'd expect. Windows effectively draws the windows off screen. You can check the WindowState to determine which properties you want to record.
If this solution doesn't work, you'll need to explain specifically what you're looking for so I can help provide a better solution.
... You can check the WindowState to determine which properties you want to record.
Yes, seems that is the solution for my problem, saving window size, location and state. Thanks!
Hi, If I store form's position and size when I minimize it, then strange values are stored. I think the same thing will happening if I will store the form's position and size if I will maximize form, it will not store the "real" size, or pozition.
I think the values of
Top
,Left
,Width
,Height
, must be the values beforeMaximize
/Minimize
action. So, could you do something to store those values?! As a workaround, I will check for what I will do with form before saving position and size. If it isMinimized
, I will not saveTop
andLeft
, and if it isMaximized
, I will not save the values ofWidth
andHeight
. I must preserve those values as they are before.