Недавно добавленные исходники

•  DeLiKaTeS Tetris (Тетрис)  4 796

•  TDictionary Custom Sort  6 793

•  Fast Watermark Sources  6 581

•  3D Designer  9 534

•  Sik Screen Capture  6 918

•  Patch Maker  7 365

•  Айболит (remote control)  7 303

•  ListBox Drag & Drop  6 168

•  Доска для игры Реверси  98 109

•  Графические эффекты  7 481

•  Рисование по маске  6 774

•  Перетаскивание изображений  5 630

•  Canvas Drawing  6 007

•  Рисование Луны  5 798

•  Поворот изображения  5 251

•  Рисование стержней  3 844

•  Paint on Shape  2 999

•  Генератор кроссвордов  3 955

•  Головоломка Paletto  3 138

•  Теорема Монжа об окружностях  3 969

•  Пазл Numbrix  2 620

•  Заборы и коммивояжеры  3 431

•  Игра HIP  2 347

•  Игра Go (Го)  2 264

•  Симулятор лифта  2 664

•  Программа укладки плитки  2 225

•  Генератор лабиринта  2 775

•  Проверка числового ввода  2 385

•  HEX View  2 720

•  Физический маятник  2 411

 
скрыть

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



Оформил: DeeCo

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;