private void Form1_MouseClick(object sender, MouseEventArgs e) { //mouse_x = e.X; //mouse_y = e.Y; //string str = "m_x: " + mouse_x + " m_y: " + mouse_y + " "; //this.label2.Text = str; }
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); }
private void bcpAdd_MouseDown(object sender, MouseEventArgs e) { moveAble = true; left = Cursor.Position.X; top = Cursor.Position.Y; }
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(); } } }
private void lc(object sender, MouseEventArgs e) { c.Open(); DataSet ds = new DataSet(); string query = "select ID,pname,bill,pbill from pdetails where date=@bc "; 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 date=@bb;"; 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(); }
protected override void OnMouseUp(MouseEventArgs e) { base.OnMouseUp(e); if (e.Button == MouseButtons.Left) SetVoxel(e.X, e.Y); }
private void gridView1_MouseDown(object sender, MouseEventArgs e) { _HitInfo = gridView1.CalcHitInfo(new Point(e.X, e.Y)); HealthInst = ((HealthInstitutionBE)gridView1.GetRow(_HitInfo.RowHandle)); }
private void Ctrl_MouseClick(object sender, MouseEventArgs e) { if (sender == home_pnl) { Home_Admin hm = new Home_Admin(); hm.giveMemberUserName(userName); hm.Show(); this.Hide(); } else if (sender == lock_pnl) { Home h = new Home(); h.Show(); this.Hide(); } else if (sender == minimized_pnl) { right_option_timer.Stop(); this.WindowState = FormWindowState.Minimized; } else if (sender == exit_pnl) { Application.Exit(); } }
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; } }
protected override void OnMouseMove(MouseEventArgs e) { base.OnMouseMove(e); bool over = ClientRectangle.Contains(e.X, e.Y); if (IsMouseOver != over) IsMouseOver = over; }
protected override void OnMouseDown(MouseEventArgs e) { var pos = new int2(e.X / TileSize, e.Y / TileSize); if (InputMode == null) { if (e.Button == MouseButtons.Left) { CurrentTemplate = Templates.FirstOrDefault(t => t.Cells.ContainsKey(pos)); if (CurrentTemplate == null) Templates.Add(CurrentTemplate = new Template { Cells = new Dictionary<int2, bool> { { pos, true } } }); Invalidate(); } if (e.Button == MouseButtons.Right) { Templates.RemoveAll(t => t.Cells.ContainsKey(pos)); CurrentTemplate = null; Invalidate(); } } else { TerrainTypes[pos.X, pos.Y] = int.Parse(InputMode); Invalidate(); } }
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)); } }
private void Picture_MouseDown(object sender, MouseEventArgs e) { isRightClicked = e.Button == MouseButtons.Right; try { if ((PaintingManager.CurrentTool is TwoPointTool) && !PaintingManager.CurrentTool.InUse) { ((TwoPointTool)PaintingManager.CurrentTool).StartPainting(e.Location); PaintingManager.File.IsModified = true; } InstantTool currentTool = PaintingManager.CurrentTool as InstantTool; if (currentTool != null) { currentTool.Paint(PaintingManager.Page.Picture, e.Location.X, e.Location.Y, isRightClicked? PaintingManager.CurrentTool.SecondaryColor: PaintingManager.CurrentTool.PrimaryColor, PaintingManager.Page.Picture.GetPixel(e.Location.X, e.Location.Y)); } MultiPointTool multiPointTool = PaintingManager.CurrentTool as MultiPointTool; if (multiPointTool != null) { multiPointTool.InUse = true; multiPointTool.PointsToDraw.Add(e.Location); } } catch (Exception exception) { MessageBox.Show(exception.Message + exception.StackTrace, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
protected override void OnMouseDown(MouseEventArgs e) { _startPoint = e.Location; _hscrolloffset = LayoutTarget.HorizontalScroll.Value; _vscrolloffset = LayoutTarget.VerticalScroll.Value; base.OnMouseDown(e); }
private void btnMove_MouseMove(object sender, MouseEventArgs e) { if (MouseDown_TF) { this.Location = new Point(this.Location.X + (e.X - oldMouseLoc.X), this.Location.Y + (e.Y - oldMouseLoc.Y)); } }
protected override void OnMouseMove(MouseEventArgs e) { if (e.Button == MouseButtons.None) { switch (DoHitTest(e.X, e.Y)) { case Win32.HitTest.HTTOP: case Win32.HitTest.HTBOTTOM: base.Cursor = Cursors.SizeNS; break; case Win32.HitTest.HTLEFT: case Win32.HitTest.HTRIGHT: base.Cursor = Cursors.SizeWE; break; case Win32.HitTest.HTTOPLEFT: case Win32.HitTest.HTBOTTOMRIGHT: base.Cursor = Cursors.SizeNWSE; break; case Win32.HitTest.HTTOPRIGHT: case Win32.HitTest.HTBOTTOMLEFT: base.Cursor = Cursors.SizeNESW; break; default: case Win32.HitTest.HTCLIENT: base.Cursor = base.DefaultCursor; base.OnMouseMove(e); break; } } }
private void UcLineScanSelection_MouseClick(object sender, MouseEventArgs e) { if (this.StartPoint != Point.Empty && this.EndPoint != Point.Empty) { this.StartPoint = Point.Empty; this.EndPoint = Point.Empty; } if (this.StartPoint == Point.Empty) this.StartPoint = e.Location; else this.EndPoint = e.Location; if (this.StartPoint != Point.Empty && this.EndPoint != Point.Empty) { Points.Clear(); int width = this.pictureBox.Width; if (this.SourceImage != null) width = this.SourceImage.Width; for (int x = 0; x < width; x++) { int y = this.CalcPoint(x); Points.Add(x, y); } this.pictureBox.Invalidate(); } }
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)); }
public override void mouseUp(ref MouseEventArgs e) { Console.WriteLine("call mouseUp " + _form1._mode); if (_form1._mode == EditMode.normal) return; if (_form1._mode == EditMode.drawing) { endDrawing(); if (_width <= 0 || _height <= 0) endChoosing(); _zoom.addZoomPoints(); updateTextBox(); _form1.richTextBox.Visible = true; } if (_form1._mode == EditMode.choose) { _zoom.updateZoomPoints(); } else if (_form1._mode == EditMode.Zoom) { _zoom.updateZoomPoints(); _form1._mode = EditMode.choose; } //MessageBox.Show("Error at MouseUp()!!"); showZoomPoints(); }
protected override void OnMouseDown(MouseEventArgs e) { base.OnMouseDown(e); clickPoint = Cursor.Position; this.Capture = true; }
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; } }
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, " "); }
private void MainForm_MouseClick(object sender, MouseEventArgs e) { if (!this.timer.Enabled) { this.Start(); } }
private void SelectionForm_MouseDown(object sender, MouseEventArgs e) { if (e.Button != MouseButtons.Left) return; _drawStart = e.Location; }
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);//计算窗体的距离差 } } } }
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; } }
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; }
private void listPresetDateRanges_MouseClick(object sender,MouseEventArgs e) { int selectedI=listPresetDateRanges.IndexFromPoint(e.Location); switch((ChartViewDates)selectedI) { case ChartViewDates.All: DateStart=DateTime.MinValue; DateEnd=DateTime.MinValue;//interpreted as empty. We want to show all future dates. break; case ChartViewDates.Today: DateStart=DateTime.Today; DateEnd=DateTime.Today; break; case ChartViewDates.Yesterday: DateStart=DateTime.Today.AddDays(-1); DateEnd=DateTime.Today.AddDays(-1); break; case ChartViewDates.ThisYear: DateStart=new DateTime(DateTime.Today.Year,1,1); DateEnd=new DateTime(DateTime.Today.Year,12,31); break; case ChartViewDates.LastYear: DateStart=new DateTime(DateTime.Today.Year-1,1,1); DateEnd=new DateTime(DateTime.Today.Year-1,12,31); break; } FillDateTextBoxesHelper(); }
protected override void OnMouseUp(MouseEventArgs e) { base.OnMouseUp(e); if (e.Button == MouseButtons.Right) ShowTabPageContextMenu(new Point(e.X, e.Y)); }
private void ColorNode_MouseDown(object sender, MouseEventArgs e) { var colorNode = new Node("Color"); colorNode.Location = new Point(200, 50); var redChannel = new NodeSliderItem("R", 64.0f, 16.0f, 0, 1.0f, 0.0f, false, false); var greenChannel = new NodeSliderItem("G", 64.0f, 16.0f, 0, 1.0f, 0.0f, false, false); var blueChannel = new NodeSliderItem("B", 64.0f, 16.0f, 0, 1.0f, 0.0f, false, false); var colorItem = new NodeColorItem("Color", Color.Black, false, true); EventHandler<NodeItemEventArgs> channelChangedDelegate = delegate(object s, NodeItemEventArgs args) { var red = redChannel.Value; var green = blueChannel.Value; var blue = greenChannel.Value; colorItem.Color = Color.FromArgb((int)Math.Round(red * 255), (int)Math.Round(green * 255), (int)Math.Round(blue * 255)); }; redChannel.ValueChanged += channelChangedDelegate; greenChannel.ValueChanged += channelChangedDelegate; blueChannel.ValueChanged += channelChangedDelegate; colorNode.AddItem(redChannel); colorNode.AddItem(greenChannel); colorNode.AddItem(blueChannel); colorItem.Clicked += new EventHandler<NodeItemEventArgs>(OnColClicked); colorNode.AddItem(colorItem); this.DoDragDrop(colorNode, DragDropEffects.Copy); }
void mouse_move(object sender, MouseEventArgs e) { TitlePanel title = Controls[0] as TitlePanel; title.Wake(); }
private void letter_MouseLeave(object sender, MouseEventArgs e) { ((Image)sender).Effect = null; }
private void Admin_AdaugareDepartament_MouseUp(object sender, MouseEventArgs e) { mouseDown = false; }
private void Yes_Button_MouseEnter(object sender, MouseEventArgs e) { Yes_Label.Visibility = Visibility.Collapsed; Yes_Image.Visibility = Visibility.Visible; }
private void pictureBox1_MouseDown(object sender, MouseEventArgs e) { ReleaseCapture(); SendMessage(this.Handle, 0x112, 0xf012, 0); }
private void Form1_MouseMove(object sender, MouseEventArgs e) { Text = e.Location.ToString(); }
public override void MouseDown(MouseEventArgs e) { base.MouseDown(e); }
void Form1_MouseUp(object sender, MouseEventArgs e) { OnDrawMode = false; this.Invalidate(); this.Paint -= Form1_Paint_Object; this.Paint += Form1_Paint; }
void Form1_MouseDown(object sender, MouseEventArgs e) { OnDrawMode = true; pt = e.Location; this.Paint -= Form1_Paint; this.Paint += Form1_Paint_Object; }
void Form1_MouseMove(object sender, MouseEventArgs e) { if (e.Button != System.Windows.Forms.MouseButtons.Left) return; points = GetSquareVertices(pt, e.Location); this.Invalidate(); }
/// <summary> /// Обработчик события нажатия на кнопку. Вызываем Message Box. /// </summary> private void button1_MouseClick(object sender, MouseEventArgs e) { MessageBox.Show("Поздравляем! Вы смогли нажать на кнопку!", "Убегающая кнопка"); button1.Top = (ClientSize.Height - button1.Height) / 2; button1.Left = (ClientSize.Width - button1.Width) / 2; }
private void Icon_MouseUp(object sender, MouseEventArgs e) { }
private void Form1_MouseUp(object sender, MouseEventArgs e) { }
/// <summary> /// Closes the application when the black X is clicked. /// </summary> /// <remarks> /// Will also write the username and encrytped password to a text file. This is used when the application is opened to /// retain the user's username and password. /// </remarks> /// <param name="sender">The black X button.</param> /// <param name="e">The mouse down event.</param> private void buttonClose1_MouseDown(object sender, MouseEventArgs e) { Application.Exit(); }
private void Form1_MouseClick(object sender, MouseEventArgs e) { fn_miss_shot(); }
private void EventList_MouseDoubleClick(object sender, MouseEventArgs e) { GotoEvent(); }
private void LvSelectedArmy_MouseDown(object sender, MouseEventArgs e) { lvSelectedArmy.SelectedIndex = lvSelectedArmy.IndexFromPoint(e.X, e.Y); }
public override void MouseMove(MouseEventArgs e) { base.MouseMove(e); HC.GCursor = Cursors.Default; }
void OnMouseLeave(object sender, MouseEventArgs e) { HtmlPage.Document.DetachEvent("oncontextmenu", new EventHandler <HtmlEventArgs>(ContentMenu_EventHandler)); }
private void FormMain_MouseUp(object sender, MouseEventArgs e) { _idleTimeSpan = new TimeSpan(); }
private void No_Button_MouseLeave(object sender, MouseEventArgs e) { No_Image.Visibility = Visibility.Collapsed; No_Label.Visibility = Visibility.Visible; }
private void Border_MouseEnter(object sender, MouseEventArgs e) { string classroomID = ((Border)sender).Tag.ToString(); classroomInfo(classroomID); }
protected virtual void OnHeaderMouseLeave(object sender, MouseEventArgs e) { isMouseDown = false; }
/// <summary> /// Обработчик отпускания мыши /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void MouseUp(object sender, MouseEventArgs e) { AddPointToFigure(_polygon, e); Canvas.Refresh(); }
private void locked_MouseDown(object sender, MouseEventArgs e) { MessageBox.Show("Задание еще не открыто! Пройдите предыдущее задание для разблокировки"); return; }
private void txtDisplay_MouseMove(object sender, MouseEventArgs e) { this.TextSelectionRemove(); }
private void letter_MouseEnter(object sender, MouseEventArgs e) { System.Windows.Media.Effects.DropShadowEffect effect = new System.Windows.Media.Effects.DropShadowEffect(); effect.ShadowDepth = 15; ((Image)sender).Effect = effect; }
public override void MouseUp(MouseEventArgs e) { base.MouseUp(e); }
/// <summary> /// Stops the dragging sequnce after the mouse is released. /// </summary> /// <param name="sender">The gradient.</param> /// <param name="e">The mouse up event.</param> private void gradient_MouseUp(object sender, MouseEventArgs e) { this.dragging = false; }
protected override void OnMouseClick(MouseEventArgs e ) { ShowLocation (string.Format("OnMouseClick (e=<{0}>) ", e)); base.OnMouseClick(e);; }