How to make a rectangle selection tool?

I am trying to write a very simple photo editor using C # 2008 or QT4.

How to make a rectangle size tool like photoshop?

+6
user-interface c # qt qt4
source share
4 answers

If you're talking about the β€œclassic” type of rubber band selection rectangle, see How to draw a rubber band or a focus rectangle in Visual C # .

+5
source share

WPF Code Example: http://www.codeproject.com/KB/WPF/wpfmarchingants.aspx?display=Print

This is a bit more complicated because it involves cropping the image, but if you scroll to the selection rectangle, you will see the basic formulas for calculating the rectangle: http://69.10.233.10/KB/WPF/ImageCropper.aspx

Finally, another one using GDI: http://codelog.blogial.com/2008/10/31/rubber-band-selection-rectangle-in-c/

If you provide more details, I am sure that we can help you.

+3
source share
+3
source share

I do not know the specific challenges, but the idea is this:

You want to draw a transparent rectangle with an opaque or dotted border. A rectangle appears when you click the mouse button. While the button is held down, the size of the rectangle will change when you move the mouse with the upper left point at the place where the button was clicked, and in the lower right corner of the mouse after moving. Releasing a button causes the rectangle to fix its position above the selection area.

You must be able to find data from a resource in the C # Drawing namespace.

+2
source share

All Articles