Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Programmieren allgemein (https://www.delphipraxis.net/40-programmieren-allgemein/)
-   -   Label-Komponente um 90 Grad drehung (https://www.delphipraxis.net/174952-label-komponente-um-90-grad-drehung.html)

t0mmy 21. Mai 2013 10:47

Label-Komponente um 90 Grad drehung
 
Welche kostenlose 2010 Komponente ist denn die Beste um Labels 90 Rotieren zu können?

baumina 22. Mai 2013 12:00

AW: Label-Komponente um 90 Grad drehung
 
Delphi-Standard TLabel.Font.Orientation dreht die Schrift, da brauchst keine Fremdkomponente.

Uwe Raabe 22. Mai 2013 12:48

AW: Label-Komponente um 90 Grad drehung
 
Zitat:

Zitat von baumina (Beitrag 1216046)
Delphi-Standard TLabel.Font.Orientation dreht die Schrift, da brauchst keine Fremdkomponente.

Hast du wirklich ausprobiert, ob man damit ein 90° gedrehtes Label hinkriegt? Wenn ich den Wert nämlich auf 900 setze (Einheit ist zehntel Grad), dann sieht man nämlich gar nichts mehr.

Der schöne Günther 22. Mai 2013 12:55

AW: Label-Komponente um 90 Grad drehung
 
Der Schlingel dreht ja in der linken oberen Ecke links herum. Bei 90° sieht man wirklich nichts mehr :-D

baumina 22. Mai 2013 13:03

AW: Label-Komponente um 90 Grad drehung
 
Delphi-Quellcode:
Orientation = -900
AutoSize = False
Alignment = taRightJustify
Stimmt, das schreibt nur von oben nach unten. Andersrum hab ichs auf die Schnelle auch nicht hinbekommen.

ASM 22. Mai 2013 15:18

AW: Label-Komponente um 90 Grad drehung
 
Liste der Anhänge anzeigen (Anzahl: 1)
Komponente TRotateLabel; siehe Anhang.
Wurde 1996/97 veröffentlicht als Freeware für Delphi 2; ist aber bis mindestens einschließlich Delphi XE problemlos verwendbar.

Die Steuerung der Ausrichtung erfolgt über das Property "Escapement".

t0mmy 25. Mai 2013 09:16

AW: Label-Komponente um 90 Grad drehung
 
Ich weiss das die Thematik grad zu diesem thread nicht dazupasst aber gibt es vielleicht eine panel komponente auch :) wo ich die schrift drehen könnte?

Edit: Sry - hab nicht genau gesehen das es dort eine Orientationeigenschaft gibt

Bummi 25. Mai 2013 12:05

AW: Label-Komponente um 90 Grad drehung
 
So ein Teil ist ja auch schnell selbst geschrieben, egal ob von TPanel oder von TGraphicControl angeleitet. Ein kleiner Rumpf zum fertigbasteln ...

Delphi-Quellcode:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, StdCtrls;

type
  TMyPanel=Class(TPanel)
  private
    FAngle: Double;
    FCenter: TPoint;
    procedure SetAngle(const Value: Double);
    procedure SetCenter(const Value: TPoint);
  published
    protected
    Property Canvas;
    Procedure Paint;override;
    published Property Angle:Double Read FAngle Write SetAngle;
    Property Center:TPoint read FCenter Write SetCenter;
  End;

  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation
uses Math;
{$R *.dfm}

{ TMyPanel }
Procedure SetCanvasZoomAndRotation(ACanvas:TCanvas;Zoom:Double;Angle:Double;CenterpointX,CenterpointY:Double);
var
    form : tagXFORM;
    Winkel:Double;

begin
      Winkel := DegToRad(Angle);
      SetGraphicsMode(ACanvas.Handle, GM_ADVANCED);
      SetMapMode(ACanvas.Handle,MM_ANISOTROPIC);
      form.eM11 := Zoom * cos( Winkel);
      form.eM12 := Zoom *Sin( Winkel) ;
      form.eM21 := Zoom * (-sin( Winkel));
      form.eM22 := Zoom * cos( Winkel) ;
      form.eDx := CenterpointX;
      form.eDy := CenterpointY;
      SetWorldTransform(ACanvas.Handle,form);
end;


procedure TMyPanel.Paint;
begin
  //inherited;
{
   Color := cllime;
   ParentColor := false;
   if not ParentColor then
      begin
       Canvas.Brush.Color := Color;
       Canvas.FillRect(BoundsRect);
      end;
}
   SetCanvasZoomAndRotation(Canvas,1,Angle,FCenter.X,FCenter.Y);
   Canvas.Brush.Style := bsClear;
   Canvas.Font.Assign(Font);
   Canvas.TextOut(0,0,Caption);
end;

procedure TMyPanel.SetAngle(const Value: Double);
begin
  FAngle := Value;
  invalidate;
end;

procedure TMyPanel.SetCenter(const Value: TPoint);
begin
  FCenter := Value;
  invalidate;
end;

procedure TForm1.Button1Click(Sender: TObject);
var
  I: Integer;
begin
  With TMyPanel.Create(self) do
    begin
      DoubleBuffered := true;
      Parent := Self;
      Font.Size := 12;
      Left := 0;
      Top := 0;
      Height := 100;
      Width := 100;
      Caption := 'Test';
      Angle := -90;
      Center := Point(Width div 2,Height div 2);
      for I := -90 to 0 do
         begin
           Angle := i;
           sleep(20);
           Application.ProcessMessages;
         end;

    end;
end;

end.

t0mmy 25. Mai 2013 13:36

AW: Label-Komponente um 90 Grad drehung
 
Wär nicht nötig gewesen da ich ja die eigenschaft Orientation habe - trotzdem danke ;)


Alle Zeitangaben in WEZ +1. Es ist jetzt 09:46 Uhr.

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