when i try to draw this bitmap as 2 pixels wide using:
public void DrawImage(Image image,RectangleF rect)
The bitmap is not drawn correctly. There are white
slim stripes in bitween each bitmap column.
see the simple code below:
Expand|Select|Wrap|Line Numbers
- private void Form1_Paint(object sender,
- PaintEventArgs e)
- {
- Graphics gr = e.Graphics;
- Bitmap bitmap = new Bitmap(1, 256);
- for (int y = 0; y < 256; y++)
- {
- bitmap.SetPixel(0, y, Color.Red);
- }
- RectangleF rectf = new RectangleF();
- for (int x = 0; x < 500; x++)
- {
- float factor = 2;
- rectf.X = x*factor;
- rectf.Y = 0;
- rectf.Width = fact;
- rectf.Height = 500;
- // should draw bitmap as 2 pixels wide
- // but draws it with white slim stripes in between
- gr.DrawImage(bitmap, rectf);
- }
- }