SlideShare a Scribd company logo
1 of 14
C#_hw9_S17.doc
Modify AnimatedBall on Chapter 13. Instead of drawing a ball,
you need to draw a car. Let the car draw around. When the car
reached the right end, make a turn and draw downward. When it
reached the bottom, draw to the left, then go upward, …
Change the name of three buttons Go (resume), Stop (suspend),
and Quit (Abort)
xid-1979246_1.gif
xid-1979247_1.gif
xid-1979248_1.gif
xid-1979249_1.gif
AnimateBall.cs
//Copyright (c) 2002, Art Gittleman
//This example is provided WITHOUT ANY WARRANTY
//either expressed or implied.
/* Animates a ball. Uses a thread to allow the system to
* continue other processing.
*/
using System;
using System.Drawing;
using System.Threading;
using System.Windows.Forms;
public class AnimateBall : Form {
private int x, y;
private Button suspend = new Button();
private Button resume = new Button();
private Button abort = new Button();
Thread t;
public AnimateBall() {
BackColor = Color.White;
Text = "Animate Ball";
abort.Text = "Abort";
suspend.Text = "Suspend";
resume.Text = "Resume";
int w = 20;
suspend.Location = new Point(w, 200);
resume.Location = new Point(w += 10 + suspend.Width,
200);
abort.Location = new Point(w += 10 + resume.Width, 200);
abort.Click += new EventHandler(Abort_Click);
suspend.Click += new EventHandler(Suspend_Click);
resume.Click += new EventHandler(Resume_Click);
Controls.Add(suspend);
Controls.Add(resume);
Controls.Add(abort);
x = 50; y = 50;
t = new Thread(new ThreadStart(Run));
t.Start();
}
protected void Abort_Click(object sender, EventArgs e) {
t.Abort();
}
protected void Suspend_Click(object sender, EventArgs e) {
t.Suspend();
}
protected void Resume_Click(object sender, EventArgs e) {
t.Resume();
}
protected override void OnPaint( PaintEventArgs e ) {
Graphics g = e.Graphics;
g.FillEllipse(Brushes.Red, x ,y, 40 ,40);
base.OnPaint(e);
}
public void Run() {
int dx=9, dy=9;
while (true) {
for(int i=0; i<10; i++) {
x+=dx;
y+=dy;
Invalidate();
Thread.Sleep(100);
}
dx = -dx; dy = -dy;
}
}
public static void Main( ) {
Application.Run(new AnimateBall());
}
}
C#_hw8_S17_update.doc
Modify from MenuDialog to create a simple text editor. You
need to add [STAThread]
Before its Main method to make it work.
In File menu, add option like New, Open, Save, Save As,Close,
and Exit.
When the user selects Save As, display a SaveFileDialog to let
the user to select a filename and whatever in the textbox should
be saved to this file.
When the user selects Save, display a SaveFileDialog if the file
has not been opened (created after the user clicked New or
Close).
Both objects from OpenFileDialog and SaveFileDialog has a
property called FileName. Define an instance variable of String
type called filename to hold file name after an OpenFileDialog
or SaveFileDialog is created. When the user clicks Save and
filename is null, display SaveFileDialog.
When New and Close is selected, simply set textbox as empty
string like textBox1.Text=”” and set filename as null.
Add a menu called Edit with three items like Cut, Copy, Paste
textBox1.selectedText returns the selected text from the textbox
Clipboard.SetText(textBox1.SelectedText) adds selectedText to
Clipboard
Clipboard.GetText() returns what is in the clipboard.
When the user clicks cut or copy, set the clipboard with the text
selected
When paste is clicked, set textBox1.Text as
textBox1.Text.Substring(0, textBox1.SelectionStart) + what is
in the clipboard +
textBox1.Text.Substring(textBox1.SelectionStart +
textBox1.SelectionLength);
When cut is clicked, it is almost same as above except “what is
in the clipboard” will be empty string
Add another menu like Help with one or two option like who
created the editor and version etc.
Add one line like: text.Dock = DockStyle.Fill;to make the
textarea stretch to the whole window
MenuDialog.cs
using System;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
public class MenuDialog : Form {
// Create control
TextBox text = new TextBox();
public MenuDialog() {
// Configure form
Size = new Size(500,200);
Text = "Menus and Dialogs";
// Configure text box
text.Size = new Size(450,120);
text.Multiline = true;
text.ScrollBars = ScrollBars.Both;
text.WordWrap = false;
text.Location = new Point(20,20);
// Configure file menu
MenuItem fileMenu = new MenuItem("File");
MenuItem open = new MenuItem("Open");
open.Shortcut = Shortcut.CtrlO;
MenuItem save = new MenuItem("Save");
save.Shortcut = Shortcut.CtrlS;
fileMenu.MenuItems.Add(open);
fileMenu.MenuItems.Add(save);
// Configure feedback menu
MenuItem feedbackMenu = new MenuItem("Feedback");
MenuItem message = new MenuItem("Message");
message.Shortcut = Shortcut.CtrlM;
feedbackMenu.MenuItems.Add(message);
// Configure format menu
MenuItem formatMenu = new MenuItem("Format");
MenuItem font = new MenuItem("Font");
font.Shortcut = Shortcut.CtrlF;
formatMenu.MenuItems.Add(font);
// Configure main menu
MainMenu bar = new MainMenu();
Menu = bar;
bar.MenuItems.Add(fileMenu);
bar.MenuItems.Add(feedbackMenu);
bar.MenuItems.Add(formatMenu);
// Add control to form
Controls.Add(text);
// Register event handlers
open.Click += new EventHandler(Open_Click);
save.Click += new EventHandler(Save_Click);
message.Click += new EventHandler(Message_Click);
font.Click += new EventHandler(Font_Click);
}
// Handle open menu item
protected void Open_Click(Object sender, EventArgs e) {
OpenFileDialog o = new OpenFileDialog();
if(o.ShowDialog() == DialogResult.OK) {
Stream file = o.OpenFile();
StreamReader reader = new StreamReader(file);
char[] data = new char[file.Length];
reader.ReadBlock(data,0,(int)file.Length);
text.Text = new String(data);
reader.Close();
}
}
// Handle save menu item
protected void Save_Click(Object sender, EventArgs e) {
SaveFileDialog s = new SaveFileDialog();
if(s.ShowDialog() == DialogResult.OK) {
StreamWriter writer = new StreamWriter(s.OpenFile());
writer.Write(text.Text);
writer.Close();
}
}
// Handle message menu
protected void Message_Click(Object sender, EventArgs e) {
MessageBox.Show
("You clicked the Message menu", "My message");
}
// Handle font menu
protected void Font_Click(Object sender, EventArgs e) {
FontDialog f = new FontDialog();
if(f.ShowDialog() == DialogResult.OK)
text.Font = f.Font;
}
public static void Main() {
Application.Run(new MenuDialog());
}
}
LIT331/332 Brief Writing Assignments Overview and Standards
You will be required to submit a brief writing assignment each
week during Seminars One through Five. The writing topic will
be provided during that seminar.
Note that you should be taking notes as the seminar progresses
so that by the end you’ve got a rather clear path toward the
writing assignment.
Basic standards:
· APA formatting (title page, double-spaced, citations).
· Thesis statement should reflect the writing prompt.
· Organize these as basic essays—set up your point in an
introduction paragraph, give three supporting points that rely on
the readings for examples, and conclude with a clear summation
of your larger argument/response to the question.
· Supporting details are required from the readings. Note that
since these are relatively short assignments, you don’t want to
waste a lot of time summarizing the texts—assume your
audience has read them and get to the point quickly. Quotations
should be used as support, rather than content.
· The final length should be approximately 1 ½ - 2 pages (350-
500 words).
· Standard English is required.
· No first person.
LIT331/332 Brief 032310
C#_hw9_S17.docModify AnimatedBall on Chapter 13. Instead of dr.docx

More Related Content

Similar to C#_hw9_S17.docModify AnimatedBall on Chapter 13. Instead of dr.docx

Windows Forms For Beginners Part 5
Windows Forms For Beginners Part 5Windows Forms For Beginners Part 5
Windows Forms For Beginners Part 5Bhushan Mulmule
 
06 win forms
06 win forms06 win forms
06 win formsmrjw
 
SenchaCon 2016: Keynote Presentation - Art Landro, Gautam Agrawal, Mark Brocato
SenchaCon 2016: Keynote Presentation - Art Landro, Gautam Agrawal, Mark BrocatoSenchaCon 2016: Keynote Presentation - Art Landro, Gautam Agrawal, Mark Brocato
SenchaCon 2016: Keynote Presentation - Art Landro, Gautam Agrawal, Mark BrocatoSencha
 
Needs to be solved with Visual C# from the book Starting oout .pdf
Needs to be solved with Visual C# from the book Starting oout .pdfNeeds to be solved with Visual C# from the book Starting oout .pdf
Needs to be solved with Visual C# from the book Starting oout .pdffoottraders
 
Java script frame window
Java script frame windowJava script frame window
Java script frame windowH K
 
Make sure to make a copy of the Google Doc for this lab into.pdf
Make sure to make a copy of the Google Doc for this lab into.pdfMake sure to make a copy of the Google Doc for this lab into.pdf
Make sure to make a copy of the Google Doc for this lab into.pdfadityastores21
 
Cis 170 c ilab 7 of 7 sequential files
Cis 170 c ilab 7 of 7 sequential filesCis 170 c ilab 7 of 7 sequential files
Cis 170 c ilab 7 of 7 sequential filesCIS321
 
Controls Use in Windows Presentation Foundation (WPF)
Controls Use in Windows Presentation Foundation (WPF)Controls Use in Windows Presentation Foundation (WPF)
Controls Use in Windows Presentation Foundation (WPF)iFour Technolab Pvt. Ltd.
 
Implement a program in C++ a by creating a list ADT using the Object.pdf
Implement a program in C++ a by creating a list ADT using the Object.pdfImplement a program in C++ a by creating a list ADT using the Object.pdf
Implement a program in C++ a by creating a list ADT using the Object.pdfmaheshkumar12354
 
Lab #9 and 10 Web Server ProgrammingCreate a New Folder I s.docx
Lab #9 and 10 Web Server ProgrammingCreate a New Folder  I s.docxLab #9 and 10 Web Server ProgrammingCreate a New Folder  I s.docx
Lab #9 and 10 Web Server ProgrammingCreate a New Folder I s.docxDIPESH30
 
Student Lab Activity CIS170 Week 6 Lab Instructions.docx
Student Lab Activity CIS170 Week 6 Lab Instructions.docxStudent Lab Activity CIS170 Week 6 Lab Instructions.docx
Student Lab Activity CIS170 Week 6 Lab Instructions.docxflorriezhamphrey3065
 
AJP Practical Questions with Solution.docx
AJP Practical Questions with Solution.docxAJP Practical Questions with Solution.docx
AJP Practical Questions with Solution.docxRenuDeshmukh5
 
Parameterization is nothing but giving multiple input
Parameterization is nothing but giving multiple inputParameterization is nothing but giving multiple input
Parameterization is nothing but giving multiple inputuanna
 
Dbva dotnet programmer_guide_chapter8
Dbva dotnet programmer_guide_chapter8Dbva dotnet programmer_guide_chapter8
Dbva dotnet programmer_guide_chapter8Shakeel Mujahid
 

Similar to C#_hw9_S17.docModify AnimatedBall on Chapter 13. Instead of dr.docx (20)

Windows Forms For Beginners Part 5
Windows Forms For Beginners Part 5Windows Forms For Beginners Part 5
Windows Forms For Beginners Part 5
 
06 win forms
06 win forms06 win forms
06 win forms
 
Getting started with wxWidgets
Getting started with wxWidgets Getting started with wxWidgets
Getting started with wxWidgets
 
SenchaCon 2016: Keynote Presentation - Art Landro, Gautam Agrawal, Mark Brocato
SenchaCon 2016: Keynote Presentation - Art Landro, Gautam Agrawal, Mark BrocatoSenchaCon 2016: Keynote Presentation - Art Landro, Gautam Agrawal, Mark Brocato
SenchaCon 2016: Keynote Presentation - Art Landro, Gautam Agrawal, Mark Brocato
 
Python basics
Python basicsPython basics
Python basics
 
Needs to be solved with Visual C# from the book Starting oout .pdf
Needs to be solved with Visual C# from the book Starting oout .pdfNeeds to be solved with Visual C# from the book Starting oout .pdf
Needs to be solved with Visual C# from the book Starting oout .pdf
 
Java script frame window
Java script frame windowJava script frame window
Java script frame window
 
Make sure to make a copy of the Google Doc for this lab into.pdf
Make sure to make a copy of the Google Doc for this lab into.pdfMake sure to make a copy of the Google Doc for this lab into.pdf
Make sure to make a copy of the Google Doc for this lab into.pdf
 
Cis 170 c ilab 7 of 7 sequential files
Cis 170 c ilab 7 of 7 sequential filesCis 170 c ilab 7 of 7 sequential files
Cis 170 c ilab 7 of 7 sequential files
 
Controls Use in Windows Presentation Foundation (WPF)
Controls Use in Windows Presentation Foundation (WPF)Controls Use in Windows Presentation Foundation (WPF)
Controls Use in Windows Presentation Foundation (WPF)
 
Implement a program in C++ a by creating a list ADT using the Object.pdf
Implement a program in C++ a by creating a list ADT using the Object.pdfImplement a program in C++ a by creating a list ADT using the Object.pdf
Implement a program in C++ a by creating a list ADT using the Object.pdf
 
Lab #9 and 10 Web Server ProgrammingCreate a New Folder I s.docx
Lab #9 and 10 Web Server ProgrammingCreate a New Folder  I s.docxLab #9 and 10 Web Server ProgrammingCreate a New Folder  I s.docx
Lab #9 and 10 Web Server ProgrammingCreate a New Folder I s.docx
 
Student Lab Activity CIS170 Week 6 Lab Instructions.docx
Student Lab Activity CIS170 Week 6 Lab Instructions.docxStudent Lab Activity CIS170 Week 6 Lab Instructions.docx
Student Lab Activity CIS170 Week 6 Lab Instructions.docx
 
srgoc
srgocsrgoc
srgoc
 
AJP Practical Questions with Solution.docx
AJP Practical Questions with Solution.docxAJP Practical Questions with Solution.docx
AJP Practical Questions with Solution.docx
 
Parameterization is nothing but giving multiple input
Parameterization is nothing but giving multiple inputParameterization is nothing but giving multiple input
Parameterization is nothing but giving multiple input
 
Dbva dotnet programmer_guide_chapter8
Dbva dotnet programmer_guide_chapter8Dbva dotnet programmer_guide_chapter8
Dbva dotnet programmer_guide_chapter8
 
Clean Code
Clean CodeClean Code
Clean Code
 
Lab 1 Essay
Lab 1 EssayLab 1 Essay
Lab 1 Essay
 
08ui.pptx
08ui.pptx08ui.pptx
08ui.pptx
 

More from RAHUL126667

Applying the Four Principles Case StudyPart 1 Chart (60 points)B.docx
Applying the Four Principles Case StudyPart 1 Chart (60 points)B.docxApplying the Four Principles Case StudyPart 1 Chart (60 points)B.docx
Applying the Four Principles Case StudyPart 1 Chart (60 points)B.docxRAHUL126667
 
APPLYING ANALYTIC TECHNIQUES TO BUSINESS1APPLYING ANALYTIC T.docx
APPLYING ANALYTIC TECHNIQUES TO BUSINESS1APPLYING ANALYTIC T.docxAPPLYING ANALYTIC TECHNIQUES TO BUSINESS1APPLYING ANALYTIC T.docx
APPLYING ANALYTIC TECHNIQUES TO BUSINESS1APPLYING ANALYTIC T.docxRAHUL126667
 
Apply the general overview of court structure in the United States (.docx
Apply the general overview of court structure in the United States (.docxApply the general overview of court structure in the United States (.docx
Apply the general overview of court structure in the United States (.docxRAHUL126667
 
Apply the Paramedic Method to the following five selections.docx
Apply the Paramedic Method to the following five selections.docxApply the Paramedic Method to the following five selections.docx
Apply the Paramedic Method to the following five selections.docxRAHUL126667
 
Application of Standards of CareDiscuss the standard(s) of c.docx
Application of Standards of CareDiscuss the standard(s) of c.docxApplication of Standards of CareDiscuss the standard(s) of c.docx
Application of Standards of CareDiscuss the standard(s) of c.docxRAHUL126667
 
Application of the Nursing Process to Deliver Culturally Compe.docx
Application of the Nursing Process to Deliver Culturally Compe.docxApplication of the Nursing Process to Deliver Culturally Compe.docx
Application of the Nursing Process to Deliver Culturally Compe.docxRAHUL126667
 
Application Ware House-Application DesignAppointyAppoi.docx
Application Ware House-Application DesignAppointyAppoi.docxApplication Ware House-Application DesignAppointyAppoi.docx
Application Ware House-Application DesignAppointyAppoi.docxRAHUL126667
 
Applied Psycholinguistics 31 (2010), 413–438doi10.1017S014.docx
Applied Psycholinguistics 31 (2010), 413–438doi10.1017S014.docxApplied Psycholinguistics 31 (2010), 413–438doi10.1017S014.docx
Applied Psycholinguistics 31 (2010), 413–438doi10.1017S014.docxRAHUL126667
 
Application of the Belmont PrinciplesFirst, identify your .docx
Application of the Belmont PrinciplesFirst, identify your .docxApplication of the Belmont PrinciplesFirst, identify your .docx
Application of the Belmont PrinciplesFirst, identify your .docxRAHUL126667
 
APPLE is only one of the multiple companies that have approved and d.docx
APPLE is only one of the multiple companies that have approved and d.docxAPPLE is only one of the multiple companies that have approved and d.docx
APPLE is only one of the multiple companies that have approved and d.docxRAHUL126667
 
Appliance Warehouse Service Plan.The discussion focuses on the.docx
Appliance Warehouse Service Plan.The discussion focuses on the.docxAppliance Warehouse Service Plan.The discussion focuses on the.docx
Appliance Warehouse Service Plan.The discussion focuses on the.docxRAHUL126667
 
Applicants must submit a 500 essay describing how current or future .docx
Applicants must submit a 500 essay describing how current or future .docxApplicants must submit a 500 essay describing how current or future .docx
Applicants must submit a 500 essay describing how current or future .docxRAHUL126667
 
Apple Inc., Microsoft Corp., Berkshire Hathaway, and Facebook ha.docx
Apple Inc., Microsoft Corp., Berkshire Hathaway, and Facebook ha.docxApple Inc., Microsoft Corp., Berkshire Hathaway, and Facebook ha.docx
Apple Inc., Microsoft Corp., Berkshire Hathaway, and Facebook ha.docxRAHUL126667
 
Appcelerator Titanium was released in December 2008, and has been st.docx
Appcelerator Titanium was released in December 2008, and has been st.docxAppcelerator Titanium was released in December 2008, and has been st.docx
Appcelerator Titanium was released in December 2008, and has been st.docxRAHUL126667
 
APA Style300 words per topic2 peer reviewed resources per to.docx
APA Style300 words per topic2 peer reviewed resources per to.docxAPA Style300 words per topic2 peer reviewed resources per to.docx
APA Style300 words per topic2 peer reviewed resources per to.docxRAHUL126667
 
Ape and Human Cognition What’s theDifferenceMichael To.docx
Ape and Human Cognition What’s theDifferenceMichael To.docxApe and Human Cognition What’s theDifferenceMichael To.docx
Ape and Human Cognition What’s theDifferenceMichael To.docxRAHUL126667
 
Apply what you have learned about Health Promotion and Disease P.docx
Apply what you have learned about Health Promotion and Disease P.docxApply what you have learned about Health Promotion and Disease P.docx
Apply what you have learned about Health Promotion and Disease P.docxRAHUL126667
 
APA formatCite there peer-reviewed, scholarly references300 .docx
APA formatCite there peer-reviewed, scholarly references300 .docxAPA formatCite there peer-reviewed, scholarly references300 .docx
APA formatCite there peer-reviewed, scholarly references300 .docxRAHUL126667
 
APA formatCite 2 peer-reviewed reference175-265 word count.docx
APA formatCite 2 peer-reviewed reference175-265 word count.docxAPA formatCite 2 peer-reviewed reference175-265 word count.docx
APA formatCite 2 peer-reviewed reference175-265 word count.docxRAHUL126667
 
APA formatCite at least 1 referenceWrite a 175- to 265-w.docx
APA formatCite at least 1 referenceWrite a 175- to 265-w.docxAPA formatCite at least 1 referenceWrite a 175- to 265-w.docx
APA formatCite at least 1 referenceWrite a 175- to 265-w.docxRAHUL126667
 

More from RAHUL126667 (20)

Applying the Four Principles Case StudyPart 1 Chart (60 points)B.docx
Applying the Four Principles Case StudyPart 1 Chart (60 points)B.docxApplying the Four Principles Case StudyPart 1 Chart (60 points)B.docx
Applying the Four Principles Case StudyPart 1 Chart (60 points)B.docx
 
APPLYING ANALYTIC TECHNIQUES TO BUSINESS1APPLYING ANALYTIC T.docx
APPLYING ANALYTIC TECHNIQUES TO BUSINESS1APPLYING ANALYTIC T.docxAPPLYING ANALYTIC TECHNIQUES TO BUSINESS1APPLYING ANALYTIC T.docx
APPLYING ANALYTIC TECHNIQUES TO BUSINESS1APPLYING ANALYTIC T.docx
 
Apply the general overview of court structure in the United States (.docx
Apply the general overview of court structure in the United States (.docxApply the general overview of court structure in the United States (.docx
Apply the general overview of court structure in the United States (.docx
 
Apply the Paramedic Method to the following five selections.docx
Apply the Paramedic Method to the following five selections.docxApply the Paramedic Method to the following five selections.docx
Apply the Paramedic Method to the following five selections.docx
 
Application of Standards of CareDiscuss the standard(s) of c.docx
Application of Standards of CareDiscuss the standard(s) of c.docxApplication of Standards of CareDiscuss the standard(s) of c.docx
Application of Standards of CareDiscuss the standard(s) of c.docx
 
Application of the Nursing Process to Deliver Culturally Compe.docx
Application of the Nursing Process to Deliver Culturally Compe.docxApplication of the Nursing Process to Deliver Culturally Compe.docx
Application of the Nursing Process to Deliver Culturally Compe.docx
 
Application Ware House-Application DesignAppointyAppoi.docx
Application Ware House-Application DesignAppointyAppoi.docxApplication Ware House-Application DesignAppointyAppoi.docx
Application Ware House-Application DesignAppointyAppoi.docx
 
Applied Psycholinguistics 31 (2010), 413–438doi10.1017S014.docx
Applied Psycholinguistics 31 (2010), 413–438doi10.1017S014.docxApplied Psycholinguistics 31 (2010), 413–438doi10.1017S014.docx
Applied Psycholinguistics 31 (2010), 413–438doi10.1017S014.docx
 
Application of the Belmont PrinciplesFirst, identify your .docx
Application of the Belmont PrinciplesFirst, identify your .docxApplication of the Belmont PrinciplesFirst, identify your .docx
Application of the Belmont PrinciplesFirst, identify your .docx
 
APPLE is only one of the multiple companies that have approved and d.docx
APPLE is only one of the multiple companies that have approved and d.docxAPPLE is only one of the multiple companies that have approved and d.docx
APPLE is only one of the multiple companies that have approved and d.docx
 
Appliance Warehouse Service Plan.The discussion focuses on the.docx
Appliance Warehouse Service Plan.The discussion focuses on the.docxAppliance Warehouse Service Plan.The discussion focuses on the.docx
Appliance Warehouse Service Plan.The discussion focuses on the.docx
 
Applicants must submit a 500 essay describing how current or future .docx
Applicants must submit a 500 essay describing how current or future .docxApplicants must submit a 500 essay describing how current or future .docx
Applicants must submit a 500 essay describing how current or future .docx
 
Apple Inc., Microsoft Corp., Berkshire Hathaway, and Facebook ha.docx
Apple Inc., Microsoft Corp., Berkshire Hathaway, and Facebook ha.docxApple Inc., Microsoft Corp., Berkshire Hathaway, and Facebook ha.docx
Apple Inc., Microsoft Corp., Berkshire Hathaway, and Facebook ha.docx
 
Appcelerator Titanium was released in December 2008, and has been st.docx
Appcelerator Titanium was released in December 2008, and has been st.docxAppcelerator Titanium was released in December 2008, and has been st.docx
Appcelerator Titanium was released in December 2008, and has been st.docx
 
APA Style300 words per topic2 peer reviewed resources per to.docx
APA Style300 words per topic2 peer reviewed resources per to.docxAPA Style300 words per topic2 peer reviewed resources per to.docx
APA Style300 words per topic2 peer reviewed resources per to.docx
 
Ape and Human Cognition What’s theDifferenceMichael To.docx
Ape and Human Cognition What’s theDifferenceMichael To.docxApe and Human Cognition What’s theDifferenceMichael To.docx
Ape and Human Cognition What’s theDifferenceMichael To.docx
 
Apply what you have learned about Health Promotion and Disease P.docx
Apply what you have learned about Health Promotion and Disease P.docxApply what you have learned about Health Promotion and Disease P.docx
Apply what you have learned about Health Promotion and Disease P.docx
 
APA formatCite there peer-reviewed, scholarly references300 .docx
APA formatCite there peer-reviewed, scholarly references300 .docxAPA formatCite there peer-reviewed, scholarly references300 .docx
APA formatCite there peer-reviewed, scholarly references300 .docx
 
APA formatCite 2 peer-reviewed reference175-265 word count.docx
APA formatCite 2 peer-reviewed reference175-265 word count.docxAPA formatCite 2 peer-reviewed reference175-265 word count.docx
APA formatCite 2 peer-reviewed reference175-265 word count.docx
 
APA formatCite at least 1 referenceWrite a 175- to 265-w.docx
APA formatCite at least 1 referenceWrite a 175- to 265-w.docxAPA formatCite at least 1 referenceWrite a 175- to 265-w.docx
APA formatCite at least 1 referenceWrite a 175- to 265-w.docx
 

Recently uploaded

Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Micromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersMicromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersChitralekhaTherkar
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfUmakantAnnand
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docxPoojaSen20
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 

Recently uploaded (20)

Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Micromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of PowdersMicromeritics - Fundamental and Derived Properties of Powders
Micromeritics - Fundamental and Derived Properties of Powders
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.Compdf
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docx
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 

C#_hw9_S17.docModify AnimatedBall on Chapter 13. Instead of dr.docx

  • 1. C#_hw9_S17.doc Modify AnimatedBall on Chapter 13. Instead of drawing a ball, you need to draw a car. Let the car draw around. When the car reached the right end, make a turn and draw downward. When it reached the bottom, draw to the left, then go upward, … Change the name of three buttons Go (resume), Stop (suspend), and Quit (Abort) xid-1979246_1.gif xid-1979247_1.gif xid-1979248_1.gif xid-1979249_1.gif AnimateBall.cs //Copyright (c) 2002, Art Gittleman //This example is provided WITHOUT ANY WARRANTY //either expressed or implied. /* Animates a ball. Uses a thread to allow the system to * continue other processing. */
  • 2. using System; using System.Drawing; using System.Threading; using System.Windows.Forms; public class AnimateBall : Form { private int x, y; private Button suspend = new Button(); private Button resume = new Button(); private Button abort = new Button(); Thread t; public AnimateBall() { BackColor = Color.White; Text = "Animate Ball"; abort.Text = "Abort"; suspend.Text = "Suspend"; resume.Text = "Resume";
  • 3. int w = 20; suspend.Location = new Point(w, 200); resume.Location = new Point(w += 10 + suspend.Width, 200); abort.Location = new Point(w += 10 + resume.Width, 200); abort.Click += new EventHandler(Abort_Click); suspend.Click += new EventHandler(Suspend_Click); resume.Click += new EventHandler(Resume_Click); Controls.Add(suspend); Controls.Add(resume); Controls.Add(abort); x = 50; y = 50; t = new Thread(new ThreadStart(Run)); t.Start(); }
  • 4. protected void Abort_Click(object sender, EventArgs e) { t.Abort(); } protected void Suspend_Click(object sender, EventArgs e) { t.Suspend(); } protected void Resume_Click(object sender, EventArgs e) { t.Resume(); } protected override void OnPaint( PaintEventArgs e ) { Graphics g = e.Graphics; g.FillEllipse(Brushes.Red, x ,y, 40 ,40); base.OnPaint(e); } public void Run() { int dx=9, dy=9; while (true) { for(int i=0; i<10; i++) {
  • 5. x+=dx; y+=dy; Invalidate(); Thread.Sleep(100); } dx = -dx; dy = -dy; } } public static void Main( ) { Application.Run(new AnimateBall()); } } C#_hw8_S17_update.doc Modify from MenuDialog to create a simple text editor. You need to add [STAThread] Before its Main method to make it work. In File menu, add option like New, Open, Save, Save As,Close, and Exit. When the user selects Save As, display a SaveFileDialog to let the user to select a filename and whatever in the textbox should be saved to this file.
  • 6. When the user selects Save, display a SaveFileDialog if the file has not been opened (created after the user clicked New or Close). Both objects from OpenFileDialog and SaveFileDialog has a property called FileName. Define an instance variable of String type called filename to hold file name after an OpenFileDialog or SaveFileDialog is created. When the user clicks Save and filename is null, display SaveFileDialog. When New and Close is selected, simply set textbox as empty string like textBox1.Text=”” and set filename as null. Add a menu called Edit with three items like Cut, Copy, Paste textBox1.selectedText returns the selected text from the textbox Clipboard.SetText(textBox1.SelectedText) adds selectedText to Clipboard Clipboard.GetText() returns what is in the clipboard. When the user clicks cut or copy, set the clipboard with the text selected When paste is clicked, set textBox1.Text as textBox1.Text.Substring(0, textBox1.SelectionStart) + what is in the clipboard + textBox1.Text.Substring(textBox1.SelectionStart + textBox1.SelectionLength); When cut is clicked, it is almost same as above except “what is in the clipboard” will be empty string Add another menu like Help with one or two option like who created the editor and version etc. Add one line like: text.Dock = DockStyle.Fill;to make the
  • 7. textarea stretch to the whole window MenuDialog.cs using System; using System.Drawing; using System.IO; using System.Windows.Forms; public class MenuDialog : Form { // Create control TextBox text = new TextBox(); public MenuDialog() { // Configure form Size = new Size(500,200);
  • 8. Text = "Menus and Dialogs"; // Configure text box text.Size = new Size(450,120); text.Multiline = true; text.ScrollBars = ScrollBars.Both; text.WordWrap = false; text.Location = new Point(20,20); // Configure file menu MenuItem fileMenu = new MenuItem("File"); MenuItem open = new MenuItem("Open"); open.Shortcut = Shortcut.CtrlO; MenuItem save = new MenuItem("Save"); save.Shortcut = Shortcut.CtrlS; fileMenu.MenuItems.Add(open); fileMenu.MenuItems.Add(save);
  • 9. // Configure feedback menu MenuItem feedbackMenu = new MenuItem("Feedback"); MenuItem message = new MenuItem("Message"); message.Shortcut = Shortcut.CtrlM; feedbackMenu.MenuItems.Add(message); // Configure format menu MenuItem formatMenu = new MenuItem("Format"); MenuItem font = new MenuItem("Font"); font.Shortcut = Shortcut.CtrlF; formatMenu.MenuItems.Add(font); // Configure main menu MainMenu bar = new MainMenu(); Menu = bar; bar.MenuItems.Add(fileMenu); bar.MenuItems.Add(feedbackMenu); bar.MenuItems.Add(formatMenu);
  • 10. // Add control to form Controls.Add(text); // Register event handlers open.Click += new EventHandler(Open_Click); save.Click += new EventHandler(Save_Click); message.Click += new EventHandler(Message_Click); font.Click += new EventHandler(Font_Click); } // Handle open menu item protected void Open_Click(Object sender, EventArgs e) { OpenFileDialog o = new OpenFileDialog(); if(o.ShowDialog() == DialogResult.OK) { Stream file = o.OpenFile(); StreamReader reader = new StreamReader(file); char[] data = new char[file.Length];
  • 11. reader.ReadBlock(data,0,(int)file.Length); text.Text = new String(data); reader.Close(); } } // Handle save menu item protected void Save_Click(Object sender, EventArgs e) { SaveFileDialog s = new SaveFileDialog(); if(s.ShowDialog() == DialogResult.OK) { StreamWriter writer = new StreamWriter(s.OpenFile()); writer.Write(text.Text); writer.Close(); } } // Handle message menu protected void Message_Click(Object sender, EventArgs e) {
  • 12. MessageBox.Show ("You clicked the Message menu", "My message"); } // Handle font menu protected void Font_Click(Object sender, EventArgs e) { FontDialog f = new FontDialog(); if(f.ShowDialog() == DialogResult.OK) text.Font = f.Font; } public static void Main() { Application.Run(new MenuDialog()); } }
  • 13. LIT331/332 Brief Writing Assignments Overview and Standards You will be required to submit a brief writing assignment each week during Seminars One through Five. The writing topic will be provided during that seminar. Note that you should be taking notes as the seminar progresses so that by the end you’ve got a rather clear path toward the writing assignment. Basic standards: · APA formatting (title page, double-spaced, citations). · Thesis statement should reflect the writing prompt. · Organize these as basic essays—set up your point in an introduction paragraph, give three supporting points that rely on the readings for examples, and conclude with a clear summation of your larger argument/response to the question. · Supporting details are required from the readings. Note that since these are relatively short assignments, you don’t want to waste a lot of time summarizing the texts—assume your audience has read them and get to the point quickly. Quotations should be used as support, rather than content. · The final length should be approximately 1 ½ - 2 pages (350- 500 words). · Standard English is required. · No first person. LIT331/332 Brief 032310