Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 63
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 115
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to draw trend lines through only certain data points akh2103 Charts and Charting in Excel 3 April 3rd 23 11:09 AM
is there any built in function to draw lines krishnan Excel Worksheet Functions 2 June 22nd 09 01:31 PM
VBA to draw lines of SPC Daniel Charts and Charting in Excel 4 July 31st 07 08:44 PM
draw different weight lines depending on the cell value birder1 Excel Discussion (Misc queries) 1 March 5th 07 10:53 PM
How do I draw lines..?? MIKEB Excel Programming 4 October 24th 03 12:22 AM


All times are GMT +1. The time now is 01:45 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"