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

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

        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog dig = new OpenFileDialog();
            if (dig.ShowDialog() == DialogResult.OK)
            {

                pictureBox1.Image = Image.FromFile(dig.FileName);
                pictureBox1.Top = (ClientRectangle.Height - pictureBox1.Height) / 2;
                pictureBox1.Left = (ClientRectangle.Width - pictureBox1.Width) / 2;

            }
        }
    }
}

 

相关文章:

  • 2022-12-23
  • 2021-05-16
  • 2021-11-11
  • 2022-12-23
  • 2021-11-29
  • 2022-12-23
  • 2021-09-10
  • 2022-12-23
猜你喜欢
  • 2021-06-07
  • 2021-10-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-18
相关资源
相似解决方案