日期:2014-05-17  浏览次数:20758 次

图片打开问题
private void btnopen_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.InitialDirectory = "c:\\";
            ofd.Filter = "所有图像文件 | *.bmp; *.pcx; *.png; *.jpg; *.gif;" +
                "*.tif; *.ico; *.dxf; *.cgm; *.cdr; *.wmf; *.eps; *.emf|" +
                "位图( *.bmp; *.jpg; *.png;...) | *.bmp; *.pcx; *.png; *.jpg; *.gif; *.tif; *.ico|" +
                "矢量图( *.wmf; *.eps; *.emf;...) | *.dxf; *.cgm; *.cdr; *.wmf; *.eps; *.emf";
            ofd.Title = "打开图片";
            ofd.RestoreDirectory = true;
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                CurFileName = ofd.FileName;
                try
                {
                    CurBitmap = (Bitmap)Image.FromFile(CurFileName);
                    txtbx.Text = ofd.FileName;
                }
                catch (Exception exp)
                {
                    MessageBox.Show(exp.Message);
                }

            }
            Invalidate();
            }
          private void wiener_Paint(object sender, PaintEventArgs e)
        {
            Graphics g = e.Graphics;
            if (CurBitmap != null)
            {
                g.DrawImage(CurBitmap, 160, 20, CurBitmap.Width, CurBitmap.Height);
   &