C#: If the code is the only thing that you can provide without the pictures of...

80.2K

Verified Solution

Question

Programming

C#: If the code is the only thing that you can provide withoutthe pictures of the form, then that is fine as well.

Topics: hiding/showing controls, StatusStrip, customevent arguments, radio buttons

Students will create an application that uses a dialogto create a spaceship object to populate a ListView. This ListViewwill be able to display in either large or small icon mode using amenu option to switch between them. Selecting a spaceship in theListView will give the user the ability to modify that object’svalues and apply those changes.

You will be creating two forms, the main window with aListView, MenuStrip, and StatusStrip, and a dialog window with someuser input fields for making a spaceship object. The inputs neededfor the spaceship are a TextBox for name, a numericUpDown for crewsize, a checkbox for indicating active duty, and a set of 3 radiobuttons for selecting the type of ship (Cruiser, Destroyer, orFreighter). There should be three buttons on this dialog: OK,Cancel, and Apply. OK and Cancel will always be visible, but theApply button will only appear when attempting to modify an itemfrom the ListView. The OK button will add a ListViewItem with thecurrent input to the main window’s ListView, and the Cancel buttonwill close the window without changing anything in the main window.The Apply button should use a custom EventHandler and custom eventarguments to modify the selected item in the main window’s ListViewto have the current input values in the dialog. The main window’sMenuStrip should have three separate menus: File, Ship, and View.Each of these menus will have the following options: File->Clearto clear the ListView, File->Exit to exit the application,Ship->New to open a dialog to make a new spaceship without theApply button being visible, View->Large to make the ListView useLargeIcon mode, and View->Small to make the ListView useSmallIcon mode. The currently selected icon mode should have acheckmark displayed next to it. The StatusStrip should appear atthe bottom of the window and have a single ToolStripStatusLabelshowing the current number of items in the ListView. There shouldbe unique images for each of the 3 ships with a large 32x32 and asmall 16x16. Double-clicking an item in the ListView should bringup the spaceship dialog with the Apply button visible and thefields pre-populated with the selected item’s currentvalues.

Follow these guidelines for thisapplication:

User Input Dialog

  • Radio buttons are used for ship selection that functionas radio buttons should (only one option selectable at atime).

  • Apply button should only be visible when opened bydouble clicking a ListViewItem.

  • A TextBox for name, NumericUpDown for crew size, andCheckBox for active duty are present for additional user inputabout the spaceship.

  • OK and Cancel buttons should always be present on thisdialog.

ListView/Main Window

  • ListView exists, set to dock/fill the parent container,and can be toggled between LargeIcon and SmallIconmode.

  • A StatusStrip is present at the bottom of the windowthat always displays the current Item count of theListView.

  • Double clicking a ListViewItem brings up the spaceshipdialog as does selecting the Ship->New MenuStripoption.

  • 3 Unique images are used in the ListView that correspondto the three ship types. Large(32x32) and Small(16x16) image listsare used for this purpose.

Events

  • When the Apply button is pressed, a custom EventArgsclass is used with an EventHandler to pass the updated spaceshipinformation to the main window. The updated spaceship fields areused to update the currently selected spaceship.

  • When the OK button is pressed, a new spaceship with thecurrent input values is added to the ListView and the spaceshipdialog is closed.

  • When the Cancel button is pressed, the spaceship dialogcloses without affecting the main window’s controls.

Answer & Explanation Solved by verified expert
4.1 Ratings (766 Votes)
ListViewControl private void CreateMyListView Create a new ListView control ListView listView1 new ListView listView1Bounds new Rectanglenew Point1010 new Size300200 Set the view to show details listView1View ViewDetails Allow the user to edit item text listView1LabelEdit true Allow the user to rearrange columns listView1AllowColumnReorder true Display check boxes listView1CheckBoxes true Select    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students