protected bool IsEndOfSelectionInScreen() { var selInfo = SelectInfo; if (selInfo.IsTextSelectionValid() == false) { return(true); } var ti = Document .Pages[selInfo.EndPage].Text .GetTextInfo(Math.Max(0, selInfo.EndIndex - 1), 1); if (ti?.Rects == null || ti.Rects.Count == 0) { return(true); } var topLeftPt = PageToClient(selInfo.EndPage, new Point(ti.Rects[0].left, ti.Rects[0].top)); return(ClientRect.Contains(topLeftPt)); }
protected override void OnMouseMove(MouseEventArgs e) { base.OnMouseMove(e); CSharpToolBarButton button = ButtonFromPoint(e.X, e.Y); // セパレータの場合は何もしない if (button != null && button.Style == CSharpToolBarButtonStyle.Separator) { return; } // フラット形式の場合は、浮き出る境界線を描画 if (e.Button == MouseButtons.None) { if (button == activeButton) { return; } UpdateButton(activeButton); activeButton = button; if (appearance == CSharpToolBarAppearance.Flat && button != null) { using (Graphics g = CreateGraphics()) ControlPaint.DrawBorder3D(g, button.Bounds, Border3DStyle.RaisedInner); } else if (appearance == CSharpToolBarAppearance.VisualStudio && button != null) { using (Graphics g = CreateGraphics()) DrawButton(g, button, false, true); } } // ボタンのドラッグ操作 else if (e.Button == MouseButtons.Left && allowDragButton) { if (ClientRect.Contains(e.X, e.Y)) { DrawHorzLine(GetDropButtonIndex(e.X, e.Y)); Cursor = Cursors.Default; } // クライアント領域から出ていればドラッグ操作を中止 else { DrawHorzLine(-1); Cursor = Cursors.No; } } }
private void OnMouseMove(object sender, MouseEventArgs e) { bool wasMouseOne = mouseOn; mouseOn = ClientRect.Contains(e.X, e.Y); if (!mouseOn) { mouseDown = false; } if (wasMouseOne != mouseOn) { Main.GetInstance().RequestRedraw(); } }
protected override void OnMouseUp(MouseEventArgs e) { base.OnMouseUp(e); // ボタンが押されたように描画 if (e.Button == MouseButtons.Left && activeButton != null) { if (activeButton.Style == CSharpToolBarButtonStyle.Separator) { return; } CSharpToolBarButton button = ButtonFromPoint(e.X, e.Y); UpdateButton(activeButton); DrawHorzLine(-1); // クリックされたボタンと現在のマウス座標にあるボタンが別の物であれば、 // activeButtonsを移動 if (activeButton != button) { if (allowDragButton && ClientRect.Contains(e.X, e.Y)) { int index = GetDropButtonIndex(e.X, e.Y); if (index >= 0 && index <= buttons.Count) { buttons.ChangeIndex(activeButton, index); } } Cursor = Cursors.Default; } else { // クリックイベントを発生させる OnButtonClick(new CSharpToolBarButtonEventArgs(activeButton)); } activeButton = null; } }
/// <summary> /// /// </summary> protected virtual bool HitTest(Point2D location) { return(ClientRect.Contains(location)); }