Exemple #1
0
        public override bool InsertText(string aText)
        {
            if (FActiveArea != ToothArea.ctaNone)
            {
                switch (FActiveArea)
                {
                case ToothArea.ctaLeftTop:
                    FLeftTopText = FLeftTopText.Insert(FCaretOffset + 1 - 1, aText);
                    break;

                case ToothArea.ctaLeftBottom:
                    FLeftBottomText = FLeftBottomText.Insert(FCaretOffset + 1 - 1, aText);
                    break;

                case ToothArea.ctaRightTop:
                    FRightTopText = FRightTopText.Insert(FCaretOffset + 1 - 1, aText);
                    break;

                case ToothArea.ctaRightBottom:
                    FRightBottomText = FRightBottomText.Insert(FCaretOffset + 1 - 1, aText);
                    break;
                }

                FCaretOffset += aText.Length;

                this.SizeChanged = true;
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #2
0
        public override void GetCaretInfo(ref HCCaretInfo aCaretInfo)
        {
            if (FActiveArea != ToothArea.ctaNone)
            {
                OwnerData.Style.ApplyTempStyle(TextStyleNo);
                switch (FActiveArea)
                {
                case ToothArea.ctaLeftTop:
                    aCaretInfo.Height = FLeftTopRect.Bottom - FLeftTopRect.Top;
                    if (FLeftTopText != "")
                    {
                        aCaretInfo.X = FLeftTopRect.Left + OwnerData.Style.TempCanvas.TextWidth(FLeftTopText.Substring(1 - 1, FCaretOffset));
                    }
                    else
                    {
                        aCaretInfo.X = FLeftTopRect.Left;
                    }

                    aCaretInfo.Y = FLeftTopRect.Top;
                    break;

                case ToothArea.ctaLeftBottom:
                    aCaretInfo.Height = FLeftBottomRect.Bottom - FLeftBottomRect.Top;
                    if (FLeftBottomText != "")
                    {
                        aCaretInfo.X = FLeftBottomRect.Left + OwnerData.Style.TempCanvas.TextWidth(FLeftBottomText.Substring(1 - 1, FCaretOffset));
                    }
                    else
                    {
                        aCaretInfo.X = FLeftBottomRect.Left;
                    }

                    aCaretInfo.Y = FLeftBottomRect.Top;
                    break;

                case ToothArea.ctaRightTop:
                    aCaretInfo.Height = FRightTopRect.Bottom - FRightTopRect.Top;
                    if (FRightTopText != "")
                    {
                        aCaretInfo.X = FRightTopRect.Left + OwnerData.Style.TempCanvas.TextWidth(FRightTopText.Substring(1 - 1, FCaretOffset));
                    }
                    else
                    {
                        aCaretInfo.X = FRightTopRect.Left;
                    }

                    aCaretInfo.Y = FRightTopRect.Top;
                    break;

                case ToothArea.ctaRightBottom:
                    aCaretInfo.Height = FRightBottomRect.Bottom - FRightBottomRect.Top;
                    if (FRightBottomText != "")
                    {
                        aCaretInfo.X = FRightBottomRect.Left + OwnerData.Style.TempCanvas.TextWidth(FRightBottomText.Substring(1 - 1, FCaretOffset));
                    }
                    else
                    {
                        aCaretInfo.X = FRightBottomRect.Left;
                    }

                    aCaretInfo.Y = FRightBottomRect.Top;
                    break;
                }
            }
            else
            {
                aCaretInfo.Visible = false;
            }
        }