From: Karl E. Peterson on
NadCixelsyd wrote:
> I need a form that is 80 characters wide. At 120 twips per character,
> that's 9600 twips wide. But the border on my XP system is 4 pixels
> (60 twips) on each side, so I add 120 twips and set my form1.width to
> 9720. Perfect as this gives me 9600 usable twips.
>
> Except on my Vista system, the borders are 6 pixels (90 twips) on each
> side.
>
> So how do I find out how wide the border is. How much do I need to
> set my form1.width so that I have 9600 usable twips?

I'm with the others - since VB1 it's worked to subtract ScaleWidth from
Width and divide by two.

But if you want it straight from the horse's mouth, take a look at the
iBorderWidth element of the NONCLIENTMETRICS structure returned by
SystemParametersInfo(SPI_GETNONCLIENTMETRICS).

See: http://vb.mvps.org/samples/NCMetrics

--
..NET: It's About Trust!
http://vfred.mvps.org


From: Rick Rothstein on
> I'm with the others - since VB1 it's worked to subtract ScaleWidth from
> Width and divide by two.

"The others"? Well, you are "not" with me on this because... that is not
what I proposed.<bg> I would point out, though, that my method could be used
to size the interior height of the form to a specific value as well.<g>

--
Rick (MVP - Excel)

From: Karl E. Peterson on
Rick Rothstein wrote:
>> I'm with the others - since VB1 it's worked to subtract ScaleWidth from
>> Width and divide by two.
>
> "The others"? Well, you are "not" with me on this because... that is not what
> I proposed.<bg> I would point out, though, that my method could be used to
> size the interior height of the form to a specific value as well.<g>

Heh, well I was answering *the* question, not wandering off in pursuit
of some higher goals. (Okay, this is where I admit I read the Subject
and just sort of glossed through the Body. <g>)

--
..NET: It's About Trust!
http://vfred.mvps.org


From: Mike Williams on
"Rick Rothstein" <rick.newsNO.SPAM(a)NO.SPAMverizon.net> wrote in message
news:%23Ka65bJ6KHA.1424(a)TK2MSFTNGP04.phx.gbl...

> I would point out, though, that my method could be used to
> size the interior height of the form to a specific value as well.

A straight forward calculation works just as well for the height as it does
for the width (although all methods of course rely on there being sufficient
screen area available):

Me.ScaleMode = vbTwips
Me.Width = 9600 + (Me.Width - Me.ScaleWidth)
Me.Height = 7200 + (Me.Height - Me.ScaleHeight)

Incidentally, VB already does by default create your Form on the target
machine so that its initial logical client size (as opposed to its pixel
size) is such that the logical client width and logical client height are
whatever they were in the IDE on your development machine, automatically
adjusting its overall width and height to take into account the various
different border and caption bar thickness on different machines (again, as
long as there is sufficient screen area available).

Mike




From: NadCixelsyd on
On Apr 30, 1:31 am, "David Youngblood" <d...(a)flash.net> wrote:
> "NadCixelsyd" <nadcixel...(a)aol.com> wrote...
> >I need a form that is 80 characters wide.  At 120 twips per character,
> > that's 9600 twips wide.  But the border on my XP system is 4 pixels
> > (60 twips) on each side, so I add 120 twips and set my form1.width to
> > 9720.  Perfect as this gives me 9600 usable twips.
>
> > Except on my Vista system, the borders are 6 pixels (90 twips) on each
> > side.
>
> > So how do I find out how wide the border is.  How much do I need to
> > set my form1.width so that I have 9600 usable twips?
>
> One easy method is to subtract ScaleWidth from Width,
>
> Debug.Print Width - ScaleX(ScaleWidth, ScaleMode, vbTwips)
>
> David

Thanks to all. I was not familiar with ScaleWidth