How to for Smart Minimize

  • Thread starter Thread starter Thomas
  • Start date Start date
T

Thomas

Hello

After some weeks of developing with compact framework, I figured out
that i still do not unterstand whats going on when i press the X of the
form.

I now added a Close button in my application and want it to have the
same behavior as the "X" button of the form. I figured out that neither
Hide() nor Close() have same result as the "X".

Does somebody know how to perform a Smart Minimize of the Form in code?

Thanks!
 
The "Smart Minimize" does nothing special. It just sends the program to the
background. So, if you'd just call the Hide() method on your form it'd do
it.
 
Hello Alex

Thanks for your reply. You're right that Hide() seems to do the same as
the "X" button. But what I was wondering is:

When I open a Form (lets say Form1) within my Application with .Show()
and then press the "X" button, the Form is listed in the current
running Programms.
On my device, I go to Settings -> Memory -> Running Programms and the
Form "Form1" is visible beside my MainForm.

But when I hide the Form by using this.Hide(), the Form isn't visible
in the List. Have you any idea why this behaviour is diffrent?

Greetings Thomas
 
You don't really want to hide it if you're trying to match smart minimize.
You want to send it behind the bottom-most window in the stack and set its
size to 0. There might be some way to do this with only managed code, but
using SetWindowPos() is a single-step way (you have to P/Invoke it, of
course).

Paul T.
 
Thanks Paul

This helped a lot!

You don't really want to hide it if you're trying to match smart minimize.
You want to send it behind the bottom-most window in the stack and set its
size to 0. There might be some way to do this with only managed code, but
using SetWindowPos() is a single-step way (you have to P/Invoke it, of
course).

Paul T.
 
Back
Top