Solved

Vb.net 2008

Posted on 2016-08-29
2
61 Views
Last Modified: 2016-08-30
Hi Experts

I am using a system.users.forms.usercontrol called Block
and adding visual basic Power pack rectangle shape to show a round form called mPilon
I want to add a tooltip to the rectangle shape to show when you hover over it
can it be done
attached is the code

        Public ShapeContainer1 As New Microsoft.VisualBasic.PowerPacks.ShapeContainer
        Public WithEvents mPilon As New Microsoft.VisualBasic.PowerPacks.RectangleShape

        Private tooltipfont As New Font("Arial", 16)
        Private mToolTip As ToolTip = New ToolTip
        Private mToolTipLabel As New Label
        Friend WithEvents ToolTip1 As System.Windows.Forms.ToolTip
        Private components As System.ComponentModel.IContainer


        ''' <summary>
        ''' constructor
        ''' </summary>
        Public Sub New(ByVal id As Integer)
            MyBase.New()
            Me.BackColor = Color.Wheat
            Me.SetStyle(ControlStyles.DoubleBuffer _
                Or ControlStyles.UserPaint _
                Or ControlStyles.AllPaintingInWmPaint _
                Or ControlStyles.SupportsTransparentBackColor, _
                True)
            Me.TextAlign = ContentAlignment.MiddleCenter

            'MF-Circle
            mPilon.Visible = False

                Me.SuspendLayout()
                '
                'ShapeContainer1
                '
                ShapeContainer1.Location = New System.Drawing.Point(0, 0)
                ShapeContainer1.Margin = New System.Windows.Forms.Padding(0)
                ShapeContainer1.Name = "ShapeContainer1"
                ShapeContainer1.Shapes.AddRange(New Microsoft.VisualBasic.PowerPacks.Shape() {mPilon})
                ShapeContainer1.Size = New System.Drawing.Size(150, 150)
                ShapeContainer1.TabIndex = 0
                ShapeContainer1.TabStop = False
                '
                'mPilar
                '
                mPilon.Location = New System.Drawing.Point(44, 37)
                mPilon.Name = "mPilon"
                mPilon.Size = New System.Drawing.Size(41, 34)
                mPilon.Visible = False
                mPilon.FillStyle = Microsoft.VisualBasic.PowerPacks.FillStyle.Percent75
                '
                'Block
                '
                Controls.Add(ShapeContainer1)
                Me.Name = "Block"
                Me.ResumeLayout(False)
                Me.Height = 18
                Me.Width = 18
                mPilon.Left = Me.Left + 2
                mPilon.Top = Me.Top + 2
                mPilon.Visible = True
                mPilon.Height = Me.Height - 5
                mPilon.Width = Me.Width - 5
                mPilon.CornerRadius = CInt(mPilon.Width / 2.0)

                Me.BackColor = Color.Transparent

            End If

        End Sub


        Public Sub mPilon__MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) _
        Handles mPilon.MouseHover

            Dim tip As String = "Im Hovering over the rounded form"
            mToolTip.AutoPopDelay = 50000


            How do you display it 


        End Sub

Open in new window

0
Comment
Question by:Kevinfeening
2 Comments
 
LVL 20

Expert Comment

by:ElrondCT
ID: 41776602
In the initialization code for your form (New, after the controls are created, or form Load event), put:
mToolTip.SetToolTip(mPilon, "I'm Hovering over the rounded form")

Open in new window

You do NOT need to handle the MouseHover event; that's done automatically by the ToolTip control.
0
 
LVL 11

Accepted Solution

by:
louisfr earned 500 total points
ID: 41776692
A RectangleShape is not a Control; the SetToolTip won't work.
You can show the tooltip on Enter and hide it on Leave:
    Private Sub mPilon_MouseEnter(sender As Object, e As EventArgs) Handles mPilon.MouseEnter
        mToolTip.Show("Im Hovering over the rounded form", Me, MousePosition - Location)
    End Sub

    Private Sub mPilon_MouseLeave(sender As Object, e As EventArgs) Handles mPilon.MouseLeave
        mToolTip.Hide(Me)
    End Sub

Open in new window

0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question