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
| class RPanel : public TPanel
{
public :
int IniTop;
int IniLeft;
int IniHeight;
int IniWidth;
__fastcall RPanel( TWinControl *O,
//le propriétaire de l'objet
int T, //Top initial
int L, //Left initial
int W, //Width initial
int H, //Height initial
TWinControl *P, //Le parent de l'objet
);
__fastcall ~RPanel();
void __fastcall ReDim(double *W, double *H);
};
__fastcall RPanel::RPanel(TWinControl *C, int T, int L, int W,
int H, TWinControl *P)
: TPanel(C)
{
//Initialisation des propriétés des objets de base
Top = T; Left = L; W = Width; Height = H; Parent = P;
//Report des valeurs dans les propriétés de mémorisation de la nouvelle classe
IniTop = T; IniLeft = L; IniWidth = W; IniHeight = H;
//Eventuellement modifier les propriétés qui doivent l'être...
}
void __fastcall RPanel::ReDim(double *W, double *H)
{
//Réactualisation des paramètres : nouvelle valeur = valeur intiale * facteur
Left = (int)((double)IniLeft * *W);
Width = (int)((double)IniWidth * *W);
Top = (int)((double)IniTop * *H);
Height = (int)((double)IniHeight * *H);
} |
Partager