老是说我没有定义labelR,labelB,labelG,怎么回事呀?
高手帮帮忙,谢谢
//—————————————————————————
#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::ScrollBarRChange(TObject *Sender)
{
LabelR->Caption=IntToStr(ScrollBarR->Position);
Shape1->Brush->Color=RGB(ScrollBarR->Position,
ScrollBarG->Position,ScrollBarB->Position);
}
//—————————————————————————
void __fastcall TForm1::ScrollBarBChange(TObject *Sender)
{
LabelB->Caption=IntToStr(ScrollBarB->Position) ;
Shape1->Brush->Color=RGB(ScrollBarR->Position,
ScrollBarG->Position,ScrollBarB->Position);
}
//—————————————————————————
void __fastcall TForm1::ScrollBarGhange(TObject *Sender)
{
LabelG->Caption=IntToStr(ScrollBarY->Position) ;
Shape1->Brush->Color=RGB(ScrollBarR->Position,
ScrollBarG->Position,ScrollBarB->Position);
}
//—————————————————————————
void __fastcall TForm1::Button1Click(TObject *Sender)
{
Timer->Enable=true;
}
//—————————————————————————
void __fastcall TForm1::Button2Click(TObject *Sender)
{
Timer->Enable=false;
}
//—————————————————————————
void __fastcall TForm1::Button3Click(TObject *Sender)
{
Form1=close();
}
//—————————————————————————
void __fastcall TForm1::Timer1Timer(TObject *Sender)
{
randomsize();
ScrollBarR->Position=rand()%256;
ScrollBarY->Position=rand()%256;
ScrollBarB->Position=rand()%256;
Shape1->Brush->Color=RGB(ScrollBarR->Position,
ScrollBarY->Position,ScrollBarB->Position);
}
>> 本文固定链接: http://www.vcgood.com/archives/2983
每定义就找个地方定义一下;你是否把标签删除了啊!