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
| __fastcall jGroupBox::jGroupBox(TComponent *AOwner)
: TGroupBox(AOwner)
{
if(AOwner->InheritsFrom(__classid(TWinControl))) Parent = (TWinControl*)AOwner;
Caption = "Pour blondelle";
//Je rajoute 2 RadioButton à gauche de la séparation
int we = (Width /2) - 8;
CreateRadioButton(Rect(8,16, we, 16), "Tag 1");
CreateRadioButton(Rect(8,32, we, 16), "Tag 2");
//Je rajoute 2 CheckBox à droite de la séparation
we = (Width /2) + 8;
CreateCheckBox(Rect(we, 16, we-17, 16), "Opt 3");
CreateCheckBox(Rect(we, 32, we-17, 16), "Opt 4");
}
__fastcall jGroupBox::~jGroupBox()
{
}
void __fastcall jGroupBox::CreateRadioButton(TRect R, AnsiString N)
{
TRadioButton *Btn = new TRadioButton(this);
Btn->Parent = this;
Btn->SetBounds(R.Left, R.Top, R.Right, R.Bottom);
Btn->Caption = N;
}
void __fastcall jGroupBox::CreateCheckBox(TRect R, AnsiString N)
{
TCheckBox *Cbox = new TCheckBox(this);
Cbox->Parent = this;
Cbox->SetBounds(R.Left, R.Top, R.Right, R.Bottom);
Cbox->Caption = N;
}
void __fastcall jGroupBox::Paint()
{
TGroupBox::Paint();
//Je dessine une séparation verticale, en relief
int we = Width/2;
Canvas->Pen->Style = psSolid;
Canvas->Pen->Color = clBlack;
Canvas->Pen->Mode = pmCopy;
Canvas->MoveTo(we, 6); Canvas->LineTo(we, Height-1);
Canvas->Pen->Color = clWhite;
Canvas->MoveTo(we+1, 6); Canvas->LineTo(we+1, Height-1);
} |
Partager