This week shows just enough
to use C# and Windows Forms to allow us to interact with Direct3d. You
will learn
about the use of:
The main point of this week is to see how the Windows Forms versions differ
from the MFC versions.
C#
Class Examples
|
Description
|
Notes |
1.simple_csharp_windows_forms.zip
MFC version: 1.simple_mfc.zip |
- Create a basic Windows Forms Application.
- Note some differences from the MFC version.
|
|
2.simple_button_and_echo.zip
MFC version: 2.simple_button_and_echo.zip |
- Add controls to the form.
- Introduce events and simple event handling.
|
|
3.button_echo_and_trackbar.zip
MFC version: 3.button_echo_and_slider_bar.zip |
- Add a couple of trackbars to the form.
- Handle the scroll event of the trackbars.
|
|
4.timer_event.zip
MFC version: 4.timer_event.zip |
- Add a Timer component to the form.
- Add mouse handling events (with Modifier keys).
- Echo the mouse location to the status area.
|
|
5.with_separate_lib.zip
MFC version: 5.with_separate_lib.zip |
- Extend class example 4.
- Add a new project to the solution. The new project is called GraphicsAPI.
- Add a Utility class to the new project.
- Set up the references
and dependencies between the projects in the solution and introduce
changes dealing with namespaces to keep things neat and clean.
|
|
6.update_data.zip
MFC version: 6.update_data.zip |
- Extend class example 5. This example is really just
informational in nature and can be skipped if you want.
- Add a CheckBox control.
- Demonstrate some “dynamic” updating
of the controls. As the timer ticks, the two TrackBars will decrease
in value until they
are zero. You can toggle this on/off with the checkbox.
|
|
7.with_d3d_device.zip
MFC version: 7.with_d3d_device.zip |
- Extend class example 5. (Take out some stuff from
example 6).
- Add Direct3D to the application and initialize!
- Add a new class that
inherits from a Windows Forms control such as a PictureBox and use
that class from the main form to host Direct3D.
- Use the TrackBar controls
on the form to alter the color that the Direct3D device will “clear” with.
|
|
8.d3d_with_mouse.zip
MFC version: 8.d3d_with_mouse.zip |
- Extend class example 7.
- Add mouse handling events for the Direct3D drawing area (D3dDrawable class,
which is a PictureBox derived control).
- Create a new AppMain.cs file for convenience.
- Add an EchoToStatusArea method to the AppMain.cs file for a “global” hook
into the Form1 status area.
|
|
© 2004 - Jason Pursell. All Rights Reserved