UpDown

概要:アップダウンバー・トラックバーの利用。

以下、ソース。

/*---------------------------------------------------------------------------
UpDown1およびTrackBar1の使い方

---------------------------------------------------------------------------*/
#include 
#pragma hdrstop

#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
	: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::UpDown1Click(TObject *Sender, TUDBtnType Button)
{
	Label1->Caption = UpDown1->Position;	
}
//---------------------------------------------------------------------------
void __fastcall TForm1::TrackBar1Change(TObject *Sender)
{
	Label2->Caption = TrackBar1->Position;	
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
	UpDown1->Position = 0;
    Label1->Caption = "0";
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
	TrackBar1->Position = 0;
    Label2->Caption = "0";

}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
	UpDown1->Max =  50;
    UpDown1->Min = -50;

    TrackBar1->Orientation = trHorizontal;
    TrackBar1->Max = 15;
    TrackBar1->Min = -15;
}
//---------------------------------------------------------------------------

C++Builder入門トップ