|
See the NotifyIcon component documentation. There are also a few articles on the subject here on the CP site. Your application needs only one static Main method (an application should have only one entry point to execute the application) and use the NotifyIcon to add an icon to the system tray.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Do you know if there is a way to get a message from Windows Explorer when my application is about to drop data into it?
At this point I am calling
control.DoDragDrop(dataVar, DragDropEffects.All);
when drag is triggered?
The problem is that I have to create a bunch of files and it takes a while, so I'd like to do all that OnDrop instead of OnItemDrag in case the user decides to cancel.
Another problem is that the dataVar needs to be in different formats depending on whether the user is dragging internally or externally (to windows explorer). I have no idea how to do that.
Any help would be appreciated,
Elena
Elena
|
|
|
|
|
Unfortunately, this is not as easy as is hoped. I was looking for something similar, if not identical, and it's not just a case of droping an object into the windows enviroment.
I've been trying to figure this out for weeks now, and i've had to go an look at COM and IDL to study the interfaces used by objects in unmanaged code to handle streams, before I can even begin to grasp how it would work in managed code.
It's all fun and games if you enjoy going balled through hair tearing though
I'm sure Heath will be able to fill you in far better than I can, but this is just a warning from someone who's stuck on the same thing!
Cata
|
|
|
|
|
As Cata mentioned, this has all been covered in the past. Search this forum for previous posts. You could also look at Catalysts's profile and see the messages posted. Most of them are related to this problem.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Hi,
Im looking for some sample code in C# which shows how to access multiple frames / pages in a TIFF image file and display them in a PictureBox Control.
I have researched the area and found a sample application in VB.Net but i cant seem to convert it correctly.
I have a problem getting the list of GUID's out of the image...
Thanks
Andrew
|
|
|
|
|
VB.NET and C# (and all other languages that target the CLR for that matter) use the same class libraries and all compile to IL. It's important to understand the Framework technology, not the language! VB.NET isn't that hard (hell, code monkeys have been using it - and coincidentally creating bad apps - in straight VB for years). Just remember that most of the calls are probably just to classes, methods, properties, structs, etc. that are just as accessible in C# as they are in VB.NET.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
I have cloned the mainMenu to the context Menu. If I set the .Enabled or .Disabled in the form load event. These feature works properly. But If I minimize the form to use the contextMenu, the mnHide menuItem is not Hidden. If I click on Hide when the form is hidded, this causes the form to be squeezed to just the min, max and close buttons, when I do finaly hit the Show button.
Right now my issue is getting the mnHide button to hide, but this isn't working? Is there another way to hide the cloned context menu items ?
//
//contextMenu1
//
this.contextMenu1.MenuItems.Add(mnShow.CloneMenu());
this.contextMenu1.MenuItems.Add(mnHide.CloneMenu());
private void contextMenu1_Popup(object sender, System.EventArgs e)
{
if (this.WindowState == FormWindowState.Minimized)
{
this.mnShow.Enabled = true;
this.mnHide.Enabled = false;
}
else
{
this.mnShow.Enabled = false;
this.mnHide.Enabled = true;
}
}
Thanx in advance for your help.
**DAN**
|
|
|
|
|
mnShow and mnHide are not the correct objects to enable / disable. Remember, you cloned them so they are not the same object reference. Instead, try something like this:
Menu mnShowClone = mnShow.CloneMenu();
Menu mnHideClone = mnHide.CloneMenu();
this.contextMenu1.MenuItems.Add(mnShowClone);
this.contextMenu1.MenuItems.Add(mnHideClone);
private void contextMenu1_Popup(object sender, EventArgs e)
{
mnShowClone.Enabled = this.WindowState == FormWindowState.Minimized;
mnHideClone.Enabled = !mnShowClone.Enabled;
}
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
when I try to create a new reference to I get :
**The type or namespace name 'mnShowClone' could not be found (are you missing a using directive or an assembly reference?)**
Am I just supposed to be referencing the Menu itself or the MenuItem ?
**DAN**
|
|
|
|
|
Wherever you cloned your menus, those mnShowClone and mnHideClone menus have to be accessible, i.e. if you declare them inside a method they will not be available inside another method. Instead, add them as class fields (just like mnShow and mnHide ) and assign them if they haven't been assigned already (as part of initialization code or something).
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Unbelievably, as easy as this may be, for myself it is still not working.
private void InitializeComponent()
{
... excess code removed
//
// contextMenu1
//
MenuItem mnShowClone = this.mnShow.CloneMenu();
MenuItem mnHideClone = this.mnHide.CloneMenu();
// MenuItem mnShowClone = this.mnShow.CloneMenu();
// MenuItem mnHideClone = this.mnHide.CloneMenu();
this.contextMenu1.MenuItems.Add(mnShowClone);
this.contextMenu1.MenuItems.Add(mnHideClone);
this.contextMenu1.Popup += new System.EventHandler(this.contextMenu1_Popup);
}
public void contextMenu1_Popup(object sender, System.EventArgs e)
{
// mnShow.Visible = true;
// mnHide.Visible = false;
mnShowClone.Enabled = this.WindowState == FormWindowState.Minimized;
mnHideClone.Enabled = !mnShowClone.Enabled;
// if (this.WindowState == FormWindowState.Minimized)
// {
// this.ConmnShow.Enabled = true;
// this.mnHide.Enabled = false;
//
// }
// else
// {
// ;
// this.mnShow.Enabled = false;
// this.mnHide.Enabled = true;
// }
}
The lower portion of the last bit of code was what was working when I did not include a MainMenu.
Thanks for you help
**DAN**
|
|
|
|
|
Opps Sorry I posted as Anonymous
**DAN**
|
|
|
|
|
OK, Today I have my Head screwed on. I got it. I just created a seperate method for creating the contextMenu.
Thank you for your help Heath
**DAN**
|
|
|
|
|
How can clear the DOS Console from a C# console application.
...the mind is not a vessel to be filled but a fire to ignited
|
|
|
|
|
This will be possible in either .NET 2.0 or Longhorn (no sure exactly which since release details are still sketchy) with Console.Clear , but for now you have to rely on other ways. One article here on CP presents such a way: http://www.codeproject.com/csharp/winconsole.asp[^].
There's also a programmatic way, but you'll have to P/Invoke some native functions: http://support.microsoft.com/support/kb/articles/q99/2/61.asp[^].
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
but with this method, you give up your portability
antoher method is, when you fill up the Console with
\n (i mean the escape sequence)
scio me nihil scire
My OpenSource(zlib/libpng License) Engine:
http://sourceforge.net/projects/rendertech
|
|
|
|
|
Portability is often not possible anyway. Say I write a console app to manage the NICs in the machine - unless I add an abstraction layer, managing information on the NICs / in the OS is platform-dependent. Even with the code I gave, one could always abstract that, too.
In any case, your idea works, it just isn't technically clearing the screen (this is most notable when you have a larger command/output buffer for your prompt and scroll).
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
[rant]
That decided that a BarBreak creates a horizontal bar on a MainMenu, but a vertical bar on a ContextMenu???
What if I want a horizontal separator on a context menu???
![/rant]
Marc
Latest AAL Article
My blog
Join my forum!
|
|
|
|
|
|
|
Marc Clifton wrote:
That the "-" now means "seperator".
Oops I thought -- is the seprator and it's different from a bar break?
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
ive might have missed the idea of what you are doing
but whats wrong with setting the text to "-" on the menu item? (since this always renders a horizontal separator)
//Roger
|
|
|
|
|
Roger J wrote:
but whats wrong with setting the text to "-" on the menu item?
OK, so who was the idiot that got rid of the Separator concept, so I have to remember stupid tricks like that???
Marc
Latest AAL Article
My blog
Join my forum!
|
|
|
|
|
is it possible to make a program in c# that doesn't require the .net framework installed?
I've written a program in c# and visualstudio.net and I want it to work without any trouble on all computers, but when i try to run it on my other computer it says that the .net framework isn't installed..
is it possible to include the framework parts that are needed in the program..
or is the only way to go to rewrite the program in c++?
|
|
|
|
|
Running C# without the framework is like having a steering-wheel without a car attatched....it makes a nice projectile, but won't get you far.
You can place the .NET framework inside your setup app, but it does increase the size of it by 20mb.
Jonathan 'nonny' Newman
blog.nonny.com [^]
|
|
|
|