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
|
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
StringGrid1->Cells[1][0] = "Civilites";
}
//---------------------------------------------------------------------------
void __fastcall TForm1::StringGrid1Click(TObject *Sender)
{
if( StringGrid1->Col == 1 )
{
if( StringGrid1->Cells[StringGrid1->Col][StringGrid1->Row] == "Mr")
{
RadioGroup1->ItemIndex = 0;
}
if( StringGrid1->Cells[StringGrid1->Col][StringGrid1->Row] == "Mme")
{
RadioGroup1->ItemIndex = 1;
}
if( StringGrid1->Cells[StringGrid1->Col][StringGrid1->Row] == "Mlle")
{
RadioGroup1->ItemIndex = 2;
}
if( StringGrid1->Cells[StringGrid1->Col][StringGrid1->Row] == "")
{
RadioGroup1->ItemIndex = -1;
}
TRect Recto = StringGrid1->CellRect(StringGrid1->Col, StringGrid1->Row);
RadioGroup1->Top = StringGrid1->Top;
RadioGroup1->Left = StringGrid1->Left;
RadioGroup1->Top = RadioGroup1->Top + Recto.Top + StringGrid1->GridLineWidth;
RadioGroup1->Left = RadioGroup1->Left + Recto.Left + StringGrid1->GridLineWidth + 1;
RadioGroup1->Height = (Recto.Bottom - Recto.Top) + 1;
RadioGroup1->Width = Recto.Right - Recto.Left;
RadioGroup1->Visible = True;
}
else
{
RadioGroup1->Visible = false;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::RadioGroup1Click(TObject *Sender)
{
StringGrid1->Cells[StringGrid1->Col][StringGrid1->Row] = RadioGroup1->Items->Strings[RadioGroup1->ItemIndex];
}
//--------------------------------------------------------------------------- |
Partager