Button.MouseHover
Option Strict On
imports System
imports System.Drawing
imports System.Windows.Forms
public class MouseEnterHoverLeave : inherits Form
private btn as Button
public sub New()
Size = new Size(400,400)
btn = new Button()
btn.Parent = me
btn.Location = new Point(50,50)
btn.Size = new Size(150,25)
AddHandler btn.MouseEnter, AddressOf btn_MouseEnter
AddHandler btn.MouseHover, AddressOf btn_MouseHover
AddHandler btn.MouseLeave, AddressOf btn_MouseLeave
end sub
public shared sub Main()
Application.Run(new MouseEnterHoverLeave())
end sub
private sub btn_MouseEnter(ByVal sender as object,ByVal e as EventArgs)
btn.Text = "MouseEnter"
Console.WriteLine("Button MouseEnter")
end sub
private sub btn_MouseHover(ByVal sender as object,ByVal e as EventArgs)
btn.Text = "MouseHover"
Console.WriteLine("Button MouseHover")
end sub
private sub btn_MouseLeave(ByVal sender as object,ByVal e as EventArgs)
btn.Text = "MouseLeave"
Console.WriteLine("Button MouseLeave")
end sub
protected overrides sub OnMouseEnter(ByVal e as EventArgs)
myBase.OnMouseEnter(e)
Console.WriteLine("Form MouseEnter")
end sub
protected overrides sub OnMouseHover(ByVal e as EventArgs)
myBase.OnMouseHover(e)
Console.WriteLine("Form MouseHover")
end sub
protected overrides sub OnMouseLeave(ByVal e as EventArgs)
myBase.OnMouseLeave(e)
Console.WriteLine("Form MouseLeave")
end sub
end class
Related examples in the same category