473,486 Members | 2,127 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

hiding a Form on pressure of minimize button

How can I hide a Form (instead of having it reduced to the taskbar)
when the minimize button is pressed in C# (there's an icon in the tray
bar)?
I added the code

protected override void OnResize(EventArgs e)
{
//hide the form
if
(this.WindowState==FormWindowState.Minimized)
{
this.Hide();

this.WindowState=FormWindowState.Normal;
}
else
{
base.OnResize (e);
}
}

The problem is that when I clic on the tray icon the form unhides and
appears minimized (I would like it to be just restored).
Thanks a lot.
Andy
Nov 16 '05 #1
4 6416
Hi,

Yes you can, make a search in the newsgroup, I remember this was asked a
couple of weeks (months?) ago, I posted some code for it, I don;t have the
code here with me thought :(
You have to P/Invoke at least a function, to make the application dissapear
from the taskbar or from using ( alt+tab) .
If you don't find it; or if nobody post it; I will send you the code
tomorrow.

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"kurotsuke" <ku*******@yahoo.it> wrote in message
news:re********************************@4ax.com...
How can I hide a Form (instead of having it reduced to the taskbar)
when the minimize button is pressed in C# (there's an icon in the tray
bar)?
I added the code

protected override void OnResize(EventArgs e)
{
//hide the form
if
(this.WindowState==FormWindowState.Minimized)
{
this.Hide();

this.WindowState=FormWindowState.Normal;
}
else
{
base.OnResize (e);
}
}

The problem is that when I clic on the tray icon the form unhides and
appears minimized (I would like it to be just restored).
Thanks a lot.
Andy

Nov 16 '05 #2
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote
in message news:#x*************@tk2msftngp13.phx.gbl...
Hi,

Yes you can, make a search in the newsgroup, I remember this was asked a
couple of weeks (months?) ago, I posted some code for it, I don;t have the
code here with me thought :(
You have to P/Invoke at least a function, to make the application dissapear from the taskbar or from using ( alt+tab) .
If you don't find it; or if nobody post it; I will send you the code
tomorrow.

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation


Is there something wrong with the "ShowInTaskbar" property of a form? Set it
to false and the form no longer shows up in the taskbar.

Ryan LaNeve
Nov 16 '05 #3
kurotsuke wrote:
How can I hide a Form (instead of having it reduced to the taskbar)
when the minimize button is pressed in C# (there's an icon in the tray
bar)?
I added the code

protected override void OnResize(EventArgs e)
{
//hide the form
if
(this.WindowState==FormWindowState.Minimized)
{
this.Hide();

this.WindowState=FormWindowState.Normal;
}
else
{
base.OnResize (e);
}
}

The problem is that when I clic on the tray icon the form unhides and
appears minimized (I would like it to be just restored).
Thanks a lot.
Andy


In your event that shows the form also set the WindowState to Normal. Note
that you need to set the window state after calling show.
--
Tom Porterfield
MS-MVP MCE
http://support.telop.org

Please post all follow-ups to the newsgroup only.

Nov 16 '05 #4
Hi,

IIRC it will still be shown when using ALT+TAB

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Ryan LaNeve" <rl*****@noaviincspam.com> wrote in message
news:Oz*************@TK2MSFTNGP11.phx.gbl...
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote in message news:#x*************@tk2msftngp13.phx.gbl...
Hi,

Yes you can, make a search in the newsgroup, I remember this was asked a
couple of weeks (months?) ago, I posted some code for it, I don;t have the code here with me thought :(
You have to P/Invoke at least a function, to make the application dissapear
from the taskbar or from using ( alt+tab) .
If you don't find it; or if nobody post it; I will send you the code
tomorrow.

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation


Is there something wrong with the "ShowInTaskbar" property of a form? Set

it to false and the form no longer shows up in the taskbar.

Ryan LaNeve

Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2921
by: Erik Bethke | last post by:
Hello All, I now have a wx.NO_BORDER frame that I have written dragging code for... I like my window this way as it looks sleeker and I am now installing some image buttons. Now I would like...
1
29190
by: Prashant Joshi | last post by:
Hi all, I am using javascript to open a popup window. Is there any way we can disable the minimize button in this window? The maximize button is disabled. I want the same for the minimize button....
0
1583
by: Susan | last post by:
Hi all I am using javascript to open a popup window. Is there any way we ca disable the minimize button in this window? The maximize button i disabled. I want the same for the minimize button ...
3
7997
by: Stanav | last post by:
Hello all, Is there a way I can get into a form's close/minimize/maximize events when those buttons (the 3 small squared button in the upper right corner of a form) are clicked? For example, after...
4
12979
by: Brad Melendy | last post by:
Hello, I'm looking for an onclick event for the minimize button but can't seem to find it within the form properties. I'd like to add code to hide my form when it is minimized and suspect there...
1
4938
by: PavithraDamaruga | last post by:
Below is the javascript i am using to open a popup window. function OpenPopUpWindow() { window.open("key.html",'',width='50',height='50',resizable=0); } I want to disable the minimize button...
0
1691
by: AllenW | last post by:
I have a VB.Net 2005 application that moves the mouse cursor via software and generates mouse clicks anywhere on the monitor using SendInput. The code that moves the mouse and decides when to issue...
5
5233
by: Rinaldo | last post by:
Hi, How to regonize when the user clicks the minimize button in a form with events? Rinaldo
0
7100
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6964
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7175
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6842
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7330
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
3070
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3070
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1378
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
262
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.