本文整理汇总了C#中System.Windows.Forms.MouseEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# MouseEventArgs类的具体用法?C# MouseEventArgs怎么用?C# MouseEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MouseEventArgs类属于System.Windows.Forms命名空间,在下文中一共展示了MouseEventArgs类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Form1_Load
private void Form1_Load(object sender, EventArgs e)
{
// This line suppresses the default context menu for the TextBox control.
textBox1.ContextMenu = new ContextMenu();
textBox1.MouseDown += new MouseEventHandler(textBox1_MouseDown);
}
void textBox1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
{
textBox1.Select(0, textBox1.Text.Length);
}
}
示例2: EnableDrawing
Point firstPoint;
Boolean haveFirstPoint;
public void EnableDrawing()
{
this.MouseDown += new MouseEventHandler(Form1_MouseDownDrawing);
}
void Form1_MouseDownDrawing(object sender, System.Windows.Forms.MouseEventArgs e)
{
if (haveFirstPoint)
{
Graphics g = this.CreateGraphics();
g.DrawLine(Pens.Black, firstPoint, e.Location);
haveFirstPoint = false;
}
else
{
firstPoint = e.Location;
haveFirstPoint = true;
}
}
示例3: TrackCoordinates
ToolTip trackTip;
private void TrackCoordinates()
{
trackTip = new ToolTip();
this.MouseMove += new MouseEventHandler(Form1_MouseMove);
}
void Form1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
String tipText = String.Format("({0}, {1})", e.X, e.Y);
trackTip.Show(tipText, this, e.Location);
}