Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Welche Information enthällt yOffset bei TRichEdit? (https://www.delphipraxis.net/171076-welche-information-enthaellt-yoffset-bei-trichedit.html)

Popov 18. Okt 2012 21:41

Welche Information enthällt yOffset bei TRichEdit?
 
Ich will in TRichEdit Teile das Textes tiefer oder höher stellen. Allerdings im Verhältnis zu der aktuellen Font Größe. Ich hab hier zwei Beispiel. Im ersten Beispiel enthällt yOffset den Wert 50. Der Text ist halbhoch. Im zweiten Beispiel ist die Schrift größer, der Text dementsprechend nur leicht erhöht.

Also Pixel sind es nicht, auch nicht Prozent. Weiß das einer von euch?

Delphi-Quellcode:
uses RichEdit;

procedure Test(RichEdit: TRichEdit; FontSize: Integer);
var
  Format: TCharFormat;
begin
  FillChar(Format, SizeOf(Format), 0);
  with RichEdit do
  begin
    DefAttributes.Size := FontSize;
    Clear;
    Text := 'ABCDE';

    Format.cbSize := SizeOf(Format);
    Format.dwMask := CFM_OFFSET;

    SelStart := 2;
    SelLength := 2;

    Format.yOffset := 50; //<<<<<<<<<<<<<<<<<<<<<<<<<<<<

    Perform(EM_SETCHARFORMAT, SCF_SELECTION, Longint(@Format));
  end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  Test(RichEdit1, Font.Size);
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  Test(RichEdit1, 30);
end;

Bummi 18. Okt 2012 23:26

AW: Welche Information enthällt yOffset bei TRichEdit?
 
Delphi-Quellcode:
    Format.yOffset := DefAttributes.Height div 3 *15; //<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    Format.yOffset := DefAttributes.Height * 5; //<<<<<<<<<<<<<<<<<<<<<<<<<<<<
http://books.google.de/books?id=maxG...offset&f=false

Popov 18. Okt 2012 23:45

AW: Welche Information enthällt yOffset bei TRichEdit?
 
Danke dir, wunderbar, ich hab davor lange gesucht, aber kaum brauchbare Infos gefunden. Damit kann ich was anfangen.


Alle Zeitangaben in WEZ +1. Es ist jetzt 07:49 Uhr.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz