CheckBox・RadioButton・RadioGroupの使用方法

 

CheckBoxの設定
RadioButtonの設定
RadioGroupの設定
RadioButtonの設定
2/3
2/3

[表示]ボタンのOnClickイベントで日付表示の部分を次のように修正します。


procedure TForm1.Button1Click(Sender: TObject);
begin
  //リストボックスクリア
  Listbox1.Clear;

  //日付表示
  //if  CheckBox1.Checked then
  //  Listbox1.Items.Add(DateToStr(Now));
  if  CheckBox1.Checked then
  begin
    //西暦
    if  RadioButton1.Checked  then
      Listbox1.Items.Add(FormatDateTime('yyyy年mm月dd日',Now))
    else
    //和暦
    if  RadioButton2.Checked  then
      Listbox1.Items.Add(FormatDateTime('ggee年mm月dd日',Now))
    else
    //どちらも未選択(ローカライゼーション情報より形式指定)
      Listbox1.Items.Add(DateToStr(Now));
  end;
 ・・・

2/3