Guidance
指路人
g.yi.org
Guidance Forums / wxWidgets (wxWindows) in C++ / wxWindow, Image

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. wxWindow, Image
#4099
Posted by: 2004-05-12 21:15:00
Hi,
I search a function that indicates to me if my mouse event appends in my image (that I have drawn with a OnDraw method) or outside my image.
thank you
Message2. Re: wxWindow, Image
#4103
Posted by: upCASE 2004-05-13 18:28:56
Hi!
I guess you'll have multiple choices. Well, at least two :)
1. Let the toplevel window (on which you paint the image) handle wxMouseEvents.
2. Write a "Canvas" (like a panel where you draw on) class and let this window handle the events.

1. I wouldn't recommend that solution. You'd have to get and inspect the XY coordinates to see if the mouse was inside your image.
2. Write a wxPanel derived Canvas class, resize it to the image size, let it handle EVT_ENTER_WINDOW and EVT_LEAVE_WINDOW events. That way you'll know if the mouse is over your image or not.
upCASE
-----------------------------------
If it was hard to write, it should be hard to read!- Do. Or do not. There is no try!
Forum List • Thread List • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Wed 2024-12-11  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0