System.Drawing Problem in c#
Hey there,
Recently I've been writing a small app that draws graphs of any function and came across a very weird problem.
After I initialize graphics using:
Graphics _graph = this.CreateGraphics()
And draw all my points using:
_graph.DrawLine()
I see the graph perfectly and everything works fine.
But, then I added an event that makes a textbox visible anytime the user holds his mouse over one of the function's points.
As soon as I hold my mouse over my func's graph, The graph disappears!!!
And it happens only at the first time, if I draw the graph again using a button (that's on the form), It won't disappear again!!!
Can anyone explain it to me!?
I never ran into such a weird problem before...
THANKS AHEAD!
And a good day,
Daniel.

Kirtan PatelRank #292 · 8.6K reputationPosted Aug 9, 2009, 5:24 PM EDT
can you post your code so that i can better understand your problem :)
Daniel8 reputationPosted Aug 10, 2009, 9:39 AM EDT
Master BillaRank #2,229 · 630 reputationPosted Aug 10, 2009, 7:51 PM EDT
I have checked your code, there you have written like,
/
// /// Shows the coordinates of the mouse whenever it moves /// /// /// private void Graph_MouseMove(object sender, MouseEventArgs e) { Double x, y; // Get the coordinates and set them according to the axises x = (e.X - this.Width/2); y = (this.Height/2 - e.Y); // Display them on the intended labels TSxLBL.Text = "X = " + (x/10).ToString("F1"); TSyLBL.Text = "Y = " + (y/10).ToString("F1"); // Check if the specific coordinate exists in the function, if so, show the "Function Point" TB if (Exists(ref _points, e.Location)) FuncPntLBL.Visible = true; else FuncPntLBL.Visible = false; }So according your code, when mouse move on the graph its going to invisible, so you need make it visible when that range is come under the your graph co-ordinates.
then it will work
Thank you