Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2004.08.22;
Скачать: CL | DM;

Вниз

RichEdit   Найти похожие ветки 

 
vakir77   (2004-08-10 16:21) [0]

Здравствуйте, можно ли программно перевести курсор в видимую часть текста. Т.е при скроллинге текста мышью, курсор остается на первой строке, как сделать что бы он передвигался на первую видимую строку в RichEdit-е.


 
Cosinus ©   (2004-08-10 16:29) [1]

Переместить курсор в TRichEdit на нужную позицию

// You can move the caret in a TRichEdit component by using this code :

procedure RichEdit_MoveTo(RichEdit: TRichEdit; LineNumber, CharNumber: Word);
begin
  RichEdit.SelStart := RichEdit.Perform(EM_LINEINDEX, LineNumber, 0) + CharNumber);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  RichEdit_MoveTo(RichEdit1,2,5);
  Application.ProcessMessages;
  RichEdit1.SetFocus;
end;

Получить первую или последнюю видимую строку в TRichEdit

function RE_GetLastVisibleLine(RichEdit: TRichEdit): Integer;
const
  EM_EXLINEFROMCHAR = WM_USER + 54;
var
  r: TRect;
  i: Integer;
begin
  {
  The EM_GETRECT message retrieves the formatting rectangle
  of an edit control.
 }
  RichEdit.Perform(EM_GETRECT, 0, Longint(@r));
  r.Left := r.Left + 1;
  r.Top  := r.Bottom - 2;
  {
   The EM_CHARFROMPOS message retrieves information about the character
   closest to a specified point in the client area of an edit control
 }
  i := RichEdit.Perform(EM_CHARFROMPOS, 0, Integer(@r.topleft));
  {
   The EM_EXLINEFROMCHAR message determines which
   line contains the specified character in a rich edit control
 }
  Result := RichEdit.Perform(EM_EXLINEFROMCHAR, 0, i);
end;

{
 Sending the EM_GETFIRSTVISIBLELINE message to a multi-line edit control
 finds out which line is the first line visible.
 This is the line that is currently displayed at the top of the control.
}

function RE_GetFirstVisibleLine(RichEdit: TRichEdit): Integer;
begin
  Result := RichEdit.Perform(EM_GETFIRSTVISIBLELINE, 0, 0);
end;


 
vakir77   (2004-08-10 16:48) [2]

to Cosinus © большое спасибо



Страницы: 1 вся ветка

Текущий архив: 2004.08.22;
Скачать: CL | DM;

Наверх




Память: 0.44 MB
Время: 0.024 c
3-1091159704
rus9
2004-07-30 07:55
2004.08.22
TQuery


1-1091948146
k-sergey
2004-08-08 10:55
2004.08.22
Про поток и TImage


6-1087757906
AVGVI
2004-06-20 22:58
2004.08.22
Сохранение аттачей


3-1090308378
Ani
2004-07-20 11:26
2004.08.22
Как отабражать в QuickReport е текущую дату в виде 5 июля 2004 го


14-1091797724
X9
2004-08-06 17:08
2004.08.22
Создание шрифтов в Corel DRAW





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский