Print Page | Close Window

multiline tab-caption

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Suite Pro
Forum Description: Topics Related to Codejock Suite Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=14515
Printed Date: 16 November 2024 at 6:15am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: multiline tab-caption
Posted By: codschock
Subject: multiline tab-caption
Date 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



Replies:
Posted By: jpbro
Date 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



Posted By: codschock
Date Posted: 13 June 2009 at 3:58am
You are a very good programmer, jpbro! Thank you!



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net