graphics quality very poor, how to improve?
-
I'm loading a image into the graphics of a form, but the quality is very poor. How to improve? The original image is 48*48 (96dpi). Here's my code:
public partial class Form1 : Form
{
private ImageList ObjImageList;
private int OPERSTEP_SIZE = 48;public Form1() { InitializeComponent(); ObjImageList = new ImageList(); ObjImageList.Images.Add("prodstep", Image.FromFile("ProdStep\_BW.gif")); this.Paint += new PaintEventHandler(Form1\_Paint); } void Form1\_Paint(object sender, PaintEventArgs e) { Graphics g = e.Graphics; g.DrawImage(ObjImageList.Images\["prodstep"\], new Rectangle(20, 20, OPERSTEP\_SIZE, OPERSTEP\_SIZE)); }
}
-
I'm loading a image into the graphics of a form, but the quality is very poor. How to improve? The original image is 48*48 (96dpi). Here's my code:
public partial class Form1 : Form
{
private ImageList ObjImageList;
private int OPERSTEP_SIZE = 48;public Form1() { InitializeComponent(); ObjImageList = new ImageList(); ObjImageList.Images.Add("prodstep", Image.FromFile("ProdStep\_BW.gif")); this.Paint += new PaintEventHandler(Form1\_Paint); } void Form1\_Paint(object sender, PaintEventArgs e) { Graphics g = e.Graphics; g.DrawImage(ObjImageList.Images\["prodstep"\], new Rectangle(20, 20, OPERSTEP\_SIZE, OPERSTEP\_SIZE)); }
}
The easiest way would probably be to use an image with a higher resolution than 48*48 but still display it as 48*48 - Are you sure the displayed image on the form is still 48*48? cheers, Marco
Marco Bertschi
CodeProject 10 Million members celebration meetup - Switzerland
-
I'm loading a image into the graphics of a form, but the quality is very poor. How to improve? The original image is 48*48 (96dpi). Here's my code:
public partial class Form1 : Form
{
private ImageList ObjImageList;
private int OPERSTEP_SIZE = 48;public Form1() { InitializeComponent(); ObjImageList = new ImageList(); ObjImageList.Images.Add("prodstep", Image.FromFile("ProdStep\_BW.gif")); this.Paint += new PaintEventHandler(Form1\_Paint); } void Form1\_Paint(object sender, PaintEventArgs e) { Graphics g = e.Graphics; g.DrawImage(ObjImageList.Images\["prodstep"\], new Rectangle(20, 20, OPERSTEP\_SIZE, OPERSTEP\_SIZE)); }
}
Please refer give links: Professional C# - Graphics with GDI+[^] Drawing smooth text and pictures on the extended glass area of your WinForm in Windows Vista[^]
Maulik Dusara Sr. Sofware Engineer
-
Please refer give links: Professional C# - Graphics with GDI+[^] Drawing smooth text and pictures on the extended glass area of your WinForm in Windows Vista[^]
Maulik Dusara Sr. Sofware Engineer
Thanks for the information, i will check it out!
-
Please refer give links: Professional C# - Graphics with GDI+[^] Drawing smooth text and pictures on the extended glass area of your WinForm in Windows Vista[^]
Maulik Dusara Sr. Sofware Engineer
you can use directx or gdi + tell me more about your question to help u .
-
you can use directx or gdi + tell me more about your question to help u .
install graphics drivers on ur pc
Raisal
-
install graphics drivers on ur pc
Raisal
I did not find in the OP's question that he / she was having general problems with the quality of his / her display. The OP made it very clear that when he / she loads an image with a 48x48 dimension that the image he / she loaded was of poor quality. It is important that you understand the question before you post an absurd reply like you have just did. You should be ashamed of yourself.
-
I'm loading a image into the graphics of a form, but the quality is very poor. How to improve? The original image is 48*48 (96dpi). Here's my code:
public partial class Form1 : Form
{
private ImageList ObjImageList;
private int OPERSTEP_SIZE = 48;public Form1() { InitializeComponent(); ObjImageList = new ImageList(); ObjImageList.Images.Add("prodstep", Image.FromFile("ProdStep\_BW.gif")); this.Paint += new PaintEventHandler(Form1\_Paint); } void Form1\_Paint(object sender, PaintEventArgs e) { Graphics g = e.Graphics; g.DrawImage(ObjImageList.Images\["prodstep"\], new Rectangle(20, 20, OPERSTEP\_SIZE, OPERSTEP\_SIZE)); }
}
An image with a dimension of 48x48 literally means that you have an image consisting of 48 * 48 pixels. If you load that image into a control with an Image property, and the said control's dimension are bigger than that of the image itself, the image will be stretched (zoomed) to fit the dimension of the control. However, in a Picturebox you can control how an image is displayed - zoomed, stretched, centered, etc. As mentioned before, try and use a higher resolution image. Higher resolution means a higher number of pixels. That will give you an image file with a greater dimension. The control you are using the display the image (other than a picturebox) will fit the image according to its own dimensions and not that of the image. Make sure that the control's dimensions are relative to that of the image to prevent the image from being distorted.