⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.cs

📁 Visual C#2005程序设计教程
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WinApp6_1类与对象示例
{
    public partial class Form1 : Form
    {
        Cuboid cubiod = new Cuboid();
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            double l = double.Parse(txtLength.Text);
            double w = double.Parse(txtWidth.Text);
            double h = double.Parse(txtHigh.Text);
            cubiod.Length = l;
            cubiod.Width = w;
            cubiod.High = h;
            lblInfo.Text = "对象值设置完毕!";
        }

        private void button2_Click(object sender, EventArgs e)
        {
            lblInfo.Text = "长方体的长:" + cubiod.Length + "  宽:" + cubiod.Width
                + "  高:" + cubiod.High;
        }
    }
    class Cuboid
    {
        private double length;
        private double width;
        private double high;
        public double Length { get { return length; } set { length = value; } }
        public double Width { get { return width; } set { width = value; } }
        public double High { get { return high; } set { high = value; } }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -