8.4. Test Your Understanding
| 1: | What two properties does PaintEventArgs provide a Paint handler routine? Describe the role of each.  |  | 2: | What method is called to trigger a Paint event for a control?  |  | 3: | Which image is drawn by the following code? 
GraphicsPath gp = new GraphicsPath();
gp.AddLine(0,0,60,0);
gp.AddLine(0,20,60,20);
g.DrawPath(new Pen(Color.Black,2),gp);
  
 
  |  | 4: | Which of these statements will cause a compile-time error? 
Brush sb = new SolidBrush(Color.Chartreuse);
 
Brush b = new Brush(Color.Red);
 
Brush h = new HatchBrush(HatchStyle.DottedDiamond,
                         Color.Blue,Color.Red);
  |  | 5: | Which of these colors is more transparent? 
Color a = FromArgb(255,112,128,144);
Color b = FromArgb(200,212,128,200);
 
  |  | 6: | You are drawing an image that is 200x200 pixels onto a panel that is 100x100 pixels. The image is contained in the Bitmap bmp, and the following statement is used: 
g.DrawImage(bmp, panel1.ClientRectangle);
  
What percent of the image is displayed? 
 |  | 7: | The Russian artist Wassily Kandinsky translated the dance movements of Gret Palucca into a series of schematic diagrams consisting of simple geometric shapes. The following is a computer generated schematic (approximating Kandinsky's) that corresponds to the accompanying dance position. The schematic is created with a GraphicsPath object and the statements that follow. However, the statements have been rearranged, and your task is to place them in a sequence to draw the schematic. Recall that a GraphicsPath object automatically connects objects. 
  
Graphics g = panel1.CreateGraphics();
g.SmoothingMode = SmoothingMode.AntiAlias;
GraphicsPath gp = new GraphicsPath();
gp.AddLine(10,170,30,170);
gp.AddLine(40,50,50,20);
gp.StartFigure();
gp.AddLine(16,100,100,100);
gp.AddLine(50,20,145,100);
gp.AddLine(100,100,190,180);
gp.StartFigure();
gp.AddArc(65,10,120,180,180,80);
g.DrawPath(new Pen(Color.Black,2),gp); gp.StartFigure();
gp.AddArc(65,5,120,100,200,70);
 
  |  | 8: | The following statements are applied to the original image A: 
Point ptA = new Point(bmp.Height,0);
Point ptB = new Point(bmp.Height,bmp.Width);
Point ptC = new Point(0,0);
Point[]dp = {ptA,ptB,ptC};
g.DrawImage(bmp,dp);
 
Which image is drawn by the last statement? 
 
  |   
 |