Draw shape on userform

diddi

Well-known Member
Joined
May 20, 2004
Messages
3,337
Office Version
  1. 2010
Platform
  1. Windows
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
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
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
 
Upvote 0
Hi,

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.
 
Upvote 0
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.

but now i shall try again.
Thx for your help
 
Upvote 0
hey andy, do you have any pdfs or links to more info about this topic? just a thought

thx
 
Upvote 0

Forum statistics

Threads
1,213,501
Messages
6,114,010
Members
448,543
Latest member
MartinLarkin

We've detected that you are using an adblocker.

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.
Go back
Back
Top