Exemple #1
0
        public override bool MouseMove(MouseEventArgs e)
        {
            bool vResult = base.MouseMove(e);

            if (e.Button == MouseButtons.Left)
            {
                if (e.X < 0)
                {
                    FLeftOffset = (short)Math.Max(0, FLeftOffset - OwnerData.Style.TextStyles[TextStyleNo].TextMetric_tmAveCharWidth);
                }
                else
                if (e.X > Width - FPaddingRight)
                {
                    FLeftOffset = (short)Math.Max(0, Math.Min(FTextSize.cx - Width + FPaddingRight, FLeftOffset + OwnerData.Style.TextStyles[TextStyleNo].TextMetric_tmAveCharWidth));
                }

                FSelEnd  = (short)HC.GetNorAlignCharOffsetAt(OwnerData.Style.TempCanvas, FText, e.X - FPaddingLeft + FLeftOffset);
                FSelMove = FSelEnd;
                if (!SelectTextExists() && (FSelEnd >= 0))  // 回到同一位置
                {
                    FSelEnd  = -1;
                    FSelMove = FCaretOffset;
                }

                ScrollAdjust(FSelMove);
            }

            return(vResult);
        }
        public override bool MouseDown(MouseEventArgs e)
        {
            bool vResult = base.MouseDown(e);

            FMouseLBDowning = (e.Button == MouseButtons.Left && Control.ModifierKeys == Keys.None);
            FOutSelectInto  = false;

            if (FMouseMoveArea != FActiveArea)
            {
                FActiveArea = FMouseMoveArea;
                OwnerData.Style.UpdateInfoReCaret();
            }

            string vS = "";
            int    vX = 0;

            switch (FActiveArea)
            {   //ceaNone: ;
            case ExpressArea.ceaLeft:
                vS = FLeftText;
                vX = e.X - FLeftRect.Left;
                break;

            case ExpressArea.ceaTop:
                vS = TopText;
                vX = e.X - TopRect.Left;
                break;

            case ExpressArea.ceaRight:
                vS = FRightText;
                vX = e.X - FRightRect.Left;
                break;

            case ExpressArea.ceaBottom:
                vS = BottomText;
                vX = e.X - BottomRect.Left;
                break;
            }

            int vOffset = 0;

            if (FActiveArea != ExpressArea.ceaNone)
            {
                OwnerData.Style.ApplyTempStyle(TextStyleNo);
                vOffset = HC.GetNorAlignCharOffsetAt(OwnerData.Style.TempCanvas, vS, vX);
            }
            else
            {
                vOffset = -1;
            }

            if (vOffset != FCaretOffset)
            {
                FCaretOffset = (short)vOffset;
                OwnerData.Style.UpdateInfoReCaret();
            }

            return(vResult);
        }
Exemple #3
0
        public override void MouseDown(MouseEventArgs e)
        {
            base.MouseDown(e);
            OwnerData.Style.ApplyTempStyle(TextStyleNo);
            int   vX      = e.X - FMargin;// - (Width - FMargin - OwnerData.Style.DefCanvas.TextWidth(FText) - FMargin) div 2;
            short vOffset = (short)HC.GetNorAlignCharOffsetAt(OwnerData.Style.TempCanvas, FText, vX);

            if (vOffset != FCaretOffset)
            {
                FCaretOffset = vOffset;
                OwnerData.Style.UpdateInfoReCaret();
            }
        }
Exemple #4
0
        public override bool MouseDown(MouseEventArgs e)
        {
            bool vResult = base.MouseDown(e);

            FMouseLBDowning = (e.Button == MouseButtons.Left) && (Control.ModifierKeys == Keys.None);
            FOutSelectInto  = false;

            if (FMouseMoveArea != FActiveArea)
            {
                FActiveArea = FMouseMoveArea;
                OwnerData.Style.UpdateInfoReCaret();
            }

            string vS = "";
            int    vX = 0;

            if (FActiveArea == ExpressArea.ceaTop)
            {
                vS = FSupText;
                vX = e.X - FSupRect.Left;
            }
            else
            if (FActiveArea == ExpressArea.ceaBottom)
            {
                vS = FSubText;
                vX = e.X - FSubRect.Left;
            }

            int vOffset = 0;

            if (FActiveArea != ExpressArea.ceaNone)
            {
                ApplySupSubStyle(OwnerData.Style.TextStyles[TextStyleNo], OwnerData.Style.TempCanvas);
                vOffset = HC.GetNorAlignCharOffsetAt(OwnerData.Style.TempCanvas, vS, vX);
            }
            else
            {
                vOffset = -1;
            }

            if (vOffset != FCaretOffset)
            {
                FCaretOffset = (short)vOffset;
                OwnerData.Style.UpdateInfoReCaret();
            }

            return(vResult);
        }
Exemple #5
0
        public override bool MouseDown(MouseEventArgs e)
        {
            bool vResult = base.MouseDown(e);

            FMouseLBDowning = (e.Button == MouseButtons.Left);
            FOutSelectInto  = false;

            if (FMouseMoveArea != FActiveArea)
            {
                FActiveArea = FMouseMoveArea;
                OwnerData.Style.UpdateInfoReCaret();
            }

            string vS = "";
            int    vX = 0;

            if (FActiveArea == ExpressArea.ceaTop)
            {
                vS = FTopText;
                vX = e.X - FTopRect.Left;
            }
            else
            if (FActiveArea == ExpressArea.ceaBottom)
            {
                vS = FBottomText;
                vX = e.X - FBottomRect.Left;
            }

            int vOffset = -1;

            if (FActiveArea != ExpressArea.ceaNone)
            {
                OwnerData.Style.ApplyTempStyle(TextStyleNo);
                vOffset = HC.GetNorAlignCharOffsetAt(OwnerData.Style.TempCanvas, vS, vX);
            }

            if (vOffset != FCaretOffset)
            {
                FCaretOffset = (short)vOffset;
                OwnerData.Style.UpdateInfoReCaret();
            }

            return(vResult);
        }
Exemple #6
0
        public override bool MouseDown(MouseEventArgs e)
        {
            bool vResult = base.MouseDown(e);

            if (!this.Active)
            {
                return(vResult);
            }

            OwnerData.Style.ApplyTempStyle(TextStyleNo);
            short vOffset = (short)HC.GetNorAlignCharOffsetAt(OwnerData.Style.TempCanvas, FText, e.X - FPaddingLeft + FLeftOffset);

            if (e.Button == MouseButtons.Left)
            {
                DisSelectText();
            }
            else
            {
                if (!OffsetInSelect(vOffset))
                {
                    DisSelectText();
                }
                else
                {
                    return(vResult);
                }
            }

            if (vOffset != FCaretOffset)
            {
                FCaretOffset = vOffset;
                FSelMove     = vOffset;
                ScrollAdjust(vOffset);
                OwnerData.Style.UpdateInfoReCaret();
            }

            return(vResult);
        }