public override TextBox CreateTextBox(Point mousePosition) { TextBox tb; // Get cell where mouse cursor is currently over. Point localMousePos = Canvas.PointToClient(mousePosition); editCol = -1; editRow = -1; int cellWidth = DisplayRectangle.Width / Columns; int cellHeight = DisplayRectangle.Height / Rows; if (DisplayRectangle.Contains(localMousePos)) { editCol = (localMousePos.X - DisplayRectangle.Left) / cellWidth; editRow = (localMousePos.Y - DisplayRectangle.Top) / cellHeight; tb = new TextBox(); tb.Location = DisplayRectangle.TopLeftCorner().Move(editCol * cellWidth, editRow * cellHeight + cellHeight / 2 - 10); tb.Size = new Size(cellWidth, 20); string text; cellText.TryGetValue(new Cell() { Column = editCol, Row = editRow }, out text); tb.Text = text; } else { tb = base.CreateTextBox(mousePosition); } return(tb); }
protected override void OnMouseLeave(EventArgs e) { if (DisplayRectangle.Contains(PointToClient(Cursor.Position))) { return; } base.OnMouseLeave(e); }
private void DragForm(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left && DisplayRectangle.Contains(e.Location)) { Core.ReleaseCapture(); Core.SendMessage(Handle, Core.WM_NCLBUTTONDOWN, Core.HTCAPTION, 0); } }
protected override void OnMouseUp(MouseEventArgs mevent) { ReleaseButton(); if (DisplayRectangle.Contains(mevent.Location)) { HighlightButton(); } base.OnMouseUp(mevent); }
protected override void OnMouseLeave(EventArgs e) { base.OnMouseLeave(e); if (AutoShow) { if (DisplayRectangle.Contains(Control.MousePosition) == false) { Hide(); } } }
// Mouse Hooks public void MouseUpDown(Point location, MouseButton mb, NoForms.Common.ButtonState bs, bool inComponent, bool amClipped) { foreach (IComponent c in components) { if (c.visible) { c.MouseUpDown(location, mb, bs, c.DisplayRectangle.Contains(location), amClipped ? true : !DisplayRectangle.Contains(location)); } } }
protected override void OnMouseUp(MouseEventArgs mevent) { highlightRect.Location = new Point(0, 0); highlightAlphaTop = 255; highlightAlphaBottom = 0; if (DisplayRectangle.Contains(mevent.Location)) { animateMouseOverTimer.Start(); } base.OnMouseUp(mevent); }
protected override void OnDragOver(DragEventArgs drgevent) { Point point = PointToClient(new Point(drgevent.X, drgevent.Y)); int tabIndex = !DisplayRectangle.Contains(point) ? GetTabIndexAtPoint(point) : -1; if (tabIndex > 0 && point.X < (DiagramImageWidth / 2)) { // We're on the left edge, activate the previous tab --tabIndex; } SetDragActivateTimer(tabIndex); base.OnDragOver(drgevent); }
public override void MouseMove(Point location, bool inComponent, bool amClipped) { base.MouseMove(location, inComponent, amClipped); foreach (IComponent c in components) { if (c.visible) { bool child_inComponent = c.DisplayRectangle.Contains(location); bool child_amClipped = amClipped ? true : !DisplayRectangle.Contains(location); c.MouseMove(location, child_inComponent, child_amClipped); } } }
public void MouseMove(Point location, bool inComponent, bool amClipped) { foreach (IComponent c in components) { if (c.visible) { bool child_inComponent = c.DisplayRectangle.Contains(location); bool child_amClipped = amClipped ? true : !DisplayRectangle.Contains(location); c.MouseMove(location, child_inComponent, child_amClipped); } } // FIXME should derrive from component? if (IComponent_Util.AmITopZOrder(this, location)) { window.Cursor = Cursor; } }
protected override void OnMouseUp(System.Windows.Forms.MouseEventArgs e) { base.OnMouseUp(e); if (Enabled && DisplayRectangle.Contains(Cursor.Position)) { State = CheckBoxState.Hot; } else { State = Enabled ? CheckBoxState.Normal : CheckBoxState.Disabled; } if (pressed) { pressed = false; } Parent.Focus(); // This is so that the focus rectangle wont be displayed after clicking the checkbox. Invalidate(); }
protected override void OnMouseLeave(EventArgs e) { base.OnMouseLeave(e); if (MouseState != MouseState.DOWN) { Cursor = Cursors.Default; CursorUpdate?.Invoke(this, Cursor); } if (AutoShow) { if (DisplayRectangle.Contains(Control.MousePosition) == false) { Hide(); } } }
protected sealed override void OnMouseDoubleClick(MouseEventArgs e) { Point point = e.Location; if (e.Button == MouseButtons.Left && !DisplayRectangle.Contains(point)) { DiagramTabPage tab; Diagram diagram; object[] attributes; if (null != (tab = GetTabAtPoint(point)) && null != (diagram = tab.Diagram) && ((null == (attributes = diagram.GetType().GetCustomAttributes(typeof(DiagramMenuDisplayAttribute), false)) || attributes.Length == 0) || 0 == (((DiagramMenuDisplayAttribute)attributes[0]).DiagramOption & DiagramMenuDisplayOptions.BlockRename))) { RenameTab(tab); } } base.OnMouseDoubleClick(e); }
public override void MouseUpDown(Point location, MouseButton mb, ButtonState bs, bool inComponent, bool amClipped) { Rectangle clipDr = DisplayRectangle; clipDr.height -= HorizontalScrollbarVisible ? HorizontalScrollbarHeight : 0; clipDr.width -= VerticalScrollbarVisible ? VerticalScrollbarWidth : 0; // trickery var scrollOffset = new Point(xOffset, yOffset); foreach (IComponent c in components) { if (c.visible && c.Scrollable) { c.MouseUpDown(location + scrollOffset, mb, bs, c.DisplayRectangle.Contains(location + scrollOffset), amClipped ? true : !clipDr.Contains(location)); } else if (!c.Scrollable) { c.MouseUpDown(location, mb, bs, c.DisplayRectangle.Contains(location), amClipped ? true : !DisplayRectangle.Contains(location)); } } }
public override bool MouseOver(Point P) { return(DisplayRectangle.Contains(P)); }
private bool PointIsOnPadding(Point point) { return(!DisplayRectangle.Contains(point)); }
public virtual bool IsMouseOver(Point p) { return(Visible && (DisplayRectangle.Contains(p) || Moving || Modal) && !NotControl); }
private void redrawShowBitmap() { if (showBitmap == null) { return; } int ib = 0; int w = width, h = height; Graphics g = Graphics.FromImage(showBitmap); Pen fp = new Pen(frameColor, multiple / 4); fp.Alignment = PenAlignment.Inset; Brush Fbrush = new SolidBrush(this.ForeColor); Brush Bbrush = new SolidBrush(this.lcdColor); int lsize = multiple / 4; Rectangle Bdr = new Rectangle(0, 0, multiple - lsize, multiple - lsize); Rectangle fr = new Rectangle(0, 0, multiple * w, multiple * h); Bitmap rectBitmap = new Bitmap(multiple, multiple); Graphics mapg = Graphics.FromImage(rectBitmap); mapg.Clear(this.BackColor); mapg.FillRectangle(Bbrush, Bdr); //mapg.Dispose(); TextureBrush textureB = new TextureBrush(rectBitmap); g.FillRectangle(textureB, this.DisplayRectangle); textureB.Dispose(); //mapg.FillRectangle(Fbrush, Bdr); //textureB = new TextureBrush(rectBitmap); mapg.Dispose(); rectBitmap.Dispose(); g.SmoothingMode = SmoothingMode.HighSpeed; for (int istr = 0; istr < this.Text.Length; istr++) { if (!DisplayRectangle.Contains(fr.Location)) { break; } BitArray bita = this.GetCharMap(this.Text[istr]); for (int i = 0; i < h; i++) { for (int k = 0; k < w; k++) { if (bita[ib++]) { g.FillRectangle(Fbrush, Bdr); } Bdr.X += multiple; } Bdr.X -= w * multiple; Bdr.Y += multiple; } g.DrawRectangle(fp, fr); fr.X = fr.Right; if (!DisplayRectangle.Contains(new Point(fr.Right, fr.Y))) { fr.X = 0; fr.Y = fr.Bottom; } Bdr.Location = fr.Location; ib = 0; } fp.Dispose(); Fbrush.Dispose(); Bbrush.Dispose(); }