Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Draw lines in a userform
I need to draw oblique lines in a form, as you can do in VB using th
drawline tool, but I don't know how todo that in VBA since there´s n drawline tool. I saw a post with the same problem, solved by using 1-pixel-widt labels, but its only works with horizontal al vertical lines -- Message posted from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Draw lines in a userform
while cumbersome, you could create a bitmap that appears as you wish and
have it as the background of the userform or use several with image controls. -- Regards, Tom Ogilvy "gbottesi " wrote in message ... I need to draw oblique lines in a form, as you can do in VB using the drawline tool, but I don't know how todo that in VBA since there´s no drawline tool. I saw a post with the same problem, solved by using 1-pixel-width labels, but its only works with horizontal al vertical lines. --- Message posted from http://www.ExcelForum.com/ |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Draw lines in a userform
Hi gbottesi,
For the fun, in the userform module: Option Explicit Private Declare Function GetDC& Lib "user32" (ByVal hWnd&) Private Declare Function LineTo& Lib "gdi32" (ByVal hDc& _ , ByVal x&, ByVal y&) Private Declare Function MoveToEx& Lib "gdi32" _ (ByVal hDc&, ByVal x&, ByVal y&, lpPoint As POINTAPI) Private Declare Function GetActiveWindow& Lib "user32" () Private Type POINTAPI x As Long y As Long End Type Private hDc As Long Private Sub DrawLine(ByVal X1&, ByVal Y1&, ByVal X2&, ByVal Y2&) Dim pt As POINTAPI MoveToEx hDc, X1, Y1, pt LineTo hDc, X2, Y2 End Sub Private Sub UserForm_Activate() hDc = GetDC(GetActiveWindow) Dim i As Byte DoEvents For i = 1 To 10 DrawLine 8, 8, i * 30, (Me.InsideHeight * 4 / 3) - 8 Next i End Sub MP "gbottesi " a écrit dans le message de ... I need to draw oblique lines in a form, as you can do in VB using the drawline tool, but I don't know how todo that in VBA since there´s no drawline tool. I saw a post with the same problem, solved by using 1-pixel-width labels, but its only works with horizontal al vertical lines. --- Message posted from http://www.ExcelForum.com/ |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Draw lines in a userform
You can paste a drawing object into an image control. Copy the drawing
object, select the image control, click in the picture property in the Properties pane (where it probably says (none), and paste. (none) changes to (Metafile). Format the image control so it has no border and a transparent background, and choose the Center PictureAlignment and the Stretch PictureSizeMode. - Jon ------- Jon Peltier, Microsoft Excel MVP Peltier Technical Services Tutorials and Custom Solutions http://PeltierTech.com/ _______ Tom Ogilvy wrote: while cumbersome, you could create a bitmap that appears as you wish and have it as the background of the userform or use several with image controls. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
how to draw trend lines through only certain data points | Charts and Charting in Excel | |||
is there any built in function to draw lines | Excel Worksheet Functions | |||
VBA to draw lines of SPC | Charts and Charting in Excel | |||
draw different weight lines depending on the cell value | Excel Discussion (Misc queries) | |||
How do I draw lines..?? | Excel Programming |