If you have written a helper method that has many references to the members of a class, then perhaps there should be a method for this operation in your class. I will be looking for object oriented design when I grade the assignment.
SdiTemplate.dll
into the application
directory and add a reference to it. Also add SdiTemplate.pdb
into the application. The application directory is the location of your main
form. ZIP of SdiTemplate.
SdiTemplate.SdiView
. These will be two different views of the
same data. One view will display text drawn on the screen (drawing
view), the other view will show the corresonding data in a
ListView
(list view).
SdiView
class is a user control, so you will be able to
add controls to it in the designer.
SdiTemplate
documentation.
SdiTemplate.SdiDoc
.
SdiTemplate.SdiMainForm
.
SdiView
and use it as the base class for the views in this
application. This is a useful technique. It allows you to add virtual functions
to your base class. These virtual functions can then have different
implementations in your extended views. It also allows you to add features
to your base class that are implemented identically in both extended views.
SetView
method to do
this.
WM_NOTIFYPARENT
message (hex 0x0210
) in the
WndProc
and test if the mouse coordinates in the
LParam
are in either of the panels.
WndProc is not available from the properties window. To create the method, type
override
followed by a space, in your main program. You will see a
list of overrides that are available. Type WndProc
and you will see
it in the list.
The WndProc is explained on pages 392-393 of the text. In the example from the
book, rename WM_NCHITTEST to WM_NOTIFY and give it a value of 0x210. In the
switch statement, access the LParam property from the message. This
property will contain the coordinates of the mouse click. Add the following methods
ot your main form to isolate the low word (X coordinate) and high word (Y
coordinate) from the LParam
property of the
Message
. There is a method that is part of the
LParam
that will change it to an Int32
.
private static int HiWord(int number) { if ((number & 0x80000000) == 0x80000000) return (number >> 16); else return (number >> 16) & 0xffff ; } private static int LoWord(int number) { return number & 0xffff; }
SetView
method to do
this.
Modified
property in the documant to warn the user if
data is to be lost. Give the user three options.
Modified
property in the documant to warn the user if
data is to be lost. Give the user three options.
IFormatter
to serialize the data in the document to a
file. Do not serialize the document itself, serialize the data that is in
the document.
Modified
property in the documant to warn the user if
data is to be lost. Give the user three options.
Modified
property in the documant to warn the user if
data will be lost in each form before it is closed. Give the user three options.
SdiTemplate.SdiDoc
.
List
for instances of your new data class.
DeleteContents
method. This method in the base
class already calls UpdateAllViews
.
Modified
property to kepp track of when the document
needs to be saved.
View
property is set to Details
.
Update
is called, clear all the items from the list and
add all the current elements from the document to the list. You will need
to use the types ListViewItem
and
ListViewItem.ListViewSubItem
to add items to the
ListView
.