Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27554

[RESOLVED] mouse enter event add btn

$
0
0
hi i have a table layout panel that adds controls "pictureboxs" using drag drop event that all works fine but now i am attempting to add a delete btn on the picture box using mouse enter later ill use mouse leave to destroy the delete btn.

Any way ive gave it a shot spent almost all day on it and i give up so asking for some help this is the method i attempted but nothing happens and i get no errors.

my picturebox class
Code:

Public Class ctl_imageholders

    Inherits Windows.Forms.PictureBox


    Public Sub New()

        Me.Size = New Size(205, 244)
        Me.Location = New Point(100, 100)
        Me.SizeMode = PictureBoxSizeMode.CenterImage
        Me.BackgroundImage = My.Resources.image_frame_normal_fw
        Me.BackgroundImageLayout = ImageLayout.Center
        Me.SizeMode = PictureBoxSizeMode.CenterImage
        Me.Padding = New Padding(10, 10, 10, 30)

    End Sub

    Private Sub cls_item_box_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.MouseEnter

        Me.BackgroundImage = My.Resources.image_frame_focus_fw
        Me.add_delete_btn()
        Me.Invalidate()

    End Sub

    Private Sub cls_item_box_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.MouseLeave

        Me.BackgroundImage = My.Resources.image_frame_normal_fw

        Me.Invalidate()

    End Sub


    Private Sub add_delete_btn()

        Dim dltbtn As New btn_delete
        Dim dely As Integer = (Index.ClientSize.Width - Me.Width) / 2
        Dim delx As Integer = (Index.ClientSize.Height - Me.Height) / 2
        Dim del_Points As Point = New Point(delx, dely)

        dltbtn.Size = New Size(10, 10)
        dltbtn.Location = del_Points


    End Sub


    Private Sub add_view_btn()


    End Sub

End Class

any help would be greatly appreciated.

Viewing all articles
Browse latest Browse all 27554

Trending Articles