Bonjour � tous

Voil� je suis en train de d�velopper un composant FireMonkey. Il s'agit d'un composant qui affiche une courbe d�filante. J'ai souhait� faire ce composant car j'ai besoin d'un affichage rapide et l'utilisation de TChart ne r�pondait pas au besoin.
Je me suis inspir� de plusieurs tutoriels (https://sjrd.developpez.com/delphi/tutoriel/composants/ et http://docwiki.embarcadero.com/RADSt...osant_existant )

Je suis parvenu � faire une premi�re version de mon composant mais quand je le d�pose sur une fiche j'ai syst�matiquement cette erreur qui s'affiche: Verrou d'objet non poss�d�

Voici l'ent�te
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
 
//---------------------------------------------------------------------------
 
#ifndef GraphicDefilantH
#define GraphicDefilantH
//---------------------------------------------------------------------------
#include <System.SysUtils.hpp>
#include <System.Classes.hpp>
#include <FMX.Controls.hpp>
#include <FMX.Types.hpp>
//---------------------------------------------------------------------------
class PACKAGE TGraphicDefilant : public TStyledControl
{
private:
	String FFormatX;
	String FFormatY;
    void __fastcall SetFormatX(const String Value);
	void __fastcall SetFormatY(const String Value);
protected:
public:
	__fastcall TGraphicDefilant(TComponent* Owner);
    void __fastcall Paint();
__published:
	__property String FormatX = {read = FFormatX, write = SetFormatX};
	__property String FormatY = {read = FFormatY, write = SetFormatY};
};
//---------------------------------------------------------------------------
#endif
et le cpp
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
 
// ---------------------------------------------------------------------------
 
#include <fmx.h>
 
#pragma hdrstop
 
#include "GraphicDefilant.h"
#pragma package(smart_init)
// ---------------------------------------------------------------------------
// ValidCtrCheck est utilisée pour garantir que les composants créés n'ont pas
// de fonctions virtuelles pures.
//
 
static inline void ValidCtrCheck(TGraphicDefilant *) {
	new TGraphicDefilant(NULL);
}
 
// ---------------------------------------------------------------------------
__fastcall TGraphicDefilant::TGraphicDefilant(TComponent* Owner)
	: TStyledControl(Owner) {
	FFormatX = "%3.2f";
	FFormatY = "%3.2f";
}
 
// ---------------------------------------------------------------------------
namespace Graphicdefilant {
	void __fastcall PACKAGE Register() {
		TComponentClass classes[1] = {__classid(TGraphicDefilant)};
		RegisterComponents(L"Samples", classes, 0);
	}
}
 
// ---------------------------------------------------------------------------
void __fastcall TGraphicDefilant::Paint() {
	TStyledControl::Paint();
 
	double minY = -1;
	double maxY = 1;
	double minX = 0;
	double maxX = 200;
	TVarRec arga[1] = {(long double)minY};
	String stYmin = Format(FormatY, arga, 0);
	TVarRec argb[1] = {(long double)maxY};
	String stYmax = Format(FormatY, argb, 0);
	TVarRec argc[1] = {(long double)minX};
	String stXmin = Format(FormatX, argc, 0);
	TVarRec argd[1] = {(long double)minY};
	String stXmax = Format(FormatX, argd, 0);
 
	int marge = 4;
 
	Canvas->Fill->Color = claWhite;
	Canvas->FillRect(TRectF(0, 0, Width, Height), 0, 0, AllCorners, 100);
 
	float HXtxt = Canvas->TextHeight(stXmin);
	if (Canvas->TextHeight(stXmax) > HXtxt)
		HXtxt = Canvas->TextHeight(stXmax);
 
	float LYtxt = Canvas->TextWidth(stYmin);
	if (Canvas->TextWidth(stYmax) > LYtxt)
		LYtxt = Canvas->TextWidth(stYmax);
 
	float HYtxt1 = Canvas->TextHeight(stYmax);
	float HYtxt0 = Canvas->TextHeight(stYmin);
	float LXtxt1 = Canvas->TextWidth(stXmax);
	float LXtxt0 = Canvas->TextWidth(stXmin);
 
	float Ay = marge + HYtxt1 / 2;
	float Ax = marge + LYtxt + marge;
	float Ox = Ax;
	float Oy = Height - marge - HXtxt - marge;
	float By = Oy;
	float Bx = Width - marge - LXtxt1 / 2 - marge;
 
	Canvas->Stroke->Color = claBlack;
	Canvas->DrawRect(TRectF(Ax, Ay, Bx, By), 0, 0, AllCorners, 100);
 
	Canvas->Fill->Color = claBlack;
	Canvas->FillText(TRectF(marge, marge, marge + LYtxt, marge + HYtxt1),
		stYmax, false, 1, TFillTextFlags() << TFillTextFlag::RightToLeft,
		TTextAlign::Center, TTextAlign::Center);
	Canvas->FillText(TRectF(marge, Oy - HYtxt0 / 2, marge + LYtxt,
		Oy - HYtxt0 / 2 + HYtxt0), stYmin, false, 1,
		TFillTextFlags() << TFillTextFlag::RightToLeft, TTextAlign::Center,
		TTextAlign::Center);
	Canvas->FillText(TRectF(Ox - LXtxt0 / 2, Oy + marge, Ox + LXtxt0 / 2,
		Oy + marge + HXtxt), stXmin, false, 1,
		TFillTextFlags() << TFillTextFlag::RightToLeft, TTextAlign::Center,
		TTextAlign::Center);
	Canvas->FillText(TRectF(Bx - LXtxt1 / 2, Oy + marge, Bx + LXtxt1 / 2,
		Oy + marge + HXtxt), stXmax, false, 1,
		TFillTextFlags() << TFillTextFlag::RightToLeft, TTextAlign::Center,
		TTextAlign::Center);
	Canvas->EndScene();
}
 
// ---------------------------------------------------------------------------
void __fastcall TGraphicDefilant::SetFormatX(const String Value) {
	FFormatX = Value;
}
 
// ---------------------------------------------------------------------------
void __fastcall TGraphicDefilant::SetFormatY(const String Value) {
	FFormatY = Value;
}
// ---------------------------------------------------------------------------
Une id�e d'o� �a peut venir?