Logo
Inglese Russo Tedesco Francese Spagnolo Italiano
contattoprivacy
   Support Forums
chart
• Adjust flexgrid cell
• Animation
• Centering form text
• Coffee machine
• Creating fileshares
• Creating shortcuts
• Custom buttons
• Directory browser
• Disable mouse events
• File search by ext
• File transfer
• File watcher
• Formatting flexgrid
• Get Content Type
• Get HTML source
• Get modem port
• HTTP proxy
• ipconfig
• Large file split/merge
• MAPI
• MCI Sound Player
• Menu with images
• MP3 normalizer
• Net Send
• Netstat 2000
• No duplicate entries
• Outlook Address Book
• Set font color
• Shapes
• SOAP test
• Text-to-image
• Text file viewer
• Text find/replace
• UPS component
• View NT groups
• Word template
• Writing DNS control
    • Using DNS control
• Writing SMTP control
    • Sending email
    • Mailing list
• Writing WhoIs control
    • Using WhoIs control
• View HTML source
OISV - Organization of Independent Software Vendors - Contributing Member
VB projects - Centering the form caption

Description: Creating the form with center-aligned caption
Minimum requirements: vb
Download: source code
Screenshot:
centering the caption (3017 bytes)
Project: Standard EXE
Controls: Label1 (label)
Code:
Dim i As Integer 'size of space
Dim iCap As Integer 'size of caption
Private Const txt = "This is the test" 'form caption text

Private Sub Form_Load()
    With Label1
        .AutoSize = True
        .FontName = "MS Sans Serif"
        .FontBold = True
        .FontSize = 8
        .Caption = " "
        i = .Width - 15
        .Caption = txt
        iCap = .Width - 15
        .Visible = False
    End With
End Sub

Private Sub Form_Resize()
    If WindowState <> vbMinimized Then
        If Width < iCap + 1300 Then Width = (iCap + 1300)
        Caption = String((Width - (iCap + 1300)) / (2 * i), " ") & txt
    End If
End Sub

Copyright © 1996-2010 OstroSoft. Tutti i diritti riservati. info@ostrosoft.com