C# GUI+开发一个简易画板

  • Post author:
  • Post category:其他


利用C#的窗口程序开发一个简易画板



父窗体

在这里插入图片描述

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Sketchpad
{
   
    public partial class Form1 : Form
    {
   
        public Form1()
        {
   
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
   
            保存SToolStripMenuItem.Enabled = false;
            this.timer1.Interval = 1000;
            this.timer1.Enabled = true;
            IsMdiContainer = true;
            垂直平铺ToolStripMenuItem.Enabled = false;
            水平平铺ToolStripMenuItem.Enabled = false;
            叠加ToolStripMenuItem.Enabled = false;
            重排ToolStripMenuItem.Enabled = false;
        }

        private void 打开OToolStripMenuItem_Click(object sender, EventArgs e)
        {
   
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.Title = "打开文件";
            ofd.Filter = "图片文件(*.jpg;*.png)|*.jpg;*.png|所有文件(*.*)|*.*";
            if(ofd.ShowDialog()==DialogResult.OK)
            {
   
                Form2 form = new Form2();
                form.MdiParent = this;
                form.Show();
                form.Text = ofd.FileName;
                string imgPath = ofd.FileName;
                form.pictureBox1.Load(imgPath);
                if (ofd.FileName != "")
                {
   
                    保存SToolStripMenuItem.Enabled = true;
                    垂直平铺ToolStripMenuItem.Enabled = true;
                    水平平铺ToolStripMenuItem.Enabled 



版权声明:本文为qq_38414989原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。