Last active
July 23, 2026 07:14
-
-
Save myaosato/c6e0c26770bc167ae5c6c2b9c2fc9820 to your computer and use it in GitHub Desktop.
https://github.com/dotcl/dotcl を試してみた。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;;;; dotcl https://github.com/dotcl/dotcl で単純なGUIプログラミングを試した。 | |
| ;;;; ボタンが配置されたウィンドウを表示する。 | |
| ;;;; ボタンをクリックするとメッセージボックスが表示される。 | |
| ;; | |
| (let ((form (dotnet:new "System.Windows.Forms.Form")) | |
| (btn (dotnet:new "System.Windows.Forms.Button"))) | |
| ;; プロパティの設定 (タイトル・幅・高さ) | |
| (setf (dotnet:invoke form "Text") "こんにちは dotcl") | |
| (setf (dotnet:invoke form "Width") 480) | |
| (setf (dotnet:invoke form "Height") 270) | |
| ;; ボタンの設定 | |
| (setf (dotnet:invoke btn "Text") "クリックしてね") | |
| ;; ボタンの大きさを変える | |
| (setf (dotnet:invoke btn "Width") 100) | |
| (setf (dotnet:invoke btn "Height") 50) | |
| ;; 画面上の配置位置を指定 | |
| (setf (dotnet:invoke btn "Left") 190) | |
| (setf (dotnet:invoke btn "Top") 85) | |
| ;; イベントハンドラの追加 `btn.Click += (object sender, EventArgs e) => { /* ... */ };` | |
| (dotnet:add-event btn "Click" | |
| (lambda (sender e) | |
| (dotnet:static "System.Windows.Forms.MessageBox" "Show" "ボタンがクリックされました!"))) | |
| ;; ウィンドウにボタンを追加して表示 | |
| (let ((controls (dotnet:invoke form "Controls"))) | |
| (dotnet:invoke controls "Add" btn)) | |
| ;; アプリケーションを実行してウィンドウを表示 | |
| (dotnet:static "System.Windows.Forms.Application" "Run" form)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment