GDI+ Point size

1,point 和size可以互相转换,如:

View Code
   Point p = new Point(300300);
            p.Offset(
12,14);
            Size s 
= new Size(1212);
            p 
= (Point)s;  //size转换为point
            s = (Size)p;    //point转换为size

 2.两个矩形的交集

        

         Graphics g = e.Graphics;
           g.Clear(Color.White);
            Rectangle rr = new Rectangle(55,55,100,100);
            Rectangle r2 = new Rectangle(5,5,60,120);
          Rectangle r3 =  Rectangle.Intersect(rr,r2);
          g.FillRectangle(Brushes.Blue, rr);
          g.FillRectangle(Brushes.Black,r2);
         g.FillRectangle(Brushes.DeepPink, r3);

 

posted on 2011-07-28 11:13  wtq  阅读(505)  评论(0编辑  收藏  举报