Click here to Skip to main content
15,916,692 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am looking for either code or a custom control that provides functionality much like a Visio rectangle box. I want to be able to drop one or more instances of the rectangle on a form, highlight and un-highlight the rectangles by clicking them with a left mouse button, and be able to resize the rectangle by dragging on handles when the control is highlighted.

The background of the control would need to be transparent so that I can see through to an underlying image, and have a border that is visible.

My application is being created in VB.NET 2010. It is an MDI app, and the child forms contain a background image. Basically I need to be able to give the user the ability to these resizeable rectangles over selected areas of the image.

help appreciated

Thanks for the reply William.
This solution looks OK, but unfortunately it is in C. I only have VB 2010 express, so couldn't open the files.
Share this answer
William Winner 15-Oct-10 17:56pm    
Posting an answer to reply to another answer is not the proper way. There is a link at the bottom of each answer that says "Add Comment". Click it and then whatever you submit will actually go to the author of the answer. Posting a new "answer" only lets you know that something has been done.
db551 15-Oct-10 23:45pm    
thanks for the note
Maybe not exactly what you were looking for, but it should provide you with a start:

A Resizable Graphical Rectangle[^]

[Response to other answer]
Well, it's actually written in C#, not C...big difference. Anyway, you can download C# Express as well and build it and then add it directly. Really, though, I wasn't intending it to be the solution, but it should provide you with some direction on where to go. Chances are you are not going to find a control like you want for free. You're going to have to build it yourself.

The simple parts are the border, the mouse behavior, and the background. The more difficult parts are really the resizing and the drawing. The article above shows one way you can do the resizing, though there are other ways as well.
Share this answer
db551 15-Oct-10 20:42pm    
"build it then add it directly" is probably stretching my current .NET skills. Does this imply compiling the project into a control that can be reused in VB ?
I am also searching for a control to buy, as this is the expedient solution, but haven't found one yet. Alternatively someone that wants to code the control for a fee.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900