public void Print(Product product) { // Get our section maker ISectionMaker sectionMaker = new SectionMaker(); // Get all of the images Bitmap headImage = sectionMaker.MakeHead(product.HeadType); Bitmap torsoImage = sectionMaker.MakeTorso(product.TorsoType); Bitmap feetImage = sectionMaker.MakeFeet(product.FeetType); // Display each image in screen canvas.DrawImage(headImage, PADDING, PADDING, IMAGE_WIDTH, IMAGE_HEIGHT); canvas.DrawImage(torsoImage, PADDING, PADDING + IMAGE_HEIGHT, IMAGE_WIDTH, IMAGE_HEIGHT); canvas.DrawImage(feetImage, PADDING, PADDING + (IMAGE_HEIGHT * 2), IMAGE_WIDTH, IMAGE_HEIGHT); }
private void draw() { try { // Create the product Product product = new Product(cboHead.Text, cboTorso.Text, cboFeet.Text); // Clear the canvas canvas.Clear(SystemColors.Control); // Print the new product printer.Print(product); } catch (ArgumentOutOfRangeException) { // The user didn't select an item in each combo box MessageBox.Show("Please select a value for each body section"); } }