Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make a resizeable rectangle selection tool?

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

How to make a resizeable rectangle selection tool like the photoshop did?

like image 390
xpol Avatar asked Apr 04 '09 06:04

xpol


2 Answers

If you are talking about the "classic" "rubber band" type of selection rectangle, check out How to draw a rubber band rectangle or a focus rectangle in Visual C#.

like image 69
dommer Avatar answered Sep 22 '22 02:09

dommer


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

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

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

If you provide more specifics, I'm sure we can help you out more.

like image 28
kevindaub Avatar answered Sep 20 '22 02:09

kevindaub