Einzelnen Beitrag anzeigen

Benutzerbild von Bummi
Bummi

Registriert seit: 15. Jun 2010
Ort: Augsburg Bayern Süddeutschland
3.470 Beiträge
 
Delphi XE3 Enterprise
 
#4

AW: GDI+ Variante zu TextRect

  Alt 24. Okt 2012, 16:42
Sorry, ich war wieder mal fasch abgebogen

Delphi-Quellcode:
Procedure BeispielTextout(graphics:TGPGraphics;Const TheText:String;Rect:TGPRectF;Color:TGPColor;HAlign,VAlign:TStringAlignment;Size:Integer=10;FontName:String='Arial');
var
  StringFormat:TGPStringFormat;
  FontFamily : TGPFontFamily;
  Font : TGPFont;
  Pen : TGPPen;
  Brush : TGPSolidBrush;
begin
   StringFormat:= TGPStringFormat.Create;
   FontFamily := TGPFontFamily.Create(FontName);
   Font := TGPFont.Create(FontFamily, Size, FontStyleRegular, UnitPixel);
   Pen := TGPPen.Create(Color);
   Brush := TGPSolidBrush.Create(Color);
   stringFormat.SetAlignment(HAlign);
   stringFormat.SetLineAlignment(VAlign);
   graphics.DrawString(TheText,-1,Font,Rect,stringformat,Brush);
   Pen.Free;
   Brush.Free;
   StringFormat.Free;
   FontFamily.Free;
   Font.Free;
end;
http://msdn.microsoft.com/en-us/libr...(v=vs.85).aspx
Thomas Wassermann H₂♂
Das Problem steckt meistens zwischen den Ohren
DRY DRY KISS
H₂ (wenn bei meinen Snipplets nichts anderes angegeben ist Lizenz: WTFPL)
  Mit Zitat antworten Zitat