Solved

Vb.net 2008

Posted on 2016-08-29
2
59 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

809 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