Solved

Vb.net 2008

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
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…

757 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now