What is Bounding Rectangles?
Bounding Rectangles is a macro that can create rectangles that bound selected objects. It can create a single bounding rectangle that bounds all selected objects, or it can create a bounding rectangle for each of multiple objects in a selection. The margin between the selected content and the bounding box can be set as an absolute distance, or as a percentage of the longer dimension of the selection.
See Bounding Rectangles in use:
Screenshot:
Using the macro with the Userform.
With one or more objects selected, clicking the Create Bounding Rectangle(s) button creates one or more bounding rectangles, depending on the other settings in the form, and on the nature of the selection.
The margin between the selection and the bounding box is calculating based on whether Absolute or Relative is selected, and on the value in the corresponding combobox.
If Treat selection as single object is checked, then one bounding rectangle is created for the entire selection, even if it contains multiple objects. If that box is not checked, then a bounding rectangle is created for each object in the selection.
When Use True Size of Objects is checked, the macro uses the "true size" of objects (including outline width, corner styles, line caps, etc.) rather than "wireframe" size when determining the size and location of the bounding box.
If Set values for "No Form" sub is checked, then the settings in the userform are stored in the Registry for use by the Bounding_Rectangles_No_Form sub (more on this later).
Using the Comboboxes.
The boxes for numeric entry are comboboxes. The drop-down list for a combobox can contain values stored for convenient access. If a combobox is not locked, then when a value in thatcombobox is used by the macro, that value is added to the top of the list. If an existing value is used from the list, then that value is moved to the top of the list. Values can also be manually added to the list.
Ctrl+clicking on a combobox sets that combobox to its default value.
Right-clicking on a combobox brings up a menu of options for managing it.
These options may include:
Units of Distance.
For a combobox that represent a distance, values are applied by the macro in whatever units (inches, millimeters, etc.) are shown beside the combobox. Those units can be specified by the user through the right-click context menu.
If “Follow Horizontal Ruler Units” is chosen, then the units for the combobox are the same units that are in use in the document for the horizontal ruler. If those units are changed in the document, then the macro automatically changes the units in the combobox to match.
Although this documentation makes references to “the list” for the combobox, there is not necessarily only one list. The combobox maintains a separate list for any unit that is used in it. When units for the combobox are changed, then the list associated with those units is loaded. The number of decimal places, and also whether a list is locked or not, are things that are handled independently for each list.
A Video Describing and Demonstrating the Special Features of My ComboBoxes:
Using the macro without the Userform.
The Bounding_Rectangles_No_Form sub can be used to produce bounding rectangles without opening the userform. This sub can be used as a Command in regular CorelDRAW workspace customization, so it can be used on toolbars or menus, and can have a keyboard shortcut assigned to it. When creating bounding rectangles, this sub uses settings stored in the Registry. Those settings can be established by using the userform with the Set values for "No Form" sub box checked.
Subs in the Macro Manager.
Compatibility.
Bounding Rectangles was put together in a CorelDRAW X7 environment, and should work in versions X7-2020.
OK, where's the macro?
JQ_Bounding_Rectangles_Current.zip (most recently updated 2021-07-17).
That includes the .GMS file and a simple icon that can be used on a CorelDRAW Toolbar.
Please note that, starting with the version released on 2020-05-03, this macro uses a different scheme for storing combobox value lists and some preferences in the Registry. If you have been using an older version of this macro, those "old" value lists and preferences will not be there when you use the newer version. If you want to "clean out" those old entries that are not used by the newer version of the macro, the best way to do so is to run the Remove_Bounding_Rectangles_Registry_Entries sub, which will set the macro back to its default values.
Thank you Eskimo. Really useful.