qq_42376148
qq_42376148
采纳率50%
2019-04-28 16:24 阅读 663

求大神帮忙windows程序设计的问题(用visual studio)

5

编写Windows窗口应用程序实现对话框与菜单的应用
1)编程实现如下应用程序,含有菜单,单击“新建”时弹出新建对话框(非模态对话框),单击对话框颜色按钮后应用程序窗口字体和背景色发生相应的变化。单击“关于”菜单项时弹出关于对话框(模态对话框)。
(Winodws对话框、Windows菜单)
用WM_XXXXX

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

3条回答 默认 最新

  • 已采纳
    qq_42376148 qq_42376148 2019-05-09 14:07

    问题重新发了,请根据要求,谢谢~

    点赞 评论 复制链接分享
  • caozhy 从今以后生命中的每一秒都属于我爱的人 2019-04-28 16:47

    图片说明

    #include "frmNew.h"
    
    #pragma once
    
    namespace Q759101 {
    
        using namespace System;
        using namespace System::ComponentModel;
        using namespace System::Collections;
        using namespace System::Windows::Forms;
        using namespace System::Data;
        using namespace System::Drawing;
    
        /// <summary>
        /// Summary for Form1
        /// </summary>
        public ref class Form1 : public System::Windows::Forms::Form
        {
        public:
            Form1(void)
            {
                InitializeComponent();
                //
                //TODO: Add the constructor code here
                //
            }
    
        protected:
            /// <summary>
            /// Clean up any resources being used.
            /// </summary>
            ~Form1()
            {
                if (components)
                {
                    delete components;
                }
            }
        private: System::Windows::Forms::MenuStrip^  menuStrip1;
        protected: 
        private: System::Windows::Forms::ToolStripMenuItem^  toolStripMenuItem1;
        private: System::Windows::Forms::ToolStripMenuItem^  izToolStripMenuItem;
        private: System::Windows::Forms::ToolStripMenuItem^  ssToolStripMenuItem;
        private: System::Windows::Forms::ToolStripMenuItem^  sssToolStripMenuItem;
    
        private:
            /// <summary>
            /// Required designer variable.
            /// </summary>
            System::ComponentModel::Container ^components;
    
    #pragma region Windows Form Designer generated code
            /// <summary>
            /// Required method for Designer support - do not modify
            /// the contents of this method with the code editor.
            /// </summary>
            void InitializeComponent(void)
            {
                this->menuStrip1 = (gcnew System::Windows::Forms::MenuStrip());
                this->toolStripMenuItem1 = (gcnew System::Windows::Forms::ToolStripMenuItem());
                this->izToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                this->ssToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                this->sssToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
                this->menuStrip1->SuspendLayout();
                this->SuspendLayout();
                // 
                // menuStrip1
                // 
                this->menuStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(1) {this->toolStripMenuItem1});
                this->menuStrip1->Location = System::Drawing::Point(0, 0);
                this->menuStrip1->Name = L"menuStrip1";
                this->menuStrip1->Size = System::Drawing::Size(415, 24);
                this->menuStrip1->TabIndex = 0;
                this->menuStrip1->Text = L"menuStrip1";
                // 
                // toolStripMenuItem1
                // 
                this->toolStripMenuItem1->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(3) {this->izToolStripMenuItem, 
                    this->ssToolStripMenuItem, this->sssToolStripMenuItem});
                this->toolStripMenuItem1->Name = L"toolStripMenuItem1";
                this->toolStripMenuItem1->Size = System::Drawing::Size(46, 20);
                this->toolStripMenuItem1->Text = L" 菜单";
                // 
                // izToolStripMenuItem
                // 
                this->izToolStripMenuItem->Name = L"izToolStripMenuItem";
                this->izToolStripMenuItem->Size = System::Drawing::Size(98, 22);
                this->izToolStripMenuItem->Text = L"新建";
                this->izToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::izToolStripMenuItem_Click);
                // 
                // ssToolStripMenuItem
                // 
                this->ssToolStripMenuItem->Name = L"ssToolStripMenuItem";
                this->ssToolStripMenuItem->Size = System::Drawing::Size(98, 22);
                this->ssToolStripMenuItem->Text = L"颜色";
                this->ssToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::ssToolStripMenuItem_Click);
                // 
                // sssToolStripMenuItem
                // 
                this->sssToolStripMenuItem->Name = L"sssToolStripMenuItem";
                this->sssToolStripMenuItem->Size = System::Drawing::Size(98, 22);
                this->sssToolStripMenuItem->Text = L"关于";
                this->sssToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::sssToolStripMenuItem_Click);
                // 
                // Form1
                // 
                this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
                this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
                this->BackColor = System::Drawing::Color::White;
                this->ClientSize = System::Drawing::Size(415, 268);
                this->Controls->Add(this->menuStrip1);
                this->Name = L"Form1";
                this->Text = L"Form1";
                this->menuStrip1->ResumeLayout(false);
                this->menuStrip1->PerformLayout();
                this->ResumeLayout(false);
                this->PerformLayout();
    
            }
    #pragma endregion
        private: System::Void izToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
                     frmNew^ f = (gcnew frmNew());
                     f->Show();
                 }
        private: System::Void sssToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
                     MessageBox::Show("About this app");
                 }
        private: System::Void ssToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
                 ColorDialog^ cd = (gcnew ColorDialog());
                 if (cd->ShowDialog() == System::Windows::Forms::DialogResult::OK)
                 {
                    this->BackColor = cd->Color;
                 }
             }
    };
    }
    
    
    点赞 1 评论 复制链接分享
  • q446002320 BMKB 2019-04-29 11:58

    使用MaterialDesignInXamlToolkit-master插件试试,设计的更美观,使用更方便

    点赞 1 评论 复制链接分享

相关推荐