掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
TRichEdit(RichEdit 4.1) で URL を Shift+End or Shift+Home した時の動作 (ID:150960)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
OnKeyDownイベントで、試しに書いて見ました。 (あまりチェックしていないので、期待どおりに動作するかわからないですが・・) procedure TForm1.RichEdit1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); var x, y, li: Integer; begin if (Key = VK_HOME) and (Shift = [ssShift]) then begin x := RichEdit1.CaretPos.X; y := RichEdit1.CaretPos.Y; li := RichEdit1.Perform(EM_LINEINDEX, UINT(-1), 0); RichEdit1.SelLength := 0 - (RichEdit1.SelStart - li); Key := 0; end else if (Key = VK_END) and (Shift = [ssShift]) then begin x := RichEdit1.CaretPos.X; y := RichEdit1.CaretPos.Y; li := RichEdit1.Perform(EM_LINEINDEX, UINT(-1), 0); RichEdit1.SelStart := li + x; RichEdit1.SelLength := Length(RichEdit1.Lines.Strings[y]) - x; Key := 0; end; end;
←解決時は質問者本人がここをチェックしてください。
更新する
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.