วันจันทร์ที่ 15 กรกฎาคม พ.ศ. 2556

LAB20 การเขียนโปรแกรมกราฟ4

Bitmap bmp = new Bitmap("C:\\Users\\DV 4\\Desktop\\d.jpg");
this.SetClientSizeCore(bmp.Width + 20, bmp.Height + 20);
e.Graphics.DrawImage(bmp, 10, 10);




--------------------------------------------------------------------

Bitmap bmp = new Bitmap("C:\\Users\\DV 4\\Desktop\\d.jpg");
Rectangle destrect = new Rectangle(10, 10, bmp.Width / 2, bmp.Height / 2);
Rectangle srcrect = new Rectangle(0, 0, bmp.Width, bmp.Height);
this.SetClientSizeCore(destrect.Width + 20, destrect.Height + 20);
e.Graphics.DrawImage(bmp, destrect, srcrect, GraphicsUnit.Pixel);


-----------------------------------------------------------------------

Bitmap bmp = new Bitmap("C:\\Users\\DV 4\\Desktop\\d.jpg");
Rectangle destrect = new Rectangle(10, 10, bmp.Width , bmp.Height );
Rectangle srcrect = new Rectangle(0, 0, bmp.Width/2, bmp.Height/2);
this.SetClientSizeCore(destrect.Width + 20, destrect.Height + 20);
.Graphics.DrawImage(bmp, destrect, srcrect, GraphicsUnit.Pixel);


--------------------------------------------------------------------------

Bitmap bmp = new Bitmap("C:\\Users\\DV 4\\Desktop\\d.jpg");
Rectangle topleft = new Rectangle(0, 0, bmp.Width / 2, bmp.Height / 2);
Rectangle topright =
new Rectangle(bmp.Width / 2, 0, bmp.Width / 2, bmp.Height / 2);
Rectangle buttomleft =
new Rectangle(0, bmp.Height / 2, bmp.Width / 2, bmp.Height / 2);
Rectangle buttomright =
new Rectangle(bmp.Width/2,bmp.Height/2,bmp.Width/2,bmp.Height/2);
bmp.RotateFlip(RotateFlipType.RotateNoneFlipNone);
e.Graphics.DrawImage(bmp,topleft);
bmp.RotateFlip(RotateFlipType.RotateNoneFlipX);
e.Graphics.DrawImage(bmp,topright);
bmp.RotateFlip(RotateFlipType.RotateNoneFlipNone);
e.Graphics.DrawImage(bmp,buttomleft);
bmp.RotateFlip(RotateFlipType.RotateNoneFlipY);
e.Graphics.DrawImage(bmp,buttomright);


---------------------------------------------------------------------------

Bitmap bmp = new Bitmap("C:\\Users\\DV 4\\Desktop\\d.jpg");
this.SetClientSizeCore(bmp.Width, bmp.Height);
Rectangle destrect = new Rectangle(0, 0, bmp.Width, bmp.Height);
Brush myBrush = new SolidBrush(Color.Coral);
e.Graphics.DrawImage(bmp, destrect);
e.Graphics.DrawString("Hello Worlddddd!!", new Font("Vernada", 30, FontStyle.Bold),
myBrush, 0, 0);





ไม่มีความคิดเห็น:

แสดงความคิดเห็น