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

23 Visitors Online


 
...eine vertikale Titelleiste zeichnen?
Autor: ---
[ Tip ausdrucken ]  

Tip Bewertung (10):  
     




type
  
TForm1 = class(TForm)
    procedure FormResize(Sender: TObject);
    procedure FormPaint(Sender: TObject);
  private
    procedure 
VerticalTitleBar(Texto: string; Size: Integer);
  end;

const
  
MY_TITLE_TEXT = 'Vertical Text';
var
  
Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.VerticalTitleBar(TexTo: string; Size: Integer);
var
  
LogFont: TLogFont;
  tmpCanvas: TCanvas;
  tmpRect: TRect;
  x1, x2, y1, y2: integer;
begin
  
tmpCanvas        := TCanvas.Create;
  tmpCanvas.Handle := GetWindowDc(Handle);
  try
    
GetObject(Canvas.Font.Handle, SizeOf(LogFont), @LogFont);
    with LogFont do
    begin
      
lfEscapement   := 90 * 10;
      lfOrientation  := 90 * 10;
      lfOutPrecision := OUT_TT_ONLY_PRECIS;
      lfFaceName     := 'Arial';
      lfHeight       := Size;
      lfWeight       := FW_BOLD;
      lfQuality      := PROOF_QUALITY;
    end;
    with tmpCanvas do
    begin
      
Font.Handle := CreateFontIndirect(LogFont);
      Font.Color  := clWhite;
      Brush.Color := clNavy;
    end;
    x1 := GetSystemMetrics(SM_CXEDGE) + GetSystemMetrics(SM_CXBORDER);
    x2 := 20;
    y1 := GetSystemMetrics(SM_CYCAPTION) + GetSystemMetrics(SM_CYEDGE) +
          GetSystemMetrics(SM_CYBORDER) + 1;
    y2 := Height - GetSystemMetrics(SM_CYEDGE) - GetSystemMetrics(SM_CYBORDER);
    tmpRect := Rect(x1, y1, x2, y2);
    tmpCanvas.FillRect(tmpRect);
    DrawText(tmpCanvas.Handle, PChar(Texto), - 1, tmpRect, DT_BOTTOM or
      
DT_SINGLELINE);
  finally
    
tmpCanvas.Free;
  end;
end;

procedure TForm1.FormResize(Sender: TObject);
begin
  
VerticalTitleBar(MY_TITLE_TEXT, 12);
end;

procedure TForm1.FormPaint(Sender: TObject);
begin
  
VerticalTitleBar(MY_TITLE_TEXT, 12);
end;

end.


 

Bewerten Sie diesen Tipp:

dürftig
ausgezeichnet


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