?
Solved

Vb.net 2008

Posted on 2016-08-29
2
Medium Priority
?
89 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 2000 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month10 days, 12 hours left to enroll

764 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