Solved

Vb.net 2008

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

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.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
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…

732 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