注册 登录
编程论坛 C语言论坛

求助 窗口上的按键

追梦人zmrghy 发布于 2022-08-12 22:13, 788 次点击
只有本站会员才能查看附件,请 登录


 这种按键上的图标,还有文字,的效果是如何弄出来的。
按键之间的竖杠 分割线,是如何弄出来的。

只有本站会员才能查看附件,请 登录


程序代码:
#pragma once

namespace BoxGame {

    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>
   
/// Form1 摘要
   
/// </summary>
    public ref class Form1 : public System::Windows::Forms::Form
    {
    public:
        Form1(void)
        {
            InitializeComponent();
            //
            
//TODO: 在此处添加构造函数代码
            
//
        }

    protected:
        /// <summary>
        
/// 清理所有正在使用的资源。
        
/// </summary>
        ~Form1()
        {
            if (components)
            {
                delete components;
            }
        }
    private: System::Windows::Forms::TableLayoutPanel^  tableLayoutPanel1;
    protected:
    private: System::Windows::Forms::Label^  label1;
    private: System::Windows::Forms::Label^  label2;
    private: System::Windows::Forms::Panel^  panel1;
    private: System::Windows::Forms::Panel^  panel2;



    private:
        /// <summary>
        
/// 必需的设计器变量。
        
/// </summary>
        System::ComponentModel::Container ^components;

#pragma region Windows Form Designer generated code
        /// <summary>
        
/// 设计器支持所需的方法 - 不要
        
/// 使用代码编辑器修改此方法的内容。
        
/// </summary>
        void InitializeComponent(void)
        {
            System::ComponentModel::ComponentResourceManager^  resources = (gcnew System::ComponentModel::ComponentResourceManager(Form1::typeid));
            this->tableLayoutPanel1 = (gcnew System::Windows::Forms::TableLayoutPanel());
            this->label1 = (gcnew System::Windows::Forms::Label());
            this->label2 = (gcnew System::Windows::Forms::Label());
            this->panel1 = (gcnew System::Windows::Forms::Panel());
            this->panel2 = (gcnew System::Windows::Forms::Panel());
            this->tableLayoutPanel1->SuspendLayout();
            this->SuspendLayout();
            //
            
// tableLayoutPanel1
            
//
            this->tableLayoutPanel1->CellBorderStyle = System::Windows::Forms::TableLayoutPanelCellBorderStyle::OutsetDouble;
            this->tableLayoutPanel1->ColumnCount = 2;
            this->tableLayoutPanel1->ColumnStyles->Add((gcnew System::Windows::Forms::ColumnStyle(System::Windows::Forms::SizeType::Percent,
                44.6281F)));
            this->tableLayoutPanel1->ColumnStyles->Add((gcnew System::Windows::Forms::ColumnStyle(System::Windows::Forms::SizeType::Percent,
                55.3719F)));
            this->tableLayoutPanel1->Controls->Add(this->label1, 0, 0);
            this->tableLayoutPanel1->Controls->Add(this->label2, 1, 0);
            this->tableLayoutPanel1->Dock = System::Windows::Forms::DockStyle::Bottom;
            this->tableLayoutPanel1->Location = System::Drawing::Point(0, 501);
            this->tableLayoutPanel1->Name = L"tableLayoutPanel1";
            this->tableLayoutPanel1->RowCount = 1;
            this->tableLayoutPanel1->RowStyles->Add((gcnew System::Windows::Forms::RowStyle(System::Windows::Forms::SizeType::Percent, 50)));
            this->tableLayoutPanel1->Size = System::Drawing::Size(484, 28);
            this->tableLayoutPanel1->TabIndex = 0;
            //
            
// label1
            
//
            this->label1->AutoSize = true;
            this->label1->BorderStyle = System::Windows::Forms::BorderStyle::Fixed3D;
            this->label1->Dock = System::Windows::Forms::DockStyle::Fill;
            this->label1->Location = System::Drawing::Point(6, 3);
            this->label1->Name = L"label1";
            this->label1->Size = System::Drawing::Size(205, 22);
            this->label1->TabIndex = 0;
            this->label1->Text = L"label1";
            //
            
// label2
            
//
            this->label2->AutoSize = true;
            this->label2->BorderStyle = System::Windows::Forms::BorderStyle::Fixed3D;
            this->label2->Dock = System::Windows::Forms::DockStyle::Fill;
            this->label2->Location = System::Drawing::Point(220, 3);
            this->label2->Name = L"label2";
            this->label2->Size = System::Drawing::Size(258, 22);
            this->label2->TabIndex = 1;
            this->label2->Text = L"label2";
            //
            
// panel1
            
//
            this->panel1->BorderStyle = System::Windows::Forms::BorderStyle::FixedSingle;
            this->panel1->Dock = System::Windows::Forms::DockStyle::Top;
            this->panel1->Location = System::Drawing::Point(0, 0);
            this->panel1->Name = L"panel1";
            this->panel1->Size = System::Drawing::Size(484, 51);
            this->panel1->TabIndex = 1;
            //
            
// panel2
            
//
            this->panel2->BackColor = System::Drawing::Color::Black;
            this->panel2->Dock = System::Windows::Forms::DockStyle::Fill;
            this->panel2->Location = System::Drawing::Point(0, 51);
            this->panel2->Name = L"panel2";
            this->panel2->Size = System::Drawing::Size(484, 450);
            this->panel2->TabIndex = 2;
            //
            
// Form1
            
//
            this->AutoScaleDimensions = System::Drawing::SizeF(6, 12);
            this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
            this->ClientSize = System::Drawing::Size(484, 529);
            this->Controls->Add(this->panel2);
            this->Controls->Add(this->panel1);
            this->Controls->Add(this->tableLayoutPanel1);
            this->Icon = (cli::safe_cast<System::Drawing::Icon^  >(resources->GetObject(L"$this.Icon")));
            this->MaximizeBox = false;
            this->MaximumSize = System::Drawing::Size(598, 568);
            this->MinimumSize = System::Drawing::Size(500, 568);
            this->Name = L"Form1";
            this->Text = L"推箱子游戏";
            this->tableLayoutPanel1->ResumeLayout(false);
            this->tableLayoutPanel1->PerformLayout();
            this->ResumeLayout(false);

        }
#pragma endregion
    };
}

3 回复
#2
apull2022-08-13 11:55
只有本站会员才能查看附件,请 登录
#3
追梦人zmrghy2022-08-14 13:41
回复 2楼 apull
多谢指教。。。
按键已经完成了。。。
只有本站会员才能查看附件,请 登录


新的问题又来了!!!
窗口底部,应该使用状态栏。
如果使用状态栏,增加toolStripStatusLabel, Label的宽度是自动的,需要显示字符多长,Label宽度就多长。
原游戏,底部的效果是如何实现的呀
#4
追梦人zmrghy2022-08-14 14:06
回复 2楼 apull
麻烦你了,我又找到答案了。。。

只有本站会员才能查看附件,请 登录
1