如何获得在C#中的图片框绘制图形 [英] how to get the drawing graphic on picture box in c#

查看:472
本文介绍了如何获得在C#中的图片框绘制图形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了一个小组一个PictureBox。我画上的PictureBox一些图形。
我想获得点击按钮的图形。我该怎么做?

I have created a PictureBox in a panel. I drew some graphics on PictureBox. I want to get those graphics on button clicking. How can I do that?

推荐答案

我想你想要的是您有一定的图形绘制在一个图片,你希望这些图形在Button 的点击一个形象,是不是它。我我不知道这是否会工作,但尝试;

I think what you want is You have some graphics drawn over a PictureBox and you want a Image of those graphics on the click of a Button,isn't it.I am not sure if this'll work but try it;

    private void ButtonGetImage_Click(object sender, EventArgs e)
    {
      if (SourcePictureBox.Image != null)//Just to make sure it's not empty.
       {
         Bitmap graphic = new Bitmap(SourcePictureBox.Image);
          {
            //Add some logic to modify Image if you want.
            graphic.Save(@"F:\Image.bmp");//An appropriate path to save the file.
            graphic.Dispose();
          }
       }
    }

这篇关于如何获得在C#中的图片框绘制图形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆