| | |
Help, Implementation of a selection tool
Please support our C# advertiser: Intel Parallel Studio Home
![]() |
What?
You want to be able to select part of an image so the user can have further usage? Please rephrase
You want to be able to select part of an image so the user can have further usage? Please rephrase
•
•
Join Date: Feb 2008
Posts: 46
Reputation:
Solved Threads: 4
hi
u can use GDI+ in c# and implement selection tool with my own i
i used MouseDownevent , MouseMoveevent , MouseUpevent and PaintEvent
declare refernce of Point as start point for ex:
Point startPoint = Point.empty;
Write in Mouse Down event:
startPoint = new (e.X,e.Y);
Write in Mouse Move event
Graphics g = this.CreateGraphics()l
g.DrawRectangle(Pens.Red,startPoint.X,startPoint.Y,
e.X-startPoint.X,e.Y-startPoint.Y);
that`s it
sorry i did not send the code because am work here and unfortunlly i don`t have c# editor
. and sorry i forget daniweb convention for writting code ;
u can use GDI+ in c# and implement selection tool with my own i
i used MouseDownevent , MouseMoveevent , MouseUpevent and PaintEvent
declare refernce of Point as start point for ex:
Point startPoint = Point.empty;
Write in Mouse Down event:
startPoint = new (e.X,e.Y);
Write in Mouse Move event
Graphics g = this.CreateGraphics()l
g.DrawRectangle(Pens.Red,startPoint.X,startPoint.Y,
e.X-startPoint.X,e.Y-startPoint.Y);
that`s it
sorry i did not send the code because am work here and unfortunlly i don`t have c# editor
. and sorry i forget daniweb convention for writting code ; •
•
Join Date: Nov 2006
Posts: 436
Reputation:
Solved Threads: 72
As BlackSun explained, you will need to manage it yourself using the image Graphics. It is a bit more complicated than the example above, but should move you into the right direction. The image onPaint event will have to remember that you have an active selection (the rectangle, and its deminsions) so that if you refresh the form, the selection will be persistent. You may want to use a popup menu, or something to grab that selection of the image and copy it to another bitmap object for processing (send to file, drag drop, whatever).
![]() |
Similar Threads
- MatLab Forum? (DaniWeb Community Feedback)
- No Colors Anymore? (DaniWeb Community Feedback)
- Sorting structures (C)
- Eforcers Web Development (Post your Resume)
Other Threads in the C# Forum
- Previous Thread: small doupt in datagridview
- Next Thread: Help, read xml and write in a txt file
| Thread Tools | Search this Thread |
Tag cloud for C#
.net access algorithm array barchart bitmap box buttons c# chat check checkbox class client color combobox control conversion csharp custom database datagrid datagridview dataset datetime degrees draganddrop drawing encryption enum event excel file files form format forms ftp function gdi+ httpwebrequest image index input install java label list listbox listener login mandelbrot math mouseclick mysql networking object operator oracle path photoshop picturebox pixelinversion post prime programming radians regex remote remoting resource richtextbox save saving serialization server sleep socket sql statistics stream string table tcp text textbox thread time timer treeview update usercontrol validation view visualstudio webbrowser windows winforms wpf xml






