Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.basic.visual.misc > #1053

Re: VB6 Frames

From "Mike Williams" <Mike@WhiskyAndCoke.com>
Newsgroups comp.lang.basic.visual.misc
Subject Re: VB6 Frames
Date 2012-04-30 11:25 +0100
Organization A noiseless patient Spider
Message-ID <jnlpa5$itf$1@dont-email.me> (permalink)
References <535op7d1eqve0prjlcl8m73fl7finp8pgd@4ax.com> <jnjbho$19r$1@dont-email.me>

Show all headers | View raw


"Mike Williams" <Mike@WhiskyAndCoke.com> wrote in message 
news:jnjbho$19r$1@dont-email.me...
>
> The borders of a VB Frame with a FixedSingle BorderStyle
> property are 2  pixels thick and the position of the top border
> is below the Top property of the Frame by an amount equal
> to half the text height of the Frame's font, rounded down if
> the text height is an odd number . . .

In the code example in my previous post I intended to round down the "half 
Frame Caption text height" to the nearest whole pixel but I inadvertently 
rounded it down to the nearest whole twip. This makes no difference and it 
works fine on machines running at an odd number of twips per pixel (the 
majority of machines) but it leads to a vertical positioning error of one 
pixel at some font sizes on machines running at an even number of twips per 
pixel. Here is my original code modified so that it fixes that problem:

Mike

Private Sub Command1_Click()
  Dim TwoPixels As Long
  picDummy.ScaleMode = vbPixels
  picDummy.Visible = False
  TwoPixels = Me.ScaleX(2, vbPixels, vbTwips)
  Set Image1.Container = Frame1
  Image1.Left = TwoPixels
  Set picDummy.Font = Frame1.Font
  Image1.Top = ScaleY(Int(picDummy.TextHeight("x") / 2), _
               vbPixels, vbTwips) + TwoPixels
  Image1.Width = Frame1.Width - (TwoPixels * 2)
  Image1.Height = Frame1.Height - Image1.Top - TwoPixels
End Sub



Back to comp.lang.basic.visual.misc | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

VB6 Frames scbs29 <scbs29@fred.talktalk.net> - 2012-04-28 17:12 +0100
  Re: VB6 Frames "Auric__" <not.my.real@email.address> - 2012-04-29 00:24 +0000
    Re: VB6 Frames scbs29 <scbs29@fred.talktalk.net> - 2012-04-29 10:10 +0100
      Re: VB6 Frames Deanna Earley <dee.earley@icode.co.uk> - 2012-04-30 08:59 +0100
  Re: VB6 Frames "Mike Williams" <Mike@WhiskyAndCoke.com> - 2012-04-29 13:18 +0100
    Re: VB6 Frames "Mike Williams" <Mike@WhiskyAndCoke.com> - 2012-04-30 11:25 +0100
  Re: VB6 Frames scbs29 <scbs29@fred.talktalk.net> - 2012-04-30 12:52 +0100
    Re: VB6 Frames "Mike Williams" <Mike@WhiskyAndCoke.com> - 2012-04-30 13:43 +0100
      Re: VB6 Frames scbs29 <scbs29@fred.talktalk.net> - 2012-05-02 13:39 +0100
        Re: VB6 Frames "Mike Williams" <Mike@WhiskyAndCoke.com> - 2012-05-02 21:21 +0100

csiph-web