mirror of
https://github.com/BluePointLilac/ContextMenuManager.git
synced 2026-01-14 06:04:00 +08:00
还原之前的版本,还原前MouseLeave事件不能完美触发
This commit is contained in:
@@ -74,15 +74,15 @@ namespace BulePointLilac.Controls
|
||||
this.Image = image;
|
||||
this.Text = text;
|
||||
MyToolTip.SetToolTip(this, text);
|
||||
ThroughControl(picImage);
|
||||
ThroughControl(lblText);
|
||||
lblText.SetEnabled(false);
|
||||
}
|
||||
|
||||
readonly PictureBox picImage = new PictureBox
|
||||
{
|
||||
SizeMode = PictureBoxSizeMode.StretchImage,
|
||||
Size = new Size(40, 40).DpiZoom(),
|
||||
BackColor = Color.Transparent
|
||||
BackColor = Color.Transparent,
|
||||
Enabled = false
|
||||
};
|
||||
|
||||
readonly Label lblText = new Label
|
||||
@@ -93,6 +93,8 @@ namespace BulePointLilac.Controls
|
||||
ForeColor = Color.White
|
||||
};
|
||||
|
||||
private static Label LblText = new Label();
|
||||
|
||||
public Image Image
|
||||
{
|
||||
get => picImage.Image;
|
||||
@@ -108,17 +110,5 @@ namespace BulePointLilac.Controls
|
||||
get => BackColor.A / 255;
|
||||
set => BackColor = Color.FromArgb((int)(value * 255), Color.White);
|
||||
}
|
||||
|
||||
private void ThroughControl(Control ctr)
|
||||
{
|
||||
MouseEventArgs getAbsArgs(MouseEventArgs e)
|
||||
{
|
||||
return new MouseEventArgs(e.Button, e.Clicks, ctr.Left + e.X, ctr.Top + e.Y, e.Delta);
|
||||
}
|
||||
ctr.MouseDown += (sender, e) => this.OnMouseDown(getAbsArgs(e));
|
||||
ctr.MouseMove += (sender, e) => this.OnMouseMove(getAbsArgs(e));
|
||||
ctr.MouseEnter += (sender, e) => this.OnMouseEnter(e);
|
||||
MyToolTip.SetToolTip(ctr, this.Text);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user