Files

77 lines
1.9 KiB
C#

using System;
using System.Drawing;
using System.Windows.Forms;
namespace UserControlClass
{
public partial class LabPictureControl : UserControl
{
public LabPictureControl()
{
InitializeComponent();
}
/// <summary>
/// 添加LabelText属性,可以对labelText进行设置
/// </summary>
public string LabelText
{
get { return labText.Text; }
set { labText.Text = value; }
}
/// <summary>
/// 上面Label的图片图片连接
/// </summary>
public Image LabelTopImage
{
get { return labPicture.Image; }
set { labPicture.Image = value; }
}
/// <summary>
/// 文字位置坐标
/// </summary>
public Point LabelPoint
{
get { return labText.Location; }
set { labText.Location = value; }
}
private void labPicture_MouseHover(object sender, EventArgs e)
{
LabPictureControl lpc = (LabPictureControl)(sender as Label).Parent;
lpc.BackColor = Color.FromArgb(0, 151, 186);
}
private void labPicture_MouseLeave(object sender, EventArgs e)
{
LabPictureControl lpc = (LabPictureControl)(sender as Label).Parent;
lpc.BackColor = Color.FromArgb(19, 46, 53);
}
private void labText_MouseHover(object sender, EventArgs e)
{
LabPictureControl lpc = (LabPictureControl)(sender as Label).Parent;
lpc.BackColor = Color.FromArgb(0, 151, 186);
}
private void labText_MouseLeave(object sender, EventArgs e)
{
LabPictureControl lpc = (LabPictureControl)(sender as Label).Parent;
lpc.BackColor = Color.FromArgb(19, 46, 53);
}
private void LabPictureControl_MouseHover(object sender, EventArgs e)
{
LabPictureControl lpc = sender as LabPictureControl;
lpc.BackColor = Color.FromArgb(0, 151, 186);
}
private void LabPictureControl_MouseLeave(object sender, EventArgs e)
{
LabPictureControl lpc = sender as LabPictureControl;
lpc.BackColor = Color.FromArgb(19, 46, 53);
}
}
}