Re: Running an windows app in memory
- From: "Bill Woodruff" <msnwsgroups@xxxxxxxxxxxxxx>
- Date: Wed, 6 Feb 2008 23:19:24 +0700
Marc Gravell wrote : a nifty example of using a NotifyIcon in the
Program.cs at the start of a WinForms application (code snipped for
brevity).
Hi Marc,
In my development environment (Win XP, VS 2005, .NET 2.0) the call to :
Application.SetCompatibleTextRenderingDefault(false);
Must also occur before encountering any code that creates a WinForms object,
like a NotifyIcon.
I find the setting of the ShowBalloonTip of the icon parameter makes no
difference : the BalloonTip persists the same amount of time. This is true
whether I am running from within Visual Studio 2005 in debug mode, or if I
am running the application from a compiled .exe file.
A click event handler for the Icon does work nicely when added to your
example :
// note : using this "as is" does not filter out context-clicks,
// so if you are using a ContextMenuStrip on the NotifyIcon
// you need to write code to prevent a mess ...
//
icon.Click += new EventHandler
(
delegate
{
// Console.WriteLine("notify icon clicked");
icon.ShowBalloonTip(4000);
}
);
A side-effect, also, is sometimes ending up having more than one copy of the
icon in the taskbar, or having the icon persist in the system tray after you
close the app : although when you go mouse over the system tray, the
"ghosts" disappear. Refresh issue ?
I believe I experimented with a similar technique some months ago, and ended
up concluding that it was better to "go the whole hog" and write some
minimize to system tray code.
Does wrapping Application.Run in the clause of a Using statement have any
side-effects : it appears not, but I wonder ...
best, Bill Woodruff
dotScience
Chiang Mai, Thailand
"The greater the social and cultural differences between people, the more
magical the light that can spring from their contact." Milan Kundera,
Testaments Trahis
.
- Follow-Ups:
- Re: Running an windows app in memory
- From: Bill Woodruff
- Re: Running an windows app in memory
- From: Marc Gravell
- Re: Running an windows app in memory
- References:
- Running an windows app in memory
- From: cameljs18
- Re: Running an windows app in memory
- From: Marc Gravell
- Running an windows app in memory
- Prev by Date: Re: Change NewLine for StreamReader
- Next by Date: Re: Constructorname.classname is inaccessible due to its protection le
- Previous by thread: Re: Running an windows app in memory
- Next by thread: Re: Running an windows app in memory
- Index(es):
Relevant Pages
|
Loading