CSCI E-143 CertPrep: Forms and Graphics (Kalani, chapter 1)
Saturday, Oct. 9, 2004
This Saturday we will cover Kalani's chapter 1, "Introducing Windows Forms", which includes a section on Graphics.
Here are some things in Kalani that you must definitely know.
Some of these are of basic importance to your understanding of .NET,
although they won't show up on the exam.
But I have not distinguished these two categories in the following list
which is one reason this list is unusually detailed.
Future chapter summaries will be less detailed and will cover more ground less
specifically, and will be more restricted to items that will show
up on the certification exam.
These items are listed in the order in which the appear in chapter one of Kalani.
- Key ideas in the .NET structure,
such as acronyms like CLI, FCL, CLR.
- Classes and inheritance, of course.
- Value types and reference types
- Classes vs. structs
- Heap vs. stack
- Inheritance vs. none
- The four access modifiers:
public, private, protected, internal
- The necessary relationship between Namespace hierarchies,
Inheritance hierarchies, and Library names.
This is easy. See the boxes on pp. 32 & 42:
there isn't any. You should know why not.
- Namespaces and how to avoid a namespace collision.
- Note that aliasing, which employs the using
command, can be applied to both namespaces and classes.
- You should know enough of the hierarchy of classes to know that a Windows Form
is a Scrollable Container Control, and a Component, too.
- Some useful things in the Application
class
- Message Boxes. You will certainly use these,
and your life might be easier if you know about the arguments other than the
message itselfButtons and Iconsand a couple of their settings.
- Some of the properties of the Form class,
including
- Form border styles
- Creating and showing a second form from a first one.
- Form.Close() vs.
Form.Hide()
- Creating C# Propertiesand not just for adding to a Form
- Get(), Set()
- How to make Properties read-only and write-only
- How and where access modifiers are set for Properties
- Attributes of properties:
Browsable, EditorBrowsable
- Forms (visual) inheritance, and overriding an inherited property
- Event handling:
- Adding event handlers
- Overriding an existing event handler
- What happens when you mix these two, and
- Calling the overridden method
- Graphics. You should be familiar with this,
but not necessarily intimate.
- The four ways to get a Graphics object, as listed on page 77.
Kalani has examples of most of them:
- Graphics property of the
PaintEventArgs argument: p. 79.
- The CreateGraphics() method of a Form
or Control: no example.
- Graphics.FromHwnd(): p. 99
- Graphics.FromImage(imageObject):
p. 95.
(A tricky example,
as it uses ImageFormat.Png.)
- How to draw text and graphics on a form:
DrawString()
and the corresponding graphics methods.
- Two important features of a Form or other drawable surface
that relate to graphics:
- Invalidate()
- ResizeRedraw
- Drawing shapes. Again, familiarity,
not intimacy. Don't spend a lot of time worrying about this.
- What sort of things you can draw: arcs,
ellipses, etc.
- How to use the drawing commands,
including getting a pen or brush
- The difference between Pen
and Brush,
and when each is used
- The SmoothingMode enumeration,
and what it controls
- Fill(),
and the fact that it uses a Brush
- Something about Brush types,
and, maybe, what namespace they're in
- Three Image types,
and what sort of thing they can contain:
- Bitmap
- Icon
- MetaFile.
For this one, see the example starting on p. 95
Here are some things that you should know that Kalani doesn't talk about much:
- TransparencyKey: what it does and
how it affects events such as mouse clicks and key presses.
- Warning: The TransparencyKey setting does not affect the transparency
of all control types.
Labels and Buttons are not changed, but TextBoxes and Panels,
at least, are.
The documentation is dead wrong on this point:
under "TransparencyKey",
it gives Button as an example that will be made transparent.
It won't be. Try it.
- Opacity: what it does and
how it affects events such as mouse clicks and key presses
- The Lock feature:
- What Lock does on a Form vs.
on a Control
- Where the Lock command appears
in the Visual Studio windows
- How Lock affects a control, and
- How you can change a control's properties even if the control is
"Locked"
I don't think memorizing details about Graphics methods is a good use of your time. You'll have plenty of other things to memorize.
But, of course, your luck might vary.
See you Saturday.
Here are the relevant questions from the two tests at the end of the
"short Kalani" book:
Test 1: questions
25 (page 367; answer: page 394),
28, 29, 30, 33.
Test 2: questions
14 (page 410; answer: page 441),
15, 30.
Warning! In the practice questions at the end of chapter 1 in
"short Kalani", question 9 (page 29) has what I believe
to be a wrong answer,
which is why I didn't use the question in class.
(Some of these questions may duplicate those in long Kalani.
Both texts are listed
here.)
Last revised Oct. 14, 2004