From 63015dea5097d8873661ceac49cb226db9f84692 Mon Sep 17 00:00:00 2001 From: taynpg Date: Wed, 19 Mar 2025 23:50:09 +0800 Subject: [PATCH] =?UTF-8?q?add=EF=BC=9Aresizable?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.cpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/main.cpp b/main.cpp index 479abb5..47a5cfc 100644 --- a/main.cpp +++ b/main.cpp @@ -1,5 +1,6 @@ #include #include +#include #include #include @@ -40,7 +41,26 @@ int demo1(int argc, char** argv) return Fl::run(); } +int demo2() +{ + auto* dialog = new Fl_Window(300, 100); + auto* icon = new Fl_Box(0, 0, 50, 50, "!"); + auto* text = new Fl_Box(50, 0, 250, 40, "Out of Memory Error"); + auto* btns = new Fl_Group(50, 50, 250, 50); // parent group + auto* darn = new Fl_Button(200, 50, 100, 50, "Darn!"); + auto* R = new Fl_Box(50, 50, 150, 50); // "invisible" box "R" + R->hide(); // make sure it's invisible + btns->resizable(R); // make "R" parent group resizable + btns->end(); + dialog->resizable(darn); + dialog->end(); + dialog->show(); + // 运行事件循环 + return Fl::run(); +} + int main(int argc, char** argv) { - demo1(argc, argv); + // demo1(argc, argv); + demo2(); } \ No newline at end of file