1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
private void label1_MouseHover(object sender, EventArgs e)
{
foreach (Control lbl in Controls)
{
if (lbl.Name.Contains("lbl"))
{
//Errechnet die Position des Mauszeigers
//die Position über welchem Label sich der //Zeiger befindet
Point mousePosition = PointToClient(new Point(MousePosition.X, MousePosition.Y));
//Wenn der Zeiger innerhalb des Bereiches //des Labels ist
//über welchem er sich befindet
if (lbl.Location.X <= mousePosition.X && lbl.Location.Y <= mousePosition.Y && mousePosition.X <= lbl.Location.X + lbl.Width && mousePosition.Y <= lbl.Location.Y + lbl.Height)
{
MessageBox.Show(label1.text.ToString();
}
}
|