473,544 Members | 1,962 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2328
Example originally from Microsoft
http://home.comcast.net/~kevininstru...nu_Example.zip

"S. Viswanathan" <vi**@ewaksoft. comwrote in message
news:%2******** *******@TK2MSFT NGP06.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 IExtenderProvid er that extends the menu items
and/or toolstrip items or other objects to handle this
"ke************ *@state.or.us" <Ke************ ***@state.or.us wrote in
message news:OE******** ******@TK2MSFTN GP02.phx.gbl...
Example originally from Microsoft
http://home.comcast.net/~kevininstru...nu_Example.zip

"S. Viswanathan" <vi**@ewaksoft. comwrote in message
news:%2******** *******@TK2MSFT NGP06.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.Viswanatha n



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

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(Fals e)unless someone else knows how to fix this issue.
Otherwise an excellent idea.

Imports System
Imports System.Collecti ons
Imports System.Componen tModel
Imports System.Windows. Forms
<System.Drawing .ToolboxBitmap( GetType(System. Windows.Forms.S tatusBar))_
<ProvidePropert y("StatusMessag e", GetType(Compone nt))_
<Description("T ool tip to display in your statusbar")_
Public Class StatusMessage
Inherits Component
Implements IExtenderProvid er

Dim mControlLookup As Hashtable = New Hashtable
Dim mLastMessage As String = String.Empty
Public Sub SetStatusMessag e(ByVal senderComponent As Component, ByVal
strMessage As String)
If Not mControlLookup. Contains(sender Component) Then
mControlLookup. Add(senderCompo nent, strMessage)
Dim pMenuItem As ToolStripMenuIt em = CType(senderCom ponent,
ToolStripMenuIt em)
If pMenuItem IsNot Nothing Then
AddHandler pMenuItem.Mouse Move, AddressOf Handle_MenuSele ct
AddHandler pMenuItem.Mouse Leave, AddressOf Handle_MenuLeav e
AddHandler pMenuItem.Mouse Enter, AddressOf Handle_MenuEnte r
Else
' Bug
mControlLookup( senderComponent ) = strMessage
End If
End If
End Sub
Public Function GetStatusMessag e(ByVal senderComponent As Component) As
String
If mControlLookup. Contains(sender Component) Then
Return mControlLookup( senderComponent ).ToString
End If
Return String.Empty
End Function

Public Function CanExtend(ByVal senderComponent As Object) As Boolean
Implements System.Componen tModel.IExtende rProvider.CanEx tend
Return TypeOf senderComponent Is ToolStripMenuIt em
End Function

Private mStatusBar As ToolStripStatus Label

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

Private Sub Handle_MenuSele ct(ByVal pControl As Object, ByVal e As
MouseEventArgs)

If StatusBar Is Nothing Then
Exit Sub
End If

If mControlLookup. Contains(pContr ol) Then
If Not mControlLookup( pControl).ToStr ing.Trim = String.Empty Then
StatusBar.Text = mControlLookup( pControl).ToStr ing
End If
End If
End Sub

Private Sub Handle_MenuLeav e(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_MenuEnte r(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******** ******@TK2MSFTN GP05.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 IExtenderProvid er that extends the menu
items and/or toolstrip items or other objects to handle this
"ke************ *@state.or.us" <Ke************ ***@state.or.us wrote in
message news:OE******** ******@TK2MSFTN GP02.phx.gbl...
>Example originally from Microsoft
http://home.comcast.net/~kevininstru...nu_Example.zip

"S. Viswanathan" <vi**@ewaksoft. comwrote in message
news:%2******* ********@TK2MSF TNGP06.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.Viswanath an




Aug 9 '07 #4

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

Similar topics

4
2364
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
2474
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 statusbar. Yet FF gives me both a statusbar and the window is resizable! Does this mean that FF does not support these "features" or is there a...
1
2558
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 panel of statusbar on runtime. Any help ?
3
3641
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 statusbar panels to public and shared in VS.net's property box it will work. However, whenever I make any modifications to the main form it will...
9
2072
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 working with StatusBar.Text? Thanks in Advance, Christian Blackburn My Code: Public Class frmMain
6
1512
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 System.Drawing.Icon(System.IO.Path.Combine(Application.StartupPath, "Icon2.ico"))
14
2118
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. once i clic on online its icon changes to connecticon (assume its there) and whenever i click on offline, its icon changes to disconnection (assume...
1
2682
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
7361
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7601
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7763
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7365
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7701
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5901
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
4908
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3404
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3402
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.