Bonjours a tous
Il y a quelques temps j'avais poste sur le sujet, mes recherches non pas apportees de reponses satisfaisantes, pour mes besoins j'ai repris mes recherches cette fois ci avec un oeuil neuf, je peux ecrire sur le Canvas de plusieurs composants verticalement
le .cpp
Le code fonctionne pour une TForm, un TPanel, un TBevel, un TShape, un TButton
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54 #include "Unit1.h" #include "StrUtils.hpp" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TForm1 *Form1; //--------------------------------------------------------------------------- __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { } //--------------------------------------------------------------------------- void __fastcall TForm1::Button1Click(TObject *Sender) { // La chaine a afficher verticalement String Dstr = "C++ Builder affichage vertical"; // Nombre de caracteres de la chaine int lng = Dstr.Length(); // Hauteur de la Fonte int Y = Canvas->TextHeight("W"); // Largeur de la Fonte int X = Canvas->TextWidth("W"); // affichage vertical de la chaine for(int i = 1; i <= lng; i++) { String c = MidStr(Dstr, i, 1); Canvas->TextOut(X, Y * i, c); } } //--------------------------------------------------------------------------- void __fastcall TForm1::Button3Click(TObject *Sender) { // La chaine a afficher verticalement String Dstr = "C++ Builder affichage vertical"; // Nombre de caracteres de la chaine int lng = Dstr.Length(); // Hauteur de la Fonte int Y = Canvas->TextHeight("W"); // Largeur de la Fonte int X = Canvas->TextWidth("W"); TControlCanvas * pcn = new TControlCanvas; //pcn->Control = Panel1; //pcn->Control = Bevel1; //pcn->Control = Shape1; pcn->Control = Button2; // affichage vertical de la chaine for(int i = 1; i <= lng; i++) { String c = MidStr(Dstr, i, 1); pcn->TextOutA(X, Y * i, c); } } //---------------------------------------------------------------------------
Etrangement je n'ai pas reussi pour un TLabel, mais je continue a chercher
Partager