MessageBar |
Post Reply |
Author | |
moe188
Senior Member Joined: 27 March 2006 Status: Offline Points: 220 |
Post Options
Thanks(0)
Posted: 09 May 2008 at 2:41pm |
Hello,
how can I be able to change the colored string in the messagebar in run-time:
Private Sub CreateMessageBar()
Dim MessageBar As MessageBar Set MessageBar = CommandBars.MessageBar MessageBar.Visible = True
MessageBar.AddCloseButton "close..." MessageBar.AddButton 1000, "Options...", "Show more options" MessageBar.Message = _ "<StackPanel Orientation='Horizontal'>" & _ " <Image Source='10000'/>" & _ " <TextBlock Padding='3, 0, 0, 0' VerticalAlignment='Center'><Bold>Informations</Bold></TextBlock>" & _ " <TextBlock Padding='10, 0, 0, 0' VerticalAlignment='Center'>About the message.</TextBlock>" & _ "</StackPanel>" End Sub thank you
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi,
You can replace Message string with new markup:
MessageBar.Message = _
"<StackPanel Orientation='Horizontal'>" & _ " <Image Source='10000'/>" & _ " <TextBlock Padding='3, 0, 0, 0' VerticalAlignment='Center'><Bold>Informations</Bold></TextBlock>" & _ " <TextBlock Padding='10, 0, 0, 0' VerticalAlignment='Center' Foreground='Red'>About the message.</TextBlock>" & _ "</StackPanel>" |
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Bernie
Senior Member Joined: 05 July 2007 Location: Taiwan Status: Offline Points: 109 |
Post Options
Thanks(0)
|
Try my Code:
Public Sub ShowMessage(ByVal MSG As String, Optional ByVal TextColor As String = "'Red'", Optional ByVal IsVisible As Boolean = True, Optional ByVal ButtonCaption As String)
MSGBar.Message = "<StackPanel Orientation='Horizontal'><TextBlock Padding='8, 0, 0, 0' FontSize='12' Foreground='" & TextColor & "'>" & MSG & "</TextBlock></StackPanel>" MSGBar.Visible = IsVisible If ButtonCaption <> "" Then MSGBar.AddButton 801, ButtonCaption, ButtonCaption Else MSGBar.RemoveButtons End If End Sub |
|
Bernie Ho, Planning Manager + IELTS specialist + part-time programmer
Taiwan, R.O.C |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |