|
I can't, it isn't mine. The base class is UserControl.
|
|
|
|
|
|
Same problem: not allowed. The event-wrapper prevents me from doing anything but adding or removing an event handler.
|
|
|
|
|
Use a little reflection to get the field which represents the Paint event, then (from within your control) access the protected Events property. Pass in the event field id and check if it returns null or not.
FieldInfo fi = typeof(Control).GetField( "EventPaint", BindingFlags.Static | BindingFlags.NonPublic );
object eventPaint = fi.GetValue( this );
this.Paint += new PaintEventHandler(Form1_Paint);
if( base.Events[eventPaint] == null )
{
Debug.WriteLine( "No handlers attached to the Paint event." );
}
else
{
Debug.WriteLine( "One or more handler is attached to the Paint event." );
}
:josh:
My WPF Blog[^]
|
|
|
|
|
Josh Smith wrote: Use a little reflection to get the field which represents the Paint event, then (from within your control) access the protected Events property.
This is exactly what I need! I knew of the Events property but didn't know where to get the key to retrieve the right event. Thanks, Josh.
|
|
|
|
|
Just define your own Paint event with the "new" keyword and add logic to "add" and "remove" accessors. For example:
<br />
private PaintEventHandler myPaint;<br />
<br />
public new event PaintEventHandler Paint<br />
{<br />
add<br />
{<br />
base.Paint += value;<br />
myPaint += value;<br />
}<br />
<br />
remove<br />
{<br />
base.Paint -= value;<br />
myPaint -= value;<br />
}<br />
}<br />
<br />
protected override void OnPaint(PaintEventArgs e)<br />
{<br />
if (myPaint != null)<br />
base.OnPaint(e);<br />
else<br />
MyDefaultPainting(e);<br />
}<br />
|
|
|
|
|
Andrew Lygin wrote: Just define your own Paint event with the "new" keyword and add logic to "add" and "remove" accessors.
Perhaps a bit overkill if you just want some information about an event, but worth considering if you want to manipulate the event (although I suppose you don't really want to mess too much with a crucial event like Paint). Thanks anyway, Andrew. I'm sure your it'll come in handy someday.
|
|
|
|
|
Hi friends,
Can anyone tell me from where I can get Mail Editor like the one in crosoft Outlook..
Basically I want an Interface for sending HTML mails with images in the body or files as attachments.
Thanks for your time,
Sushant Duggal.
|
|
|
|
|
MS Outlook uses MS Word to edit mails.
|
|
|
|
|
Andrew Lygin wrote: MS Outlook uses MS Word to edit mails
Come again? Outlook CAN use Word for its editor. It has it's own editor built-in that it uses by default.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
That's right. But I don't agree to "it uses by default". I think the default is Word if it is installed. Although it does not matter.
|
|
|
|
|
Andrew Lygin wrote: But I don't agree to "it uses by default". I think the default is Word if it is installed.
Tools / Options / Mail Format tab. Word is not used by default. You have to turn it on yourself...
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Why not to say: "Tools / Options / Mail Format tab. Word is used by default. You have to turn it off yourself."?
Personally I didn't ask my Outlook to use Word. But it does it by default. I think it depends on something (installed Word or something else).
And I don't think this discussion branch will help Sushant with solving his problem. Let's leave default Outlook editor on MS developer's conscience. That's not the question for this board.
|
|
|
|
|
Hello,
I asked this question some time ago and got no answer.
Hope I have more luck this time.
I whant to get a list of directorys like "E:" ... for all active USB and Floppy devices on my PC.
Thanks for your help,
Martin
|
|
|
|
|
You could have a look at this.
Logical Disk Info[^]
Tarakeshwar
MCP, CCIE Q(R&S)
Before you criticize someone, you should walk a mile in their shoes. That way, when you criticize them, you're a mile away and you have their shoes.
!sgub evah t'nseod margorP sihT ?sgub naem ayaddahW
|
|
|
|
|
Looks good for me!
Thanks a lot.
|
|
|
|
|
New question,
Here I found a Select string for USB devices.
new ManagementObjectSearcher("SELECT * FROM Win32_DiskDrive WHERE InterfaceType='USB'");
Need that for Floppy.
Thanks for your time and help.
Martin
-- modified at 7:11 Monday 3rd July, 2006
|
|
|
|
|
You could check the previous link which gets the logical drive info of "drive A" as a 3 1/2 inch floppy drive. Can you not use that...?
Win32_DiskDrive[^] Samples Win32_FloppyDrive[^] Drivetype[^] WMI Samples MSDN[^]
Tarakeshwar
MCP, CCIE Q(R&S)
Before you criticize someone, you should walk a mile in their shoes. That way, when you criticize them, you're a mile away and you have their shoes.
!sgub evah t'nseod margorP sihT ?sgub naem ayaddahW
-- modified at 7:36 Monday 3rd July, 2006
|
|
|
|
|
No,
because i only whant USB and Floppy in my list.
If it's possible to ask, if(drive is floppy), it would be ok.
Thanks for the links!
Martin
|
|
|
|
|
Maybe I make it dirty, and compare with "Floppy drive" in mo["Description"]!
Would also work I think
Martin
-- modified at 8:00 Monday 3rd July, 2006
|
|
|
|
|
Hi.
I am studing C#, but my scholl have project for student.
I don't know C# can do what?. You can help me.
A project have three -> four people, become a group.
My group don't know what do. what project with C#.
But My group want do about technology, don't want manage.
You can hepl me make to choice one topic.
Thank you very much
|
|
|
|
|
|
Thank you.
I understand what things you say.I am too passive.I did't think about what i like, and i can develop.I'm sorry write this topic, thank you help me. Now I can find my project.
thank Vasudevan Deepak Kumar. thank Scottish.
|
|
|
|
|
|
hello!
is there anyone who did something about heuristic scanning.
how it works?
and what are the rule it follows?
muhammad mahmood ilyas
|
|
|
|