掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
MDI形式で起動時にメニューを表示するには? (ID:23461)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
>それをプログラム起動後に >メニューバーの項目を画面にボタンを配置して >メニューを作成したいです。 var MyButton: array of array of TButton; procedure TMainForm.FormShow(Sender: TObject); var x, y: Integer; begin for x:=0 to MainMenu1.Items.Count-1 do begin SetLength(MyButton, x+1); for y:=0 to MainMenu1.Items[x].Count-1 do begin if MainMenu1.Items[x].Items[y].Caption = '-' then Continue; SetLength(MyButton[x], y+1+1); MyButton[x, y+1] := TButton.Create(Self); with MyButton[x, y+1] do begin Parent := MainForm; Width := 150; Height := 25; Top := y * (Height+4) + 90; Left := x * (Width+4) + 50; OnClick := MainMenu1.Items[x].Items[y].OnClick; Caption := MainMenu1.Items[x].Items[y].Caption; Enabled := MainMenu1.Items[x].Items[y].Enabled; OnMouseUp := MyButtonOnMouseUp; end; end; end; for x:=0 to MainMenu1.Items.Count-1 do begin MyButton[x, 0] := TButton.Create(Self); with MyButton[x, 0] do begin Parent := MainForm; Width := 150; Height := 25; Top := 50; Left := x * (Width+4) + 50; Caption := MainMenu1.Items.Items[x].Caption; end; end; MyButton[0, 1].SetFocus; end; procedure TMainForm.MyButtonOnMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); var a, b: Integer; begin for a:=0 to MainMenu1.Items.Count-1 do begin for b:=0 to MainMenu1.Items[a].Count-1+1 do begin MyButton[a,b].Free; end; end; end;
←解決時は質問者本人がここをチェックしてください。
更新する
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.