开发者

how to save picture in Windows CE?

i have Picturebox control that contain any picture - on my form

how i can save this picture 开发者_如何学Go?

in Windows-CE C#

thank's in advance


Like this:

pictureBox.Image.Save(path, ImageFormat.Bmp);


Well you've not given us much to go on at all, but I decided to try anyway. This works fine for me:

    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            pictureBox1.Paint += new PaintEventHandler(pictureBox1_Paint);
        }

        Bitmap m_cache;

        void pictureBox1_Paint(object sender, PaintEventArgs e)
        {
            if (m_cache == null)
            {
                m_cache = new Bitmap(pictureBox1.Width, pictureBox1.Height);
                var g = Graphics.FromImage(m_cache);
                g.FillRectangle(new SolidBrush(Color.White), 
                                0, 0, m_cache.Width, m_cache.Height);
                g.DrawString("Hello World", this.Font, 
                             new SolidBrush(Color.Black), 0, 0);
            }

            e.Graphics.DrawImage(m_cache, 0, 0);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            m_cache.Save("\\myimage.jpg", ImageFormat.Jpeg);
        }
    }

pictureBox1 is a PictureBox on Form1.

If this doesn't point you in the right direction, then you really need to post some code.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜