Click here to Skip to main content
15,907,183 members
Home / Discussions / C#
   

C#

 
GeneralTabbedControl Validation Pin
RobertVG1-Jul-04 11:32
RobertVG1-Jul-04 11:32 
GeneralWindows Forms and Role Based Security Pin
OMalleyW1-Jul-04 5:14
OMalleyW1-Jul-04 5:14 
GeneralWord 2003 Pin
Giles1-Jul-04 4:34
Giles1-Jul-04 4:34 
QuestionHow to find out printable area? Pin
Pain_Elemental1-Jul-04 4:19
Pain_Elemental1-Jul-04 4:19 
AnswerRe: How to find out printable area? Pin
Pain_Elemental1-Jul-04 4:37
Pain_Elemental1-Jul-04 4:37 
AnswerRe: How to find out printable area? Pin
misterbear1-Jul-04 23:05
misterbear1-Jul-04 23:05 
GeneralDTS package Pin
Member 11509011-Jul-04 2:47
Member 11509011-Jul-04 2:47 
GeneralRe: DTS package Pin
Nick Parker1-Jul-04 4:07
protectorNick Parker1-Jul-04 4:07 
GeneralPocket PC\Telnet Pin
Schkin30-Jun-04 23:43
Schkin30-Jun-04 23:43 
GeneralRe: Pocket PC\Telnet Pin
Mike Dimmick1-Jul-04 0:04
Mike Dimmick1-Jul-04 0:04 
GeneralThe FlexGrid component Pin
saud_a_k30-Jun-04 23:34
saud_a_k30-Jun-04 23:34 
GeneralRe: The FlexGrid component Pin
Nick Parker1-Jul-04 4:18
protectorNick Parker1-Jul-04 4:18 
GeneralRe: The FlexGrid component Pin
saud_a_k1-Jul-04 18:19
saud_a_k1-Jul-04 18:19 
GeneralRe: The FlexGrid component Pin
saud_a_k1-Jul-04 23:44
saud_a_k1-Jul-04 23:44 
GeneralBefore Resize Pin
bouli30-Jun-04 22:55
bouli30-Jun-04 22:55 
GeneralRe: Before Resize Pin
Heath Stewart1-Jul-04 4:56
protectorHeath Stewart1-Jul-04 4:56 
GeneralRe: Before Resize Pin
bouli1-Jul-04 5:00
bouli1-Jul-04 5:00 
GeneralRe: Before Resize Pin
Dave Kreskowiak1-Jul-04 5:24
mveDave Kreskowiak1-Jul-04 5:24 
GeneralRe: Before Resize Pin
bouli1-Jul-04 5:35
bouli1-Jul-04 5:35 
GeneralRe: Before Resize Pin
Dave Kreskowiak1-Jul-04 5:49
mveDave Kreskowiak1-Jul-04 5:49 
GeneralRe: Before Resize Pin
bouli1-Jul-04 5:44
bouli1-Jul-04 5:44 
GeneralRe: Before Resize Pin
Anonymous1-Jul-04 8:18
Anonymous1-Jul-04 8:18 
GeneralRe: Before Resize Pin
bouli1-Jul-04 9:33
bouli1-Jul-04 9:33 
Hi,

I would not do that. One possible way I have done is the following:
- 1) when loading
* a) initialize the default value of the state, size, location of the window
* b) try to read values from the saving location (ini file, xml file, registry...)
* c) if succeed to read the values, assign these values to the current window
- 2) when closing
* a) save the state of the window to the saving location
* b) if the window is not minimized or not maximized (set to normal),
save the current size and location to the saving location
else
save the size and location that was read just before maximize or minimize.

to save the size and location of the window just before being maximize, as Heath suggested, I override the WinProc method and processed the WM_SYSCOMMAND message if the WParam of the WM_SYSCOMMAND is SC_MAXIMIZE or SC_MINIMIZE then we save the size and location of the window before calling the base.WinProc method.
And it works just fine.
This is the usual way in C++, so it's the same logic in C#.

Best regards.


There is no spoon.
GeneralWMI problem on Windows 98 Pin
sachinkalse30-Jun-04 22:12
sachinkalse30-Jun-04 22:12 
GeneralRe: WMI problem on Windows 98 Pin
Heath Stewart1-Jul-04 4:45
protectorHeath Stewart1-Jul-04 4:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.