Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

A very simple vertical line?

Status
Not open for further replies.

Flarkey

Technical User
Oct 31, 2001
4
GB
Hey folks,

This is a very simple problem that has been bothering for a few days now. It's due to the old "vertical lines can't grow" problem.

I have two horizontal lines with text boxes inbetween them which are "Can Grow = yes". I want one vertical line to separate the two boxes, ie drawn vertically exactly between the two horizontal lines.

Line1------|------
Text1 | Text2
Line2------|------

I am, as recommended by may other expert, doing this using the On_Print command. VB doesnt seem to like me drawing from the two Line.Top properties.


Here's my code:

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
' Comment: Draws a vertical line that will resize.
' Declarations
Dim X1 As Single 'Start of line
Dim Y1 As Single
Dim X2 As Single 'End of line
Dim Y2 As Single
Dim Color As Long

' Set measurement to cms, line width in pixels, black line color, .
Me.ScaleMode = 7
Me.DrawWidth = 5
Color = RGB(0, 0, 0)

Y1 = Me.Line1.Top '***Is this the right syntax????
Y2 = Me.Line2.Top
X1 = 9 '9 = roughly the center of the page
X2 = 9

'Finally draw the line
Me.Line (X1, Y1)-(X2, Y2), Color

End Sub

This code works ok if the two Y values are set at, say, 5 and 6.
Any ideas????

Thanks in advance,

Flarkey in Belfast
 
I think that the above should read:

Code:
Y1 = Me.Text1.Top
instead of
Code:
Y1 = Me.Line1.Top

as you want to copy the top coordinate from the textbox. You can find the bottom coordinate by calculating
Code:
Text1.Top + Text1.Height
.

You could also work with line objects and set the coordinates to the right values (taken from the textboxes) at the print event.

Best regards
 
Y1 = Me.Line1.Properties("Top")




MichaelRed
m.red@att.net

Searching for employment in all the wrong places
 
Tried it in all ways that I could think of...no luck...

Testing the Height property of a 'grown' text revealed something funny: it was constant, even though I had 1 line, 2 lines or 10 lines of text. Line2 moved down to keep the distance, but...the Top property remained unchanged, therefore the height of the line drawn by Me.Line was constant all the time. I don't see any way of calculating a relative position unless there is a method to find the 'final' height of a text box. I would be most happy to find one.

There could be a workaround (Houdini style) if just one of the text boxes grows...

But I don't see a way if both can grow independantly...

Let me know if you have one 'fixed height' text box and I'll try to explain the method...



[pipe]
Daniel Vlas
Systems Consultant

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top