Prev: SV: Type cast depending on the reciever type
Next: VS 2005 MS Orientation Aware Controls designer problem
From: Mark Rae [MVP] on 6 Oct 2009 08:12 "Alberto" <alberto(a)nospam.es> wrote in message news:CC939097-E6D6-47D6-A673-DC89D55AE31D(a)microsoft.com... [please don't top-post] >>> 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); > > Do you know why the lines that I draw with DrawLine aren't saved in the > file? Not without seeing your code... -- Mark Rae ASP.NET MVP http://www.markrae.net
From: Alberto on 6 Oct 2009 13:55 I just wrote in another proyect this code: private void button5_Click(object sender, EventArgs e) { Graphics g = panel1.CreateGraphics(); g.DrawLine(new Pen(Brushes.Blue), new Point(0, 0), new Point(50, 50)); } private void button4_Click(object sender, EventArgs e) { int width = panel1.Width; int height = panel1.Height; Bitmap bitMap = new Bitmap(width, height); Rectangle rec = new Rectangle(0, 0, width, height); panel1.DrawToBitmap(bitMap, rec); bitMap.Save(@"C:/Windows/prueba.bmp"); } The problem is the same. The line didn't appear in the file stored. Thank you for your help "Mark Rae [MVP]" <mark(a)markNOSPAMrae.net> escribi� en el mensaje news:OshcG5nRKHA.4504(a)TK2MSFTNGP04.phx.gbl... > "Alberto" <alberto(a)nospam.es> wrote in message > news:CC939097-E6D6-47D6-A673-DC89D55AE31D(a)microsoft.com... > > [please don't top-post] > >>>> 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); >> >> Do you know why the lines that I draw with DrawLine aren't saved in the >> file? > > Not without seeing your code... > > > -- > Mark Rae > ASP.NET MVP > http://www.markrae.net
From: Jeff Gaines on 6 Oct 2009 18:14 On 06/10/2009 in message <e9L#O4qRKHA.220(a)TK2MSFTNGP02.phx.gbl> Alberto wrote: >The problem is the same. The line didn't appear in the file stored. Does the order of clicking the buttons (4 & 5) affect what is saved? It may be that the Button 4 click function over-writes what was drawn in the Button 5 click function. -- Jeff Gaines Dorset UK All those who believe in psychokinesis raise my hand.
From: Alberto on 6 Oct 2009 18:24 The code of the button4 doesn't delete the graphic area of the panel. If I draw the line in the panel Paint event, the results are the same. "Jeff Gaines" <jgaines_newsid(a)yahoo.co.uk> escribi� en el mensaje de noticias news:xn0gg3e1b1texf3001(a)msnews.microsoft.com... > On 06/10/2009 in message <e9L#O4qRKHA.220(a)TK2MSFTNGP02.phx.gbl> Alberto > wrote: > >>The problem is the same. The line didn't appear in the file stored. > > Does the order of clicking the buttons (4 & 5) affect what is saved? It > may be that the Button 4 click function over-writes what was drawn in the > Button 5 click function. > > -- > Jeff Gaines Dorset UK > All those who believe in psychokinesis raise my hand.
From: kndg on 6 Oct 2009 20:06 Alberto wrote: > I just wrote in another proyect this code: > > private void button5_Click(object sender, EventArgs e) > > { > > Graphics g = panel1.CreateGraphics(); > > g.DrawLine(new Pen(Brushes.Blue), new Point(0, 0), new Point(50, 50)); > > } > > private void button4_Click(object sender, EventArgs e) > > { > > int width = panel1.Width; > > int height = panel1.Height; > > Bitmap bitMap = new Bitmap(width, height); > > Rectangle rec = new Rectangle(0, 0, width, height); > > panel1.DrawToBitmap(bitMap, rec); > > bitMap.Save(@"C:/Windows/prueba.bmp"); > > } > > The problem is the same. The line didn't appear in the file stored. > > Thank you for your help > > "Mark Rae [MVP]" <mark(a)markNOSPAMrae.net> escribi� en el mensaje > news:OshcG5nRKHA.4504(a)TK2MSFTNGP04.phx.gbl... >> "Alberto" <alberto(a)nospam.es> wrote in message >> news:CC939097-E6D6-47D6-A673-DC89D55AE31D(a)microsoft.com... >> >> [please don't top-post] >> >>>>> 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); >>> Do you know why the lines that I draw with DrawLine aren't saved in the >>> file? >> Not without seeing your code... >> >> >> -- >> Mark Rae >> ASP.NET MVP >> http://www.markrae.net > > Hi Alberto, You should put your drawing operation on panel1 on Paint event handler. Example: 1. double-click panel1 control on the designer 2. add below code on panel1_Paint method private void panel1_Paint(object sender, PaintEventArgs e) { Graphics g = e.Graphics; g.DrawLine(new Pen(Brushes.Blue), new Point(0, 0), new Point(50, 50)); } Regards.
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 4 Prev: SV: Type cast depending on the reciever type Next: VS 2005 MS Orientation Aware Controls designer problem |