i trying code in .net select area , area ever in form, not restricted control , asusually area appears square dragging using mouse @ runtime on form , if on clicking on button ex "save" i.e., saving selected area , when next time page loads particular area should clickable.right have no idea start if idea given more helpful me develop code functionality. 1 give small idea how can functionality, can proceed developing code?
this not code ... select area
public partial class form1 : form { bool canresize; int mx, my; rectangle rect = new rectangle(); public form1() { initializecomponent(); } private void form1_paint(object sender, painteventargs e) { e.graphics.drawrectangle(new pen(brushes.purple, 2), rect); } private void form1_mousedown(object sender, mouseeventargs e) { canresize = true; mx = e.x; = e.y; rect.location = new point(mx, my); } private void form1_mouseup(object sender, mouseeventargs e) { canresize = false; } private void form1_mousemove(object sender, mouseeventargs e) { if (canresize) { if (mx < e.x) { rect.x = mx; rect.width = e.x - mx; } else { rect.x = e.x; rect.width = mx - e.x; } if (my < e.y) { rect.y = my; rect.height = e.y - my; } else { rect.y = e.y; rect.height = - e.y; } this.invalidate(); } } }
Comments
Post a Comment