Autor Beitrag
Fabian E.
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 554

Windows 7 Ultimate
Visual Studio 2008 Pro, Visual Studion 2010 Ultimate
BeitragVerfasst: Fr 12.01.07 21:45 
hi!

ich würde gerne meine form in mehrere abschnitte unterteilen! diese sollen später eine unterschiedliche färbung erhalten. ich würde hierfür auch panels oder ähnliches nehmen aber da die form transparent ist bringt mir das nix. gibt es nun einen möglichkeit meine form in mehrer teile sagen wir quadrate oder streifen zu teilen? oder kann ich dies auch anders realisieren?

Vielen dank!

Fabi
JayEff
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2971

Windows Vista Ultimate
D7 Enterprise
BeitragVerfasst: Fr 12.01.07 22:05 
Wenn es nur um die Färbung geht, dann zeichne einfach im onPaint der Form auf das Canvas der Form ([df]DoubleBuffered[df] nicht vergessen!).

_________________
>+++[>+++[>++++++++<-]<-]<++++[>++++[>>>+++++++<<<-]<-]<<++
[>++[>++[>>++++<<-]<-]<-]>>>>>++++++++++++++++++.+++++++.>++.-.<<.>>--.<+++++..<+.
Fabian E. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 554

Windows 7 Ultimate
Visual Studio 2008 Pro, Visual Studion 2010 Ultimate
BeitragVerfasst: Fr 12.01.07 22:19 
ok! der Vorschlag hört sich sinnvoll an! nur leider muss ich gestehen dass ich von canvas wirklich null ahnung hab :lol: naja werd wohl mal bissl suchen gehn... ma sehn ob ich was finde^^
JayEff
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2971

Windows Vista Ultimate
D7 Enterprise
BeitragVerfasst: Fr 12.01.07 22:25 
Mach das, ist echt ganz einfach.
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
var rect:TRect; //einfach nur ein Record der 4 Integerwerte hat
begin
  Canvas.MoveTo(10,10); //"Cursor" an eine Stelle bewegen=Startpunkt der Linie
  Canvas.LineTo(50,50); //Linie von 10,10 nach 50,50 zeichnen
  Rect.Left:=50; //links oberer punkt wird durch Left und Top angegeben.
  Rect.Top:=50;
  Rect.Bottom:=100; //rechts unterer punkt durch right&Bottom
  Rect.Right:=100;
  Canvas.Brush.Color:=clRed; //Brush=Pinsel, Farbe des Pinsels setzen
  Canvas.FillRect(rect); //FillRect: Rechteck mit einer Farbe ausgefüllt zeichnen
end;

Nur so als kleines Beispiel. Spiel mal damit rum!

_________________
>+++[>+++[>++++++++<-]<-]<++++[>++++[>>>+++++++<<<-]<-]<<++
[>++[>++[>>++++<<-]<-]<-]>>>>>++++++++++++++++++.+++++++.>++.-.<<.>>--.<+++++..<+.
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Fr 12.01.07 22:29 
Schreib einfach "Canvas.", dann siehst du ja, was du damit machen kannst... Die Befehle wie DrawLine und so sollten selbsterklärend sein. ;-)
Wichtig: Alles, was du so zeichnest, wird wieder beim Neuzeichnen gelöscht! Also bspw. wenn ein anderes Formular drübergeschoben wird. Deshalb musst du ALLES, was sichtbar sein soll, in OnPaint neu zeichnen.

Ggf. zeichne es in eine TBitmap und zeichne in OnPaint nur die mit BitBlt aufs Formular, wenn es zu sehr flackert oder so. Aber erstmal muss das ja nicht sein. ;-)
Fabian E. Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 554

Windows 7 Ultimate
Visual Studio 2008 Pro, Visual Studion 2010 Ultimate
BeitragVerfasst: Fr 12.01.07 23:12 
danke! :D
das war genau das was ich gesucht hab! :wink:

Fabi