I always use the Status Bar control displaying at the bottom of my application MDI form, usually with several panels giving the user a constant display of important information. Is there any way to make the text in just ONE panel a different color and/or font?
Here's a sample of what you are looking for. There are probably better ways, but this is what I do.
Create a form with...
1. status bar (StatusBar1)
2. Picture Box (Picture1)
3. Label INSIDE the picture box (Label1)
Option Explicit
'Declarations
'
' API Declarations
'
Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
Private Declare Function SendMessageAny Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal msg As Long, ByVal wParam As Long, lParam As Any) As Long
'
' API Types
'
' RECT is used to get the size of the panel we're inserting into
'
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
'
' API Messages
'
Private Const WM_USER As Long = &H400
Private Const SB_GETRECT As Long = (WM_USER + 10)
Private bCancelSend As Boolean
Private Sub Form_Load()
Dim tRC As RECT
'
' Get the size of the Panel (2) Rectangle from the status bar
' remember that Indexes in the API are always 0 based (well,
' nearly always) - therefore Panel(2) = Panel(1) to the api
'
'
SendMessageAny StatusBar1.hwnd, SB_GETRECT, 0, tRC
'
' and convert it to twips....
'
With tRC
.Top = (.Top * Screen.TwipsPerPixelY)
.Left = (.Left * Screen.TwipsPerPixelX)
.Bottom = (.Bottom * Screen.TwipsPerPixelY) - .Top
.Right = (.Right * Screen.TwipsPerPixelX) - .Left
End With
'
' Now Reparent the ProgressBar to the statusbar
'
With Picture1
SetParent .hwnd, StatusBar1.hwnd
.Move tRC.Left, tRC.Top, tRC.Right, tRC.Bottom
.Visible = True
End With
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.