Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21337

How to determine the Width and Height of Form

$
0
0
I'm making a custom message display Form and I want to resize the Form where the width will be dependent on the length of the longest line and the height will be dependent on the number of lines. All lines should be centered horizontally and vertically.

Examples:

Code:


+-------------------------+
|  This is the only line  |
+-------------------------+

+--------------------------------+
|    This is the first line      |
|  and this is the second line  |
|    this is the 3rd line      |
+--------------------------------+

The text line will be sent to a sub using vbCrLf's for each line, like this

ShowMessage "This is the first line" & vbCrLf & "and this is the second line" & vbCrLf & "this is the 3rd line"

I need to extract each line and determine the length of the longest line and how many lines there are.

EDIT:

Also, I need to point out, that if I were to send this:

ShowMessage "This is the first line" & vbCrLf & vbCrlf & "and this is the second line"

it needs to look like this:

Code:

+--------------------------------+
|    This is the first line      |
|                                |
|  and this is the second line  |
+--------------------------------+


Viewing all articles
Browse latest Browse all 21337

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>