473,320 Members | 2,003 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Statusbar and menu

Hi everybody!

In VB.NET 2005, MenuStrip and Statusstrip controls added. When the mouse
over on the Menuitem its corresponding Tooptip text should be displayed in
the statusstrip.

How to display the statusstrip text while mouseover on the menuitem?

--
Thanks
S.Viswanathan
Aug 8 '07 #1
3 2315
Example originally from Microsoft
http://home.comcast.net/~kevininstru...nu_Example.zip

"S. Viswanathan" <vi**@ewaksoft.comwrote in message
news:%2***************@TK2MSFTNGP06.phx.gbl...
Hi everybody!

In VB.NET 2005, MenuStrip and Statusstrip controls added. When the mouse
over on the Menuitem its corresponding Tooptip text should be displayed in
the statusstrip.

How to display the statusstrip text while mouseover on the menuitem?

--
Thanks
S.Viswanathan


Aug 8 '07 #2
There are much better ways of doing it...

http://forums.microsoft.com/MSDN/Sho...32007&SiteID=1

better way to do it... make an IExtenderProvider that extends the menu items
and/or toolstrip items or other objects to handle this
"ke*************@state.or.us" <Ke***************@state.or.uswrote in
message news:OE**************@TK2MSFTNGP02.phx.gbl...
Example originally from Microsoft
http://home.comcast.net/~kevininstru...nu_Example.zip

"S. Viswanathan" <vi**@ewaksoft.comwrote in message
news:%2***************@TK2MSFTNGP06.phx.gbl...
>Hi everybody!

In VB.NET 2005, MenuStrip and Statusstrip controls added. When the mouse
over on the Menuitem its corresponding Tooptip text should be displayed
in
the statusstrip.

How to display the statusstrip text while mouseover on the menuitem?

--
Thanks
S.Viswanathan



Aug 9 '07 #3
I like it although it is flawed in SetStatusMessage.

1. Add the component, menu and statusbar to a form
2. Create a menu item, set the tool tip.
3. Move off the the propery StatusMessage
4. Move back to the propery and change the text.
5. Move off, the original text is retained.

As coded I would only code the tips via code and mark that propery as
<Browsable(False)unless someone else knows how to fix this issue.
Otherwise an excellent idea.

Imports System
Imports System.Collections
Imports System.ComponentModel
Imports System.Windows.Forms
<System.Drawing.ToolboxBitmap(GetType(System.Windo ws.Forms.StatusBar))_
<ProvideProperty("StatusMessage", GetType(Component))_
<Description("Tool tip to display in your statusbar")_
Public Class StatusMessage
Inherits Component
Implements IExtenderProvider

Dim mControlLookup As Hashtable = New Hashtable
Dim mLastMessage As String = String.Empty
Public Sub SetStatusMessage(ByVal senderComponent As Component, ByVal
strMessage As String)
If Not mControlLookup.Contains(senderComponent) Then
mControlLookup.Add(senderComponent, strMessage)
Dim pMenuItem As ToolStripMenuItem = CType(senderComponent,
ToolStripMenuItem)
If pMenuItem IsNot Nothing Then
AddHandler pMenuItem.MouseMove, AddressOf Handle_MenuSelect
AddHandler pMenuItem.MouseLeave, AddressOf Handle_MenuLeave
AddHandler pMenuItem.MouseEnter, AddressOf Handle_MenuEnter
Else
' Bug
mControlLookup(senderComponent) = strMessage
End If
End If
End Sub
Public Function GetStatusMessage(ByVal senderComponent As Component) As
String
If mControlLookup.Contains(senderComponent) Then
Return mControlLookup(senderComponent).ToString
End If
Return String.Empty
End Function

Public Function CanExtend(ByVal senderComponent As Object) As Boolean
Implements System.ComponentModel.IExtenderProvider.CanExtend
Return TypeOf senderComponent Is ToolStripMenuItem
End Function

Private mStatusBar As ToolStripStatusLabel

Public Property StatusBar() As ToolStripStatusLabel
Get
Return mStatusBar
End Get
Set(ByVal value As ToolStripStatusLabel)
mStatusBar = value
End Set
End Property

Private Sub Handle_MenuSelect(ByVal pControl As Object, ByVal e As
MouseEventArgs)

If StatusBar Is Nothing Then
Exit Sub
End If

If mControlLookup.Contains(pControl) Then
If Not mControlLookup(pControl).ToString.Trim = String.Empty Then
StatusBar.Text = mControlLookup(pControl).ToString
End If
End If
End Sub

Private Sub Handle_MenuLeave(ByVal pControl As Object, ByVal e As
EventArgs)
If StatusBar Is Nothing Then
Exit Sub
End If
StatusBar.Text = Me.mLastMessage
End Sub

Private Sub Handle_MenuEnter(ByVal pControl As Object, ByVal e As
EventArgs)
If StatusBar Is Nothing Then
Exit Sub
End If
Me.mLastMessage = StatusBar.Text
End Sub
End Class
"Smokey Grindel" <no****@nospam.comwrote in message
news:ud**************@TK2MSFTNGP05.phx.gbl...
There are much better ways of doing it...

http://forums.microsoft.com/MSDN/Sho...32007&SiteID=1

better way to do it... make an IExtenderProvider that extends the menu
items and/or toolstrip items or other objects to handle this
"ke*************@state.or.us" <Ke***************@state.or.uswrote in
message news:OE**************@TK2MSFTNGP02.phx.gbl...
>Example originally from Microsoft
http://home.comcast.net/~kevininstru...nu_Example.zip

"S. Viswanathan" <vi**@ewaksoft.comwrote in message
news:%2***************@TK2MSFTNGP06.phx.gbl...
>>Hi everybody!

In VB.NET 2005, MenuStrip and Statusstrip controls added. When the mouse
over on the Menuitem its corresponding Tooptip text should be displayed
in
the statusstrip.

How to display the statusstrip text while mouseover on the menuitem?

--
Thanks
S.Viswanathan




Aug 9 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Tonya | last post by:
Hi, Does anyone know how i can add controls to a progress bar. I have searched the internet but could not find any examples. what i want to add is a progress bar and a button. thx
18
by: Andrew Poulos | last post by:
If I manage to call the following bit of javascript in IE and MZ w = window.open("", "s", 'status=no,resizable=no,width=450,height=450'); I get a window that is not resizable and without a...
1
by: Ahmet | last post by:
In my application, I have statusbar on which i show icons. On some cases, I have to change icon of my statusbar to show different messages on panels. But I dont know how to change icon of one...
3
by: TonyM | last post by:
Hi all, I have an application with a few different Windows forms. I am trying to update a statusbar panel's text that is in the main form, from another form. When I set the statusbar and the...
9
by: Christian Blackburn | last post by:
Hi Gang, I've had this happen with a couple of controls now, but my patience has worn thin. Can somebody tell me why I can read/write to most objects on my form from my module, but not when...
6
by: Anony | last post by:
Hi All, I have two icons: Private micoIcon1 As New System.Drawing.Icon(System.IO.Path.Combine(Application.StartupPath, "Icon1.ico")) Private micoIcon2 As New...
14
by: Kishan Hathiwala | last post by:
Hi i have kept a statusbar in the form with panels = true. and total there 3 panels. whenever i click on the 3rd panel a menu appears showing online and offline and either is enable at a time....
1
by: herve | last post by:
Hi, everybody I'm working with wxPython 2.8.1.1. Does anybody know how to change the foreground colors in a wx.StatusBar
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.