Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Draw a happy face image using the graphics commands. Have the image move across the screen. When it reaches the right hand side of the

"Draw a happy face image using the graphics commands. Have the image move across the screen. When it reaches the right hand side of the screen, have the image re-appear on the left hand side of the screen and move to the right side again and repeat the above process. Display a happy face text message onto the screen using the graphics command."

I have created the Happy face. HERE IS MY PROGRAM. How could I make the eyes as hearts? and to get it to move?

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.IO;

namespace Smile_13 { public partial class Lawrence : Form { int xpos = 5; int ypos = 5; public Form1() { InitializeComponent(); }

private void Form1_Load(object sender, EventArgs e) {

} private void Form1_Paint(object sender, PaintEventArgs e) { Graphics g = e.Graphics; Pen myPen = new Pen(Brushes.Red, 10); Pen myPen2 = new Pen(Brushes.Pink, 10); int endX = this.ClientRectangle.Width; int emdY = this.ClientRectangle.Height; int xCenter = this.ClientRectangle.Left + (this.ClientRectangle.Width / 2); int yCenter = this.ClientRectangle.Top + (this.ClientRectangle.Height /2); Pen circlePen = new Pen(Brushes.Pink, 9); Font myFont = new Font("Comic Sans MS", 36, FontStyle.Italic); g.DrawString("Hello Mr.Bossie", myFont, Brushes.Pink, 300, 30); g.DrawEllipse(circlePen, xpos, ypos + 150, 250, 200); g.FillEllipse(Brushes.Black, xpos, ypos + 150, 250, 200); g.DrawEllipse(circlePen, xpos + 85, ypos + 200, 20, 35); g.FillEllipse(Brushes.Pink, xpos + 85, ypos + 200, 20, 35); g.DrawEllipse(circlePen, xpos + 160, ypos + 200, 20, 35); g.FillEllipse(Brushes.Pink, xpos + 160, ypos + 200, 20, 35); g.DrawArc(circlePen, xpos + 60, ypos + 215, 130, 120, 35, 115);

}

private void timer_Tick(object sender, EventArgs e) { xpos = xpos + 7; if (xpos >= this.ClientRectangle.Right - 350) { xpos = 0; }

this.Invalidate(); } } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Application Development And Administration

Authors: Michael V. Mannino

4th Edition

0615231047, 978-0615231044

Students also viewed these Databases questions