From: Alberto on
I have a Panel with some Labels and lines who were draw using Graphics and
the method DrawLine().
When I use the method DrawToBitmap() the image saved to disk has the labels
but doesn't have the lines.

Does anybody know why?
Is it posible to save the image to a jpg file instead to bmp?

Thak you very much.


From: Peter Duniho on
On Mon, 05 Oct 2009 13:49:10 -0700, Alberto <alberto(a)nospam.es> wrote:

> I have a Panel with some Labels and lines who were draw using Graphics
> and the method DrawLine().
> When I use the method DrawToBitmap() the image saved to disk has the
> labels but doesn't have the lines.
>
> Does anybody know why?

No. You didn't post any code showing what you're actually doing.
Obviously, the lines aren't being drawn as part of the operation invoked
by the call to DrawToBitmap(), but without specific information, there's
nothing to be said about why that might be.

> Is it posible to save the image to a jpg file instead to bmp?

Yes. There are Save() method overloads that let you do that.

Pete
From: Alberto on
This is the code who save the content of the Panel in a bmp file.

SaveFileDialog saveFileDialog = new SaveFileDialog();

saveFileDialog.DefaultExt = "bmp";
saveFileDialog.Filter = "Bitmap files|*.bmp";
if (saveFileDialog.ShowDialog() == DialogResult.OK)
{
int width = panel.Width;
int height = panel.Height;

Bitmap bitMap = new Bitmap(width,height);
Rectangle rec = new Rectangle(0, 0,width,height);

panel.DrawToBitmap(bitMap, rec);

bitMap.Save(saveFileDialog.FileName);
}

Could you tell me how to save in jpg instead than a bmp?
Thank you


"Peter Duniho" <no.peted.spam(a)no.nwlink.spam.com> escribió en el mensaje de
noticias news:op.u1cki7z5vmc1hu(a)macbook-pro.local...
> On Mon, 05 Oct 2009 13:49:10 -0700, Alberto <alberto(a)nospam.es> wrote:
>
>> I have a Panel with some Labels and lines who were draw using Graphics
>> and the method DrawLine().
>> When I use the method DrawToBitmap() the image saved to disk has the
>> labels but doesn't have the lines.
>>
>> Does anybody know why?
>
> No. You didn't post any code showing what you're actually doing.
> Obviously, the lines aren't being drawn as part of the operation invoked
> by the call to DrawToBitmap(), but without specific information, there's
> nothing to be said about why that might be.
>
>> Is it posible to save the image to a jpg file instead to bmp?
>
> Yes. There are Save() method overloads that let you do that.
>
> Pete

From: Mark Rae [MVP] on
"Alberto" <alberto(a)nospam.es> wrote in message
news:F62573F5-5AEF-4205-A38C-F928FD44140E(a)microsoft.com...

> This is the code who save the content of the Panel in a bmp file.
>
> SaveFileDialog saveFileDialog = new SaveFileDialog();
>
> saveFileDialog.DefaultExt = "bmp";
> saveFileDialog.Filter = "Bitmap files|*.bmp";
> if (saveFileDialog.ShowDialog() == DialogResult.OK)
> {
> int width = panel.Width;
> int height = panel.Height;
>
> Bitmap bitMap = new Bitmap(width,height);
> Rectangle rec = new Rectangle(0, 0,width,height);
>
> panel.DrawToBitmap(bitMap, rec);
>
> bitMap.Save(saveFileDialog.FileName);
> }
>
> Could you tell me how to save in jpg instead than a bmp?

Bitmap bitMap = new Bitmap(panel.Width, panel.Height);
panel.DrawToBitmap(bitMap, new Rectangle(0, 0, panel.Width, panel.Height));
bitMap.Save(saveFileDialog.FileName,
System.Drawing.Imaging.ImageFormat.Jpeg);


--
Mark Rae
ASP.NET MVP
http://www.markrae.net

From: Alberto on
Thank you.

Do you know why the lines that I draw with DrawLine aren't save in the file?

"Mark Rae [MVP]" <mark(a)markNOSPAMrae.net> escribió en el mensaje de noticias
news:OXiilTnRKHA.4504(a)TK2MSFTNGP04.phx.gbl...
> "Alberto" <alberto(a)nospam.es> wrote in message
> news:F62573F5-5AEF-4205-A38C-F928FD44140E(a)microsoft.com...
>
>> This is the code who save the content of the Panel in a bmp file.
>>
>> SaveFileDialog saveFileDialog = new SaveFileDialog();
>>
>> saveFileDialog.DefaultExt = "bmp";
>> saveFileDialog.Filter = "Bitmap files|*.bmp";
>> if (saveFileDialog.ShowDialog() == DialogResult.OK)
>> {
>> int width = panel.Width;
>> int height = panel.Height;
>>
>> Bitmap bitMap = new Bitmap(width,height);
>> Rectangle rec = new Rectangle(0, 0,width,height);
>>
>> panel.DrawToBitmap(bitMap, rec);
>>
>> bitMap.Save(saveFileDialog.FileName);
>> }
>>
>> Could you tell me how to save in jpg instead than a bmp?
>
> Bitmap bitMap = new Bitmap(panel.Width, panel.Height);
> panel.DrawToBitmap(bitMap, new Rectangle(0, 0, panel.Width,
> panel.Height));
> bitMap.Save(saveFileDialog.FileName,
> System.Drawing.Imaging.ImageFormat.Jpeg);
>
>
> --
> Mark Rae
> ASP.NET MVP
> http://www.markrae.net