greets all, i have been searching around for a method to draw an angled line onto a userform. must be programatic as the line angle and length changes. any suggestions?
TIA
thx for link
i have had alook and modified the code. nearly got it to work except that it draws to the back-most layer on the window and i had a backgroud pic which had to stay as back layer and i couldnt work out how to incorporate the background. so reluctantly i had to give up. thx anyway
I the example file you can download I do use the userforms picture property to display any shapes drawn, which will replace any background image you are trying to use.
But there is a way to display drawings on any control that has a picture property.
Instead of using the CanvasUserform property you can make use of the CanvasGeneric property.
Code:
' Will use the userforms picture property
Set m_objDrawing.CanvasUserform = Me
' will use Image1 picture property
Set m_objDrawing.CanvasGeneric = Me.Image1
So you just need to add a control and position it in the area where you what the drawings to appear. You will have to revise the Left and Top properties as these will now be relative to the top left corner of the control rather than the userform.
Your choice of control may be important as controls can appear on different layers and even changing the z-order will not allow 1 control type to appear infront of another.
For example, labels will not appear in front of listboxes.
gee i wish i was smart. i will have another go at it.
since you are following the thread, i have a map of australia and select two towns from comboboxes which are plotted on to the map. there is also a movable intermediate point which allows me to plan a route between the points and calculate a straight line distance between them. what i was wanting to achieve was to be able to draw two flat arcs or lines indicating the route. when i drew the canvas, my map ended up lost.
We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel
Which adblocker are you using?
Disable AdBlock
Follow these easy steps to disable AdBlock
1)Click on the icon in the browser’s toolbar. 2)Click on the icon in the browser’s toolbar. 2)Click on the "Pause on this site" option.
Go back
Disable AdBlock Plus
Follow these easy steps to disable AdBlock Plus
1)Click on the icon in the browser’s toolbar. 2)Click on the toggle to disable it for "mrexcel.com".
Go back
Disable uBlock Origin
Follow these easy steps to disable uBlock Origin
1)Click on the icon in the browser’s toolbar. 2)Click on the "Power" button. 3)Click on the "Refresh" button.
Go back
Disable uBlock
Follow these easy steps to disable uBlock
1)Click on the icon in the browser’s toolbar. 2)Click on the "Power" button. 3)Click on the "Refresh" button.