Forums: 公開討議 (Thread #37051)

キャレットの座標取得について (2015-08-12 16:24 by IZUMO #76725)

はじめまして、

表題の件についてご教示頂けますでしょうか?

現在選択されているキャレットの位置情報からキャレットの座標(コントロール上、もしくはフォーム上)を取得する方法はございますでしょうか?

エディタの画面上でキャレットの位置でガイドもしくはヘルプ情報として動的に生成したコンテキストメニューを表示させようとしています。

ご存知の方おられましたらお助け願えますでしょうか?

よろしくお願いします。

Reply to #76725×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login

Re: キャレットの座標取得について (2015-09-02 00:27 by 鯨油 #76824)

AzukiControl の GetPositionFromIndex メソッドでどうでしょうか
キャレットの行列、または桁から、コントロールの相対座標を取得します

以下、VB のテストコードの抜粋です

Dim _LineIndex As Integer
Dim _ColumnIndex As Integer

'キャレットの行と列を取得する
AzukiControl1.Document.GetCaretIndex(_LineIndex, _ColumnIndex)

Dim _Point As Point

'キャレットの行と列からコントロールの相対座標を取得する
_Point = AzukiControl1.GetPositionFromIndex(_LineIndex, _ColumnIndex)

Dim _Screen As Point

'コントロールの相対座標から画面上の座標を取得する
_Screen = AzukiControl1.PointToScreen(_Point)

'コンテキストメニューを表示する
ContextMenuStrip1.Show(_Screen)
Reply to #76725

Reply to #76824×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login