Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "Основная";
Текущий архив: 2004.08.22;
Скачать: [xml.tar.bz2];

Вниз

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;
Скачать: [xml.tar.bz2];

Наверх





Память: 0.44 MB
Время: 0.041 c
11-1077964306
nsvi
2004-02-28 13:31
2004.08.22
Проблемы с KOLWebBrowser


14-1091564102
Alex_Bredin
2004-08-04 00:15
2004.08.22
Рыбалка


3-1090848339
sergg
2004-07-26 17:25
2004.08.22
Хранение изображений в БД


3-1090056264
Andrey
2004-07-17 13:24
2004.08.22
Как сделать, чтоб новая запись записывалась в конце базы?


3-1091442034
rosl
2004-08-02 14:20
2004.08.22
interbase





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
Английский Французский Немецкий Итальянский Португальский Русский Испанский