Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Suite Pro
  New Posts New Posts RSS Feed - multiline tab-caption
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

multiline tab-caption

 Post Reply Post Reply
Author
Message
codschock View Drop Down
Newbie
Newbie


Joined: 21 December 2008
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote codschock Quote  Post ReplyReply Direct Link To This Post Topic: multiline tab-caption
    Posted: 12 June 2009 at 4:12am
Hello,

Is it possible to set a multiline tab-caption, i.e.
\n does not work, isnt it?

 ------------- ------------ ---------------
 |  Fish &  |    Beer &  |  Sweets    |
 |  Food    |    Drinks  |                  |
 ------------- ------------ ------------- -----------------------------------------
 |                                                                                                     |
 |                                                                                                     |
 |                                                                                                     |
 |                                                                                                     |
 |                                                                                                     |
 |                                                                                                     |
 |                                                                                                     |
 |                                                                                                     |
 -----------------------------------------------------------------------------------

Regards
Frank
Back to Top
jpbro View Drop Down
Senior Member
Senior Member
Avatar

Joined: 12 January 2007
Status: Offline
Points: 1355
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post Posted: 12 June 2009 at 5:20pm
You can use the <LineBreak/> tag in Markup in order to have multiple line tab captions.

Something like:

Option Explicit

Private Sub Form_Load()
   Dim l_LineHeightPx As Long
   Dim l_MarginHeightPx As Long
  
   ' Determine the height of one line of text
   ' and convert it to pixels if required (since the TabControl uses pixels)
   l_LineHeightPx = Me.TextHeight("A")
   Select Case Me.ScaleMode
   Case vbPixels, vbUser
   Case Else
      l_LineHeightPx = Me.ScaleY(l_LineHeightPx, Me.ScaleMode, vbPixels)
   End Select
   ' Calculate half of line height + padding for top margin and bottom margin
   l_MarginHeightPx = l_LineHeightPx / 2 + 1
  
   With Me.TabControl1
      ' Make room for 2 lines of text
      .PaintManager.ButtonMargin.SetRect 0, l_MarginHeightPx, 0, l_MarginHeightPx
      ' Enable Markup to take advantage of LineBreak tag
      .EnableMarkup = True
      ' Add 2 lines of text using TextBlock and LineBreak tags
      .InsertItem 0, "<TextBlock>Fish &amp;<LineBreak/>Food</TextBlock>", 0, 0
   End With
End Sub


Note that the margin calculation I provided is only good for 2 lines of text, and only if your form font is the same as your TabControl button font. Also note that this is relatively untested code that is intended for demonstration purposes (you are free to use it any way you please, but there may be bugs so please test it thoroughly!)
Product: Xtreme SuitePro (ActiveX) version 16.2.6
Platform: Windows XP - SP3

Language: Visual Basic 6.0 SP6

Back to Top
codschock View Drop Down
Newbie
Newbie


Joined: 21 December 2008
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote codschock Quote  Post ReplyReply Direct Link To This Post Posted: 13 June 2009 at 3:58am
You are a very good programmer, jpbro! Thank you!
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.154 seconds.