Link to home
Start Free TrialLog in
Avatar of Manjesh
Manjesh

asked on

How can i obtain a Line Object???????????

Hi all,
 I want line component.


There r many components which provide  the line shape, but the problem is they draw a line on a window, so if i handle any mouse events for that line , it wil be applied to the entire window.This pose severe problem,like if a draw a big line on the form , i wont be  able to select any of the object(Windows) , behind the line.

_____
|\       |  
| \      |
|  \     |
|   \    |
|    \   |
|     \  |
|___\ |

So i want  a component which handle events on the line and not for the entire Window


Thank u for ur earliest attention

Manjesh







































 
Avatar of Member_2_248744
Member_2_248744
Flag of United States of America image

hello Manjesh, this is a difficult thing, are you experienced with graphical methods, maybe API Device Context methods, regions and others?
Avatar of YUY0x7
YUY0x7

This is easy to do.

y = mx + b

If you have this equation (the equation of a straight line) you can see if the mouse was clicked inside this
line. The OnMouseDown event gives you X,Y coords of the mouse pointer. Just plug them in to the equation
and see if y = mx + b. If the equation is correct, then you have hit the line, otherwise it has not.

Well, at least that's what I understood you wanted. If not, explain yourself better.

Avatar of Manjesh

ASKER

hi slick,
 i am familiar with the HDC , BeginPaint , EndPaint....................... , but how wil it help me,

If u hav ne further references for me , it wil be greatful

hi YUY0x7 ,
 suppose if 1 draw some intersecting lines, and i click on the point of intersection then which line shal i select.
If i hav line as objects,consider that i hav 100 object , OnMouseClick i hav to check for 100 objects.
It wil be really helpful if u can give some solution for this
ASKER CERTIFIED SOLUTION
Avatar of Member_2_248744
Member_2_248744
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Manjesh

ASKER

Hi slick
 It cant be better than this , but i hav few issues regarding this, in implementing in my project , i wil get to u as and when its done and accept ur answer