本文整理汇总了C#中MouseEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# MouseEventArgs类的具体用法?C# MouseEventArgs怎么用?C# MouseEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MouseEventArgs类属于命名空间,在下文中一共展示了MouseEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: bcpAdd_MouseDown
private void bcpAdd_MouseDown(object sender, MouseEventArgs e)
{
moveAble = true;
left = Cursor.Position.X;
top = Cursor.Position.Y;
}
示例2: ItemView_MouseMove
private void ItemView_MouseMove(object sender, MouseEventArgs e)
{
int truex = e.X - 6;
int truey = e.Y - 36;
if (truex > 5 && truey > 3 && truex < 315 + 5 && truey < 318 + 3)
{
int temp = (truex - 8)*10/315 + (truey - 5)*10/318*10;
if (temp != tar)
{
tar = temp;
if (baseid + tar < UserProfile.InfoBag.BagCount && UserProfile.InfoBag.Items[baseid + tar].Type != 0)
{
Image image = HItemBook.GetPreview(UserProfile.InfoBag.Items[baseid + tar].Type);
tooltip.Show(image, this, (tar%10)*315/10 + 42, (tar/10)*318/10 + 42);
}
else
{
tooltip.Hide(this);
}
Invalidate(new Rectangle(6, 36, 324, 324));
}
}
else
{
tar = -1;
tooltip.Hide(this);
Invalidate(new Rectangle(6, 36, 324, 324));
}
}
示例3: OnMouseDown
protected override void OnMouseDown(MouseEventArgs e)
{
_startPoint = e.Location;
_hscrolloffset = LayoutTarget.HorizontalScroll.Value;
_vscrolloffset = LayoutTarget.VerticalScroll.Value;
base.OnMouseDown(e);
}
示例4: OnMouseDown
protected override void OnMouseDown(MouseEventArgs e)
{
// get the index of the clicked item
_rowIndexFromMouseDown = HitTest(e.X, e.Y).RowIndex;
// basic mouse handling has right clicks show context menu without changing selection, so we handle it manually here
if (e.Button == MouseButtons.Right)
HandleRightMouseDown(e);
// call the base class, so that the row gets selected, etc.
base.OnMouseDown(e);
if (_rowIndexFromMouseDown > -1)
{
// Remember the point where the mouse down occurred.
// The DragSize indicates the size that the mouse can move
// before a drag event should be started.
Size dragSize = SystemInformation.DragSize;
// Create a rectangle using the DragSize, with the mouse position being
// at the center of the rectangle.
_dragBoxFromMouseDown = new Rectangle(new Point(e.X - (dragSize.Width/2), e.Y - (dragSize.Height/2)), dragSize);
}
else
{
// Reset the rectangle if the mouse is not over an item in the ListBox.
_dragBoxFromMouseDown = Rectangle.Empty;
}
}
示例5: pictureBox1_MouseMove
private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
{
//lab12_1
/*Point p = pictureBox1.Location; // позиция левого верхнего угла pictureBox1
Point p1 = this.Location; // позиция левого верхнего угла формы
// e.X и e.Y позиция курсора в pictureBox1
int XX, YY;
XX = e.X + p.X + p1.X; YY = e.Y + p.Y + p1.Y;
toolTip1.ToolTipTitle = Convert.ToString(XX) + "; " + Convert.ToString(YY);
toolTip1.SetToolTip(this.pictureBox1, " ");*/
//lab12_2
Point p = pictureBox1.Location; // позиция левого верхнего угла pictureBox1
Point p1 = this.Location; // позиция левого верхнего угла формы
// e.X и e.Y позиция курсора в pictureBox1
int XX, YY;
XX = e.X + p.X + p1.X; YY = e.Y + p.Y + p1.Y;
/*Bitmap bmp = new Bitmap(1, 1);
using (Graphics g = Graphics.FromImage(bmp))
{ g.CopyFromScreen(XX, YY, 0, 0, new Size(1, 1)); }
Color color = bmp.GetPixel(0, 0);
string SS;
SS = Convert.ToString(color);
toolTip1.ToolTipTitle = SS;*/
toolTip1.ToolTipTitle = "x=" + Convert.ToString(XX) + "; " + "y=" + Convert.ToString(YY);
toolTip1.SetToolTip(this.pictureBox1, " ");
}
示例6: OnMouseDown
protected override void OnMouseDown(MouseEventArgs e)
{
Point screenPoint = PointToScreen(new Point(e.X, e.Y));
Win32.HitTest ht = DoHitTest(e.X, e.Y);
Win32.ReleaseCapture();
Win32.SendMessage(Handle, Win32.WM_NCLBUTTONDOWN, (int)ht, (int)(screenPoint.Y << 16 | screenPoint.X));
}
示例7: Form1_MouseClick
private void Form1_MouseClick(object sender, MouseEventArgs e)
{
int col = getCoord(e.X);
int row = getCoord(e.Y);
if (e.Button == MouseButtons.Left)
{
if (row >= 0 && col >= 0)
{
if (board.isSafe(row, col) && !board.getHasQ(row, col))
{
board.setHasQ(row, col, true, hint);
this.Invalidate();
if (board.getNumQueens() == 8)
{
System.Windows.Forms.MessageBox.Show("Congratulations! You did it!");
}
}
else
{
System.Media.SystemSounds.Beep.Play();
}
}
}
else if (e.Button == MouseButtons.Right)
{
if (row >= 0 && col >= 0 && board.getHasQ(row, col))
{
board.setHasQ(row, col, false, hint);
this.Invalidate();
}
}
}
示例8: ProjectCanvas_MouseMove
private void ProjectCanvas_MouseMove(object sender, MouseEventArgs e)
{
int x = e.X;
int y = e.Y;
if (CurrentlySelected == null)
{
return;
}
//Move component to mouse position
CurrentlySelected.Center = new Coordinate(
e.X - e.X % ProjectCanvas.GridRaster,
e.Y - e.Y % ProjectCanvas.GridRaster);
//Align the component with the grid
if (CurrentlySelected.Position.X % ProjectCanvas.GridRaster != 0)
{
CurrentlySelected.Position.X -= CurrentlySelected.Position.X % ProjectCanvas.GridRaster;
}
if(CurrentlySelected.Position.Y % ProjectCanvas.GridRaster != 0)
{
CurrentlySelected.Position.Y -= CurrentlySelected.Position.Y % ProjectCanvas.GridRaster;
}
}
示例9: lc
private void lc(object sender, MouseEventArgs e)
{
c.Open();
DataSet ds = new DataSet();
string query = "select ID,pname,bill,pbill from pdetails where [email protected] ";
OleDbCommand cmd = new OleDbCommand(query, c);
cmd.Parameters.Add("@bc", OleDbType.Date).Value = dateTimePicker1.Value.Date;
OleDbDataReader dr = cmd.ExecuteReader();
DataTable dt = new DataTable();
dt.Load(dr);
/*ds.Tables.Add(dt);
OleDbDataAdapter da = new OleDbDataAdapter();
da.Fill(dt);*/
dataGridView1.DataSource = dt.DefaultView;
c.Close();
try
{
c.Open();
String str = @"SELECT SUM(pbill) FROM pdetails WHERE [email protected];";
OleDbCommand comm2 = new OleDbCommand(str, c);
comm2.Parameters.Add("@bb", OleDbType.Date).Value = dateTimePicker1.Value.Date;
bill = Convert.ToDouble(comm2.ExecuteScalar());
label3.Text = bill.ToString() + "/-";
}
catch(Exception ex)
{
MessageBox.Show("selected date miss match");
c.Close();
}
c.Close();
}
示例10: MainForm_MouseClick
private void MainForm_MouseClick(object sender, MouseEventArgs e)
{
if (!this.timer.Enabled)
{
this.Start();
}
}
示例11: panel_Title_MouseDown
private void panel_Title_MouseDown(object sender, MouseEventArgs e)
{
int Tem_Y = 0;
if (e.Button == MouseButtons.Left)//按下的是否为鼠标左键
{
Cla_FrmClass.FrmBackCheck();//检测各窗体是否连在一起
Tem_Y = e.Y;
FrmClass.FrmPoint = new Point(e.X, Tem_Y);//获取鼠标在窗体上的位置,用于磁性窗体
FrmClass.CPoint = new Point(-e.X, -Tem_Y);//获取鼠标在屏幕上的位置,用于窗体的移动
if (FrmClass.Example_List_AdhereTo)//如果与frm_ListBox窗体相连接
{
Cla_FrmClass.FrmDistanceJob(this, F_List);//计算窗体的距离差
if (FrmClass.Example_Assistant_AdhereTo)//两个辅窗体是否连接在一起
{
Cla_FrmClass.FrmDistanceJob(this, F_Libretto);//计算窗体的距离差
}
}
if (FrmClass.Example_Libretto_AdhereTo)//如果与frm_Libretto窗体相连接
{
Cla_FrmClass.FrmDistanceJob(this, F_Libretto);//计算窗体的距离差
if (FrmClass.Example_Assistant_AdhereTo)//两个辅窗体是否连接在一起
{
Cla_FrmClass.FrmDistanceJob(this, F_List);//计算窗体的距离差
}
}
}
}
示例12: UpdateLabel
public void UpdateLabel(object sender, MouseEventArgs e)
{
if(( e.X % 10 == 0 || e.Y % 10 == 0)
|| ((e.Button & MouseButtons.Left) == MouseButtons.Left
&& (e.Button & MouseButtons.Right) == MouseButtons.Right))
display.Text = string.Format("X: {0}, Y: {1}, Button: {2}", e.X, e.Y, e.Button);
}
示例13: pictureBox1_MouseDown
private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
{
Caja = new RectangleF((int)((e.X - MedCambiante.X) / (trackBar1.Value / 100.0f)),
(int)((e.Y - MedCambiante.Y) / (trackBar1.Value / 100.0f)), 0, 0);
label1.Text = "X= " + Caja.X;
label2.Text = "Y= " + Caja.Y;
}
示例14: mouseListner_MouseDown
void mouseListner_MouseDown(object sender, MouseEventArgs e)
{
lastMouseDownPoint = e.Location;
lastMouseDownSize = sizeChangeCtrl.Size;
//動作を決定
status = DAndDArea.None;
if (getTop().Contains(e.Location))
{
status |= DAndDArea.Top;
}
if (getLeft().Contains(e.Location))
{
status |= DAndDArea.Left;
}
if (getBottom().Contains(e.Location))
{
status |= DAndDArea.Bottom;
}
if (getRight().Contains(e.Location))
{
status |= DAndDArea.Right;
}
if (status != DAndDArea.None)
{
mouseListner.Capture = true;
}
}
示例15: gridView1_MouseDown
private void gridView1_MouseDown(object sender, MouseEventArgs e)
{
_HitInfo = gridView1.CalcHitInfo(new Point(e.X, e.Y));
HealthInst = ((HealthInstitutionBE)gridView1.GetRow(_HitInfo.RowHandle));
}