473,763 Members | 6,666 Online
Bytes | Software Development & Data Engineering Community
+ 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(EventA rgs e)
{
//hide the form
if
(this.WindowSta te==FormWindowS tate.Minimized)
{
this.Hide();

this.WindowStat e=FormWindowSta te.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 6431
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*******@yaho o.it> wrote in message
news:re******** *************** *********@4ax.c om...
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(EventA rgs e)
{
//hide the form
if
(this.WindowSta te==FormWindowS tate.Minimized)
{
this.Hide();

this.WindowStat e=FormWindowSta te.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.mach in AT dot.state.fl.us > wrote
in message news:#x******** *****@tk2msftng p13.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 "ShowInTask bar" 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(EventA rgs e)
{
//hide the form
if
(this.WindowSta te==FormWindowS tate.Minimized)
{
this.Hide();

this.WindowStat e=FormWindowSta te.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*****@noavii ncspam.com> wrote in message
news:Oz******** *****@TK2MSFTNG P11.phx.gbl...
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.mach in AT dot.state.fl.us > wrote in message news:#x******** *****@tk2msftng p13.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 "ShowInTask bar" 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
2955
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 to create a new minimize button from an image, and then capture that mouse down and cause it to minimize the window... I can make buttons all day long, despite all of my googling I still
1
29267
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. Here is the javascript code that opens the window : child = window.open('NewWindow.aspx', null, 'width=850, height=450, directories=no, menubar=no, resizable=no, scrollbars=no, status=no, toolbar=no, directories=no');
0
1610
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 Here is the code that opens the window <A class="light" onclick="window.open('logout.aspx','LoWin','width=250,height=100,directories=no, menubar=no, resizable=no, scrollbars=no, status=no,toolbar=no,left=370,top=380');" href="javascript:;"...
3
8048
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 a user makes changes on the data on the form and clicks on the form's Close button (instead of updating the datasource first), I want the program to run the update routine first, then close the form. All helps are greatly appreciated. I'm using...
4
13072
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 is an onclick event I can use if only I knew its name? Thanks for any help. .....Brad
1
4977
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 in the pop up window. How can i achieve this?
0
1710
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 the simulated "click" is running in a separate thread from the main form's GUI. The "click" action is triggered by the user closing an external switch (not a real mouse). The problem is in minimizing my own main form. When I use SendInput to...
5
5245
by: Rinaldo | last post by:
Hi, How to regonize when the user clicks the minimize button in a form with events? Rinaldo
0
9564
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9387
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10148
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10002
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9938
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7368
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5270
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5406
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2794
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.