示例#1
0
        private void B_ImportPNG_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog
            {
                Filter   = "PNG File|*.png",
                FileName = "Background.png",
            };

            if (ofd.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            Bitmap img = (Bitmap)Image.FromFile(ofd.FileName);

            try
            {
                bg.SetImage(img);
                PB_Background.Image = bg.GetImage();
            }
            catch (Exception ex)
            {
                WinFormsUtil.Error(ex.Message);
            }
        }