Click here to Skip to main content
15,889,034 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
this is a simple basic question in vc++ ,I want to add mouse click control to an icon in view class. i added an icon in resource and succeeded to display the icon. now i want to click on that icon and it opens a file. so i dont know how to add object to that icon. Please help me.

/Edit M - Cross posting in Message board[^]
Posted
Updated 28-Apr-10 23:55pm
v5

Why not use a user drawn button with the icon design on the button? That should give you access to all normal button interaction.
 
Share this answer
 
that means no solution to give mouse click control to a rectangle or an icon drawn in a view class.. I am not supposed to use dialogue based. So in OnDraw() i draw a bitmap then a rectangle over bitmap. then i attached an Icon to that rectangle. Now what i want is when ever some one clicks on the icon(rectangle area), a file should be opened..
 
Share this answer
 
You can handle WM_LBUTTONDOWN.
it gives you the coordinate of the last left-button click.
Just check if they are into the rectangle.
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900