was ist neu ¦  programmier tips ¦  indy artikel ¦  intraweb artikel ¦  informationen ¦  links ¦  interviews
 sonstiges ¦  tutorials ¦  Add&Win Gewinnspiel

Tips (1541)

Dateien (137)
Datenbanken (90)
Drucken (35)
Grafik (114)
IDE (21)
Indy (5)
Internet / LAN (130)
IntraWeb (0)
Mathematik (76)
Multimedia (45)
Oberfläche (107)
Objekte/
ActiveX (51)

OpenTools API (3)
Sonstiges (126)
Strings (83)
System (266)
VCL (242)

Tips sortiert nach
Komponente


Tip suchen

Tip hinzufügen

Add&Win Gewinnspiel

Werbung

38 Visitors Online


 
...die erste/letzte sichtbare Zeile eines TRichEdits ermitteln?
Autor: Thomas Stutz
[ Tip ausdrucken ]  

Tip Bewertung (18):  
     


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;

 

Bewerten Sie diesen Tipp:

dürftig
ausgezeichnet


Copyright © by SwissDelphiCenter.ch
All trademarks are the sole property of their respective owners