System.Drawing.Graphics.DrawImageUnscaled C# (CSharp) Method

DrawImageUnscaled() public method

public DrawImageUnscaled ( Image image, int x, int y, int width, int height ) : void
image Image
x int
y int
width int
height int
return void
        public void DrawImageUnscaled(Image image, int x, int y, int width, int height)
        {
            if (image == null)
                throw new ArgumentNullException ("image");

            // avoid creating an empty, or negative w/h, bitmap...
            if ((width <= 0) || (height <= 0))
                return;

            using (Image tmpImg = new Bitmap (width, height)) {
                using (Graphics g = FromImage (tmpImg)) {
                    g.DrawImage (image, 0, 0, image.Width, image.Height);
                    DrawImage (tmpImg, x, y, width, height);
                }
            }
        }

Same methods

Graphics::DrawImageUnscaled ( Image image, Point point ) : void
Graphics::DrawImageUnscaled ( Image image, Rectangle rect ) : void
Graphics::DrawImageUnscaled ( Image image, int x, int y ) : void

Usage Example

Example #1
0
        private void btnfig_Click(object sender, EventArgs e)
        {
            int    a = 1;
            int    b = 0;
            int    c = 0;
            double x, y;
            int    orig_x = pn1.Width / 2;
            int    orig_y = pn1.Height / 2;

            //
            Bitmap pen = new Bitmap(1, 1);

            pen.SetPixel(0, 0, Color.Green);
            System.Drawing.Graphics g = pn1.CreateGraphics();

            //

            for (double i = 0; i <= 100; i += 0.01)
            {
                x = i;
                y = (a * (x * x)) + ((b * x) + c);
                g.DrawImageUnscaled(pen, orig_x + (int)x, orig_y - (int)y);
                g.DrawImageUnscaled(pen, orig_x - (int )x, orig_y - (int)y);
                if (y >= orig_y)
                {
                    break;
                }
            }
        }
All Usage Examples Of System.Drawing.Graphics::DrawImageUnscaled