Click here to Skip to main content
15,908,172 members
Home / Discussions / C#
   

C#

 
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 
I call the below code from the MouseClick event of a control. However, it doesnt seem a good idea to be constantly creating gfx objects every time the user clicks the mouse.

private void ClickedEdge(Point mousePoint)
{
    _selectedEdge = null;
    Graphics gfx = this.CreateGraphics();
    Rectangle clickedRect = new Rectangle(mousePoint, new Size(1, 1));

    foreach (EdgeObj edge in _edgeItems)
    {
        Rectangle edgeRect = Rectangle.Round(edge.Region.GetBounds(gfx));
        if (clickedRect.IntersectsWith(edgeRect))
        {
            _selectedEdge = edge;
            break;
        }
    }
}


So, does anyone know of a better way to find out if the mouse has clicked on a line which has been drawn onto the control?

Regards,
Gareth.

(FKA gareth111)

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 
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 
GeneralRe: How can I read a specific node in XML file ? Pin
Mohammad Dayyan13-Jun-08 3:49
Mohammad Dayyan13-Jun-08 3:49 
GeneralRe: How can I read a specific node in XML file ? Pin
leppie13-Jun-08 3:52
leppie13-Jun-08 3:52 
QuestionChange Page Doctype Pin
tadhg8813-Jun-08 3:05
tadhg8813-Jun-08 3:05 
AnswerRe: Change Page Doctype Pin
leppie13-Jun-08 12:17
leppie13-Jun-08 12:17 

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.