Click here to Skip to main content
15,897,518 members
Home / Discussions / C#
   

C#

 
QuestionwebBrowser1 Control and NT Authentication Pin
Brad Wick13-Jun-08 4:35
Brad Wick13-Jun-08 4:35 
AnswerRe: webBrowser1 Control and NT Authentication Pin
led mike13-Jun-08 5:19
led mike13-Jun-08 5:19 
QuestionWht is Static? Pin
ashwinibhalerao13-Jun-08 4:17
ashwinibhalerao13-Jun-08 4:17 
AnswerRe: Wht is Static? Pin
Anthony Mushrow13-Jun-08 4:20
professionalAnthony Mushrow13-Jun-08 4:20 
GeneralRe: Wht is Static? Pin
Simon P Stevens13-Jun-08 4:39
Simon P Stevens13-Jun-08 4:39 
QuestionClicking on a drawn line Pin
Gareth H13-Jun-08 4:09
Gareth H13-Jun-08 4:09 
AnswerRe: Clicking on a drawn line Pin
User 665813-Jun-08 4:31
User 665813-Jun-08 4:31 
AnswerRe: Clicking on a drawn line [modified] Pin
Anthony Mushrow13-Jun-08 4:33
professionalAnthony Mushrow13-Jun-08 4:33 
This could be so much more simple. The equation of a line: Y = mX + C X and Y are abvious m is the gradient and C is an offset.

So, if you can get the equation of your lines then you could use something like this:

void ClickedEdge(Point mousePoint)
{
  if(mousePoint.Y == ( lineM*mousePoint.X +lineC))
    //the user clicked the line!
}


Although you might want to check that mousePoint.Y is +/- 1 from the calculated Y position because its gonna be almost imposible to click the line exactly (since you can't click between pixels)

float Y = lineM*mousePoint.X +lineC;
Y = Y - mousePoint.Y;
Y *= Y;
if(Y <= 1)
  //user (mostly) clicked the line!


To get the equation for your line:

m = (endY - startY)/(endX - startX);<br />
c = m*startX - startY;


My current favourite word is: I'm starting to run out of fav. words!
-SK Genius

Game Programming articles start -here[^]-

modified on Friday, June 13, 2008 1:20 PM

GeneralRe: Clicking on a drawn line Pin
Gareth H13-Jun-08 7:16
Gareth H13-Jun-08 7:16 
GeneralRe: Clicking on a drawn line Pin
Anthony Mushrow13-Jun-08 7:19
professionalAnthony Mushrow13-Jun-08 7:19 
GeneralRe: Clicking on a drawn line Pin
Gareth H13-Jun-08 7:31
Gareth H13-Jun-08 7:31 
GeneralRe: Clicking on a drawn line Pin
Anthony Mushrow13-Jun-08 8:09
professionalAnthony Mushrow13-Jun-08 8:09 
QuestionCannot Save Personal settings Pin
humayunlalzad13-Jun-08 3:50
humayunlalzad13-Jun-08 3:50 
AnswerRe: Cannot Save Personal settings Pin
leppie13-Jun-08 3:51
leppie13-Jun-08 3:51 
GeneralRe: Cannot Save Personal settings Pin
humayunlalzad13-Jun-08 4:07
humayunlalzad13-Jun-08 4:07 
AnswerRe: Cannot Save Personal settings Pin
Ashfield13-Jun-08 4:13
Ashfield13-Jun-08 4:13 
GeneralRe: Cannot Save Personal settings Pin
humayunlalzad13-Jun-08 4:28
humayunlalzad13-Jun-08 4:28 
GeneralRe: Cannot Save Personal settings Pin
Ashfield13-Jun-08 5:11
Ashfield13-Jun-08 5:11 
GeneralRe: Cannot Save Personal settings Pin
leppie13-Jun-08 5:18
leppie13-Jun-08 5:18 
GeneralRe: Cannot Save Personal settings Pin
humayunlalzad13-Jun-08 5:34
humayunlalzad13-Jun-08 5:34 
GeneralRe: Cannot Save Personal settings Pin
leppie13-Jun-08 6:10
leppie13-Jun-08 6:10 
QuestionHow to merge the 2 tables of a dataset using c#, given the 2 tables contain same primary key with different content Pin
dotNetKeen13-Jun-08 3:41
dotNetKeen13-Jun-08 3:41 
AnswerRe: How to merge the 2 tables of a dataset using c#, given the 2 tables contain same primary key with different content Pin
leppie13-Jun-08 5:20
leppie13-Jun-08 5:20 
QuestionHow can I read a specific node in XML file ? Pin
Mohammad Dayyan13-Jun-08 3:39
Mohammad Dayyan13-Jun-08 3:39 
AnswerRe: How can I read a specific node in XML file ? Pin
leppie13-Jun-08 3:46
leppie13-Jun-08 3:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.