Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#2.0 C#3.0 C# C#4.0
in WPF i saw some events like StrokeCollected , StrokeErased ,StrokeErasing ,
i want them in my Windows form for my controls like panel or pcitureBox,
 
is that possible to create a handler to invoke that event ?
 
thank you in advance
Posted 15-Nov-11 19:21pm
Comments
Mehdi Gholam at 16-Nov-11 1:02am
   
I believe they are WPF specific, and not available on winforms.
SAKryukov at 16-Nov-11 2:17am
   
Of course. I provided an answer on events and mentioned this.
Unfortunately, OP is in a very deep confusion about the basics, so it's hard to give him effective help. Only going back to basics can help effectively, but OP needs to be convinced. Delusions, delusions...
--SA
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

An event handler is not used to invoke the event, it is used to handle the event when it is already invoked. So, no, this is not possible.
 
However, you never need to invoke any event declared in any already created class — this is already done in this class (it it is implemented correctly, of course). Moreover, you never can do it, unless this is your class with the source code which you can modify. You cannot access firing event even if you try to do it in a derived class. This is one of the most important limitation of event instances compared to delegate instances.
 
All you can do with event declared in some already existing class is to add an event handler to its invocation list or remove previously added handler. Of course you can do it with the events you mentioned in the question. This is all you really need.
 
[EDIT]
 
By the way, the class PictureBox is highly misused, it can be used effectively only in very simple situations and there is absolutely no need to use it in WPF. In most situations, it should not be used even in Forms. Explain your ultimate goal if you need to get some help on WPF graphics.
 
You should better through out the idea of mixing WPF and Forms in one UI. This is in principle possible, but not beneficial, very limited and problematic. It's mostly used for re-using legacy Forms code.
 
—SA
  Permalink  
v3
Comments
mohanrajkiller at 16-Nov-11 2:28am
   
i will brief in detail i am trying to implement this project in winforms is that possible???
 
http://www.codeproject.com/KB/WCF/DrawMeWCF.aspx
SAKryukov at 16-Nov-11 3:54am
   
It's surely possible. It's even hard to say, what's better, it depends on some detail. Basically, if you want to get vector graphics, WPF is better as all the bases for it are already well implemented. For pixel graphics, it's a question.
--SA
SAKryukov at 16-Nov-11 3:56am
   
I think I pretty much answered to everything in the scope of your original question. If you need details on implementation of graphical application in WPF or Forms, it should be a separate one.
 
So, will you consider accepting this answer formally (green button) -- thanks.
--SA
Mehdi Gholam at 16-Nov-11 3:48am
   
5'ed
SAKryukov at 16-Nov-11 3:52am
   
Thank you, Mehdi.
--SA
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

1. You do not invoke events through handlers. Events are invoked based on user actions in UI (in this case) and handler handles it.
 
2. You can have those events too but for that, you will have to create your own picture box. Why do you need those events anyways? If you could share that, someone can provide you with a solution.
 

Edit: You will have to handle the Paint event and use the Graphics object to draw the things on screen. Make use of Mouse events to get the coordinates and use Paint event to draw.
  Permalink  
v2
Comments
mohanrajkiller at 16-Nov-11 2:31am
   
i am just trying to implement this project in winforms so i need those events :(
http://www.codeproject.com/KB/WCF/DrawMeWCF.aspx
d@nish at 16-Nov-11 2:34am
   
Updated the reply.
mohanrajkiller at 16-Nov-11 2:41am
   
Yes i have did that using a panel i am able to draw but i have to pass it on to client screen
Mehdi Gholam at 16-Nov-11 3:49am
   
5'ed

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 587
1 Sergey Alexandrovich Kryukov 479
2 Maciej Los 305
3 Mathew Soji 195
4 Afzaal Ahmad Zeeshan 170
0 OriginalGriff 7,356
1 Sergey Alexandrovich Kryukov 6,777
2 DamithSL 5,461
3 Manas Bhardwaj 4,916
4 Maciej Los 4,475


Advertise | Privacy | Mobile
Web04 | 2.8.1411023.1 | Last Updated 16 Nov 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100