iceman 发表于 2012-4-17 18:34:00

回复 10# nisnfox 的帖子

nisnfox你好,
1.关于 10# 坐标计算不准确问题,原因已经找出,请使用下面代码测试:

editorLocation = new Point((editorLocation.X -
                                          textControl1.ScrollLocation.X)/dpiX,
                                          (editorLocation.Y -
                                          textControl1.ScrollLocation.Y)/dpiX);

2.弹出异常:Invalid property value.(01-0903) 问题正在调查当中,稍后回复~

iceman 发表于 2012-4-17 19:50:00

回复 10# nisnfox 的帖子

nisnfox 你好,请尝试一下代码,我这边成功实现了该功能:
Point editorLocation =new Point();
            int intX = 0;
            int intY = 0;
            Rectangle rectScreen = new Rectangle();

            Editor editor = new Editor();
            TXTextControl.TextField currentField = e.TextField;
            //   g_strFieldValue = objTextField.Text;
            this.textControl1.Selection.Start = currentField.Start;
            this.textControl1.Selection.Length = 0;

            editorLocation.Y = (textControl1.InputPosition.Location.Y / 15) + Convert.ToInt32(textControl1.Font.Size) + 10 - (textControl1.ScrollLocation.Y / 15);
            editorLocation.X = (textControl1.InputPosition.Location.X / 15) - (textControl1.ScrollLocation.X / 15);

            intY = editorLocation.Y;
            intX = editorLocation.X;

            rectScreen = Screen.PrimaryScreen.WorkingArea;
            if (((intX + editor.Width) > rectScreen.Width))
                intX = rectScreen.Width - editor.Width;
            if (((intY + editor.Height) > rectScreen.Height))
                intY = rectScreen.Height - editor.Height;
            editor.Top = intY;
            editor.Left = intX;

            //// hilite the field
            textControl1.Selection.Start = currentField.Start - 1;
            textControl1.Selection.Length = currentField.Length;
            textControl1.Selection.TextBackColor = System.Drawing.Color.Navy;

            editor.Show();
            this.textControl1.Controls.Add(editor);
            editor.BringToFront();
页: 1 [2]
查看完整版本: tx14 怎么取 TextField 的X Y 的座标 Point