SlideShare a Scribd company logo
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 5
Bhushan Mulmule
 
06 win forms
06 win forms06 win forms
06 win forms
mrjw
 
Getting started with wxWidgets
Getting started with wxWidgets Getting started with wxWidgets
Getting started with wxWidgets
Iulian-Nicu Şerbănoiu
 
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
Sencha
 
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
foottraders
 
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.pdf
adityastores21
 
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.pdf
maheshkumar12354
 
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
DIPESH30
 
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
florriezhamphrey3065
 
srgoc
srgocsrgoc
AJP Practical Questions with Solution.docx
AJP Practical Questions with Solution.docxAJP Practical Questions with Solution.docx
AJP Practical Questions with Solution.docx
RenuDeshmukh5
 
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
 
Clean Code
Clean CodeClean Code
Clean Code
Nascenia IT
 
Lab 1 Essay
Lab 1 EssayLab 1 Essay
Lab 1 Essay
Melissa Moore
 
08ui.pptx
08ui.pptx08ui.pptx
08ui.pptx
KabadaSori
 

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.docx
RAHUL126667
 
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
RAHUL126667
 
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
RAHUL126667
 
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
RAHUL126667
 
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
RAHUL126667
 
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
RAHUL126667
 
Application Ware House-Application DesignAppointyAppoi.docx
Application Ware House-Application DesignAppointyAppoi.docxApplication Ware House-Application DesignAppointyAppoi.docx
Application Ware House-Application DesignAppointyAppoi.docx
RAHUL126667
 
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
RAHUL126667
 
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
RAHUL126667
 
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
RAHUL126667
 
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
RAHUL126667
 
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
RAHUL126667
 
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
RAHUL126667
 
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
RAHUL126667
 
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
RAHUL126667
 
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
RAHUL126667
 
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
RAHUL126667
 
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
RAHUL126667
 
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
RAHUL126667
 
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
RAHUL126667
 

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

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Atul Kumar Singh
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
Nguyen Thanh Tu Collection
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
timhan337
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
Peter Windle
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
CarlosHernanMontoyab2
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 

Recently uploaded (20)

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 

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