Presentation is loading. Please wait.

Presentation is loading. Please wait.

CST238 Week 5 Questions / Concerns? Announcements – HW#1 due (Project ideas) – Check-off Take Home lab#4 Recap New topics – Drawing Coming up: – GUI Bloopers.

Similar presentations


Presentation on theme: "CST238 Week 5 Questions / Concerns? Announcements – HW#1 due (Project ideas) – Check-off Take Home lab#4 Recap New topics – Drawing Coming up: – GUI Bloopers."— Presentation transcript:

1 CST238 Week 5 Questions / Concerns? Announcements – HW#1 due (Project ideas) – Check-off Take Home lab#4 Recap New topics – Drawing Coming up: – GUI Bloopers presentations start next Monday (#1&#2) Test#1 Take Home Lab#5

2 Recap Timer – Tick event DateTime – Get current date / time MDI applications – Main form – Child form (set its MDIparent to main form)

3 GUI Blooper Presentations Limit your presentation to 30 minutes. Both team members need to present. Summary the key points in the chapter. Show examples given in the book. When possible, show actual GUI examples from applications/websites that you have used.

4

5 Drawing You need the Graphics class from System.Drawing namespace. Two ways to get a Graphics object – Create a new that’s associated with the form or control – Grab the Graphics object in the Paint event’s PaintEventArgs

6 Drawing There are 2 types of draw: – Immediate Draw Not updated after form resize, covered or uncovered. – Redraw Updated each time a form is updated. This is done through Paint event. This event can be triggered using Invalidate

7 Drawing Get Graphics object: – Create a Graphics object for the form or control Graphics g = this.CreateGraphics(); Graphics g = pictureBox1.CreateGraphics(); – void DrawingForm_Paint(object sender, PaintEventArgs e) { Graphics g = e.Graphics;

8 Drawing Classes that you might need: – Color – Brushes – Pens Read Chapter 5, 6 & 7 in the Chris Sells book as reference on different shapes to draw and different pens and brushes to use.

9 Grid System X Y (X, Y)

10 Drawing Drawing procedure: 1.Obtain a Graphics object. 2.Obtain a tool to use on the Graphics object. - pen, brushes, fonts, etc. 3.Call methods on the Graphics object to draw your picture. 4.Trigger redraw is necessary by Invalidate the form or control

11 Methods of the Graphics class Draw methods – DrawLine, DrawArc, DrawImage, DrawEllipse, DrawRectangle Fill methods – FillEllipse, FillPolygon, FillRectangle

12 Drawing Drawing directly on the form – Know the size of the form Drawing on one of the controls – Panel – PictureBox – Use the Width and Height for the control

13 Form: Size Form’s ClientRectangle (284, 262) (300, 300)

14 Take Home Lab #5 Draw a static picture. – Try different styles of pens and brushes. – Try different shapes, lines, images, text. – Add some immediately drawn shapes via a button, but keep the main picture updated. – Be creative but it doesn’t have to be very complex or fancy.


Download ppt "CST238 Week 5 Questions / Concerns? Announcements – HW#1 due (Project ideas) – Check-off Take Home lab#4 Recap New topics – Drawing Coming up: – GUI Bloopers."

Similar presentations


Ads by Google