|
delay함수에 timer를 써서 led 조명을 깜박거리게 해놨습니다.
다만 실행 도중 win창을 이동을 시키면 매우 매끄럽지가 않던데 혹시 다른 방법이 없나요?
void __fastcall TForm1::delay(int n)
{
DWORD nStartTM;
nStartTM = GetTickCount();
while(true)
{
if(nStartTM + n < GetTickCount())
return;
}
}
void __fastcall TForm1::Timer1Timer(TObject *Sender)
{
int i;
for(i=0; i<GetTickCount(); i++)
{
VrUserLed1->PaletteEx->Low2 = clRed;
delay(1000);
VrUserLed1->PaletteEx->Low2 = clLime;
delay(1000);
return;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::RadioButton1Click(TObject *Sender)
{
if(RadioButton1->Checked == true)
Timer1->Enabled = true;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::RadioButton2Click(TObject *Sender)
{
if(RadioButton2->Checked == true)
Timer1->Enabled = false;
}
//---------------------------------------------------------------------------
|