Click to See Complete Forum and Search --> : Resizeable GroupBox Frame


Seshan R
May 11th, 1999, 05:27 PM
I need to create a transparent frame (like a group box), only it needs to be resizeable by the user (unlike the group box in this case). I should also be able to drag and move them within my dialog, apart from being able to resize them.
Could someone provide some input?

Paul McKenzie
May 11th, 1999, 05:41 PM
You may need to drag a bounding rectangle around on the screen. Check out CRectTracker. This may be what you need.

I implemented something like this a while ago. The trick was to create the group box dynamically and place it in the window. When the user wanted to resize the group box, the CRectTracker would appear around the group box. The user would move the CRectTracker around. When the user stops moving the tracking rectangle, the groupbox is sized and moved to the last position of the CRectTracker (and the CRectTracker is destroyed).

Regards,

Paul McKenzie

Seshan R
May 11th, 1999, 06:07 PM
Yeah, that sounds like more or less what i need to do.. Would u have the snippet of code by any chance with u.. I also thought that CRectTrackers need to be used only with COleClientItem classes or in general with containers. Please respond. Thanks for this Paul

Paul McKenzie
May 12th, 1999, 08:32 PM
I don't have the code, since I don't work for the company anymore. But basically, all I did was to create a CRectTracker dynamically, giving the dimensions, and use the CRectTracker functions. (HitTest is one where you would want to look at especially). Here is the snippet from MSDN concerning CRectTracker:

"The CRectTracker class allows an item to be displayed, moved, and resized in different fashions. Although the CRectTracker class is designed to allow the user to interact with OLE items by using a graphical interface, its use is not restricted to OLE-enabled applications. It can be used anywhere such a user interface is required ."

Note the last two sentences.

Regards,

Paul Mckenzie