|
Hi Guillermo, I've got it working - well, the title bar didn't get repainted properly. Part/Chunk of it (Titlebar) appears dark. I called Invalidate(), which got rid of the problem in client area, not the title bar...
private void NotifyIcon_Clicked(object sender, System.EventArgs e)
{
WindowState=FormWindowState.Normal;
ShowInTaskbar=true;
BringToFront();
Focus();
Visible=true;
ClientSize = new System.Drawing.Size(292, 318);
Location = formLocation;
Invalidate();
return;
}
private void Form_Clicked(object sender, System.EventArgs e)
{
formLocation = this.Location;
WindowState = FormWindowState.Minimized;
ShowInTaskbar = false;
notifyIcon.Visible = true;
return;
}
norm
|
|
|
|
|
Good.
When I did it, I used Form.Hide() instead of changing the windowstate, so I didn't have the problem of repainting. When I clicked on the taskbar icon, I used Form.Show(). In that way, it did good for me..
Free your mind...
|
|
|
|
|
Thanks, it's working just fine now. I hide the form, as supposed to minimizing it.
norm
|
|
|
|
|
What i am doing is to generate a TrayIcon and use this code:
// Public Bool for Closing the app
bool boolAlowClose = false;
// Press the closing Button at the app
protected void frmMain_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
if (!boolAlowClose)
{
this.m_notifyicon.Visible = true;
this.Hide();
e.Cancel = true;
}
else { e.Cancel = false; }
}
// ContextMenu from Trayicon to view the app again
private void cmnu_View_Form_Click(object sender, System.EventArgs e)
{
this.m_notifyicon.Visible = false;
this.Show();
}
// This is the Menu "Close" hat close the application
private void cmnu_Menu_Close_Click(object sender, System.EventArgs e)
{
boolAlowClose = true;
this.Close();
}
Hope this will help!
Matthias
|
|
|
|
|
|
im writing a new control, and i need to pass information to the click event, how do i add data to then EventArgs so that when i create a new project and place this control in the form , the click even of that control will give me more data inside the EventArgs?
(i know i can create a class the inherits from EventArgs and add the info in there but what do i need to do, so that it will send that new class to the on_click event)
void on_click(object sender, System.EventArgs e)
|
|
|
|
|
Hi,
why you need to serve the data via the event? It's also possible to say:
void OnClick(object sender, EventArgs e)
{
((MyControlType)sender).MyDataProperty ...
}
you could read and write everything you need there.
.:[Greetz from Jerry Maguire]:.
|
|
|
|
|
You need to:
1) inherit from the System.EventArgs class with a new class eg:
public class MyControlEventArgs<br />
{<br />
private string AnExampleDataMember<br />
}
Then create a delegate for that type of event
public delegate void MyControlEventHandler(object sender, MyControlEventArgs e)
And then create the event using the newly created delegate.
Create data memebers in MyControlEventArgs for all the data you need to pass into the event. Pass an instance of the new args class into the new handler.
Cheers, James
James Simpson
Web Developer
imebgo@hotmail.com
|
|
|
|
|
|
hi , nice article but you are missing the point, maybe i didnt explain clearly. what i want to do is create a control, so that when i create a project and place the control in the form, i will look at the control's properties and press the events button, now if i double click on the event click in [action], it will create a new function like allways , but instream of getting a :
private void Control1_Click(object sender, System.EventArgs e)
{
}
i will get something like
private void Control1_Click(object sender, System.EventArgsWithExtraInfo e)
{
}
hope this is clearer now
|
|
|
|
|
What is your problem, just design your events as I explained in that article.
Also, for setting an event as an defult event, you should put (as I remember) below attribute above your event defenition in your event owner class:
[DefaultProperty]
Don't forget, that's Persian Gulf not Arabian gulf!
|
|
|
|
|
Hi, Currently I am using Excel 8.0 COM object to display information from C# to Excel. The codes i am using is from the net. However, there is always an error. I tried many different codes from different website, it still won't work. Would the different version of COM object be the reason of those errors? Does different version make a difference?
|
|
|
|
|
Hi, all,
Is it possible to set Enable(true /false) of all components inside group box once?
for example, I have 10 different components inside GroupBox, I just want to disable or enable them once , don't need to set them seperately.
Anyone can give me ideas?
|
|
|
|
|
I believe you can do:
myGroupBox.Enabled = false; and it will disable everything inside the groupbox.
When I can talk about 64 bit processors and attract girls with my computer not my car, I'll come out of the closet. Until that time...I'm like "What's the ENTER key?"
-Hockey on being a geek
|
|
|
|
|
Just for fun I'd like to be able to get an interface with a pc cam or a digital camera hooked up through usb. Like, for example I could write an app that does time-lapse photography on my cactus (which does move, btw), or claymation maybe. Like, I could save one frame every 10 minutes. Or of course for doing webcams..
I know there's software that comes with some pc cams that does some of that already, but, being a programmer, I'd like to get my hooks into it myself. Does directx do this, maybe? I'm worried that each cam will be non-standard about it's protocol, etc... anyone know?
thanks
"Outside of a dog, a book is Man’s best friend. And inside of a dog, it’s too dark to read."
-Groucho Marx
|
|
|
|
|
I recently found out that you can actually declare a class within a class, like so:
public class Class1
{
public class Class2
{
....
}
}
My question is, why would you ever want to that, as opposed to declaring the class separately like so:
public class Class2
{
}
public class Class1
{
Class2 cls;
}
Is there some hidden advantage to doing it the former way that I'm not aware of?
|
|
|
|
|
With this approach, you can create a Private Class (SubType)
Only the outter class can have access to the inner class
Free your mind...
|
|
|
|
|
Guillermo Rivero wrote:
Only the outter class can have access to the inner class
That is not true. This works:
public class MyDataSet
{
public class MyDataRow
{
}
}
public class MyApp
{
MyDataRow row = new MyDataRow();
}
When I can talk about 64 bit processors and attract girls with my computer not my car, I'll come out of the closet. Until that time...I'm like "What's the ENTER key?"
-Hockey on being a geek
|
|
|
|
|
You are right. sorry...
Free your mind...
|
|
|
|
|
I meant, if you have a private class inside a public class, the inner class is only visible within the scope of the public class...
Free your mind...
|
|
|
|
|
In addition to the previous answer:
~ The nested class has access to the containing classes private members.
~ Nested classes are commonly declared public and used as the type of properties or the return value of methods on the enclosing type. An enumerator is the canonical example of this. This avoids poluting the public namespace.
--
-Blake (com/bcdev/blake)
|
|
|
|
|
|
Blake Coverett wrote:
An enumerator is the canonical example of this. This avoids poluting the public namespace.
Ummm...everywhere in the .NET Framework, enums are part of the namespace and not the class. So that's not really a canonical example...or even an example.
When I can talk about 64 bit processors and attract girls with my computer not my car, I'll come out of the closet. Until that time...I'm like "What's the ENTER key?"
-Hockey on being a geek
|
|
|
|
|
Umm... sorry, no.
The enumerator interfaces are in the collection namespace but the actual types returned are:
ArrayList.GetEnumerator() => ArrayList.ArrayListEnumeratorSimple
ArrayList.GetEnumerator(int, int) => ArrayList.ArrayListEnumerator
Hashtable.GetEnumerator() => Hashtable.HashtableEnumerator
Hashtable.Keys.GetEnumerator() => Hashtable.HashtableEnumerator
Hashtable.Values.GetEnumerator() => Hashtable.HashtableEnumerator
... and the same for all the rest.
Hmm... as I get to the end of this I just realize you may have read it wrong. Enumerators are the canonical example. Were you thinking about Enumerations?
--
-Blake (com/bcdev/blake)
|
|
|
|
|
Blake Coverett wrote:
Enumerators are the canonical example. Were you thinking about Enumerations?
Sorry bout that.
When I can talk about 64 bit processors and attract girls with my computer not my car, I'll come out of the closet. Until that time...I'm like "What's the ENTER key?"
-Hockey on being a geek
|
|
|
|