( Index )
Month

Brief Information about the February 2007 CSIG Meeting

General Review of .NET Programs Covered Recently

by Bruce Arnold

3rd Tuesday of the month. 7:30PM - C/C++ Group, SPRS

CodeProject Snapshot Security Log Results Colored Night Stars Form Designer Screen Shot Print Preview Screen Sample Screen Shot

Welcome to the CSIG, a Special Interest Group of the ACGNJ. This group is a "Special Interest Group" of the ACGNJ devoted to discussing programming languages in general and C, C++, and C++ for Windows programming in particular. Each month a small but hopefully useful program (complete with source code) is presented for discussion.

This month we will be reviewing the .NET programs that were discussed over the last 6 months using the latest Microsoft compilers. The programs may be compiled using the C++ .Net compiler included with Visual Studio 2005 as well as the free (!!!) C++ Express compiler. Additionally, since C++ has many similarities with C# or C-Sharp, these compilers may also be used with modifications to the source files. Microsoft provides a C-Sharp compiler with Visual Studio 2005 as well as the free (!!!) C-Sharp Express compiler. Be sure to bring questions about the code and the language.


The programs are normally quite small, about 100 KB, but require a Windows computer that has the following software installed:

Microsoft .NET Framework Version 2.0

This is a large package, about 24 Megs. Most people running updated versions of WinXP will already have it on their computer. If not, it may be downloaded from Microsoft.

Here's the download address for the Microsoft Framework:
Microsoft Software
Or, just look for: Microsoft .NET Framework Version 2.0 Redistributable Package (x86)

There are a number of ways to refer to this compiler and code.

Here's what Wikipedia says about CLI:

The Common Language Infrastructure (CLI) is an open specification developed by Microsoft that describes the executable code and runtime environment that form the core of the Microsoft .NET Framework. The specification defines an environment that allows multiple high-level languages to be used on different computer platforms without being rewritten for specific architectures.

At the meeting on Tuesday night we will be discussing these items and more.


Sample Code - VC7

Sample Code
===========
// Paint the screen.   Paint the screen.   Paint the screen.
    private: System::Void Form1_OnPaint(System::Object^  sender, System::Windows::Forms::PaintEventArgs^  e)
        {
            int topBalloon = -1;
            Rectangle windowRect = ClientRectangle;

            if (firstime)
            {
                Form1_InitBalloonArray(windowRect);
                firstime = false;
            }
            Graphics ^g = e->Graphics;

            for (int i = 0; i < MAXBALLOONS; i++)
            {
                if (pBaloonCenter[i]->X < 0) continue;

                SolidBrush^ balloonBrush = gcnew SolidBrush(*pBaloonColor[i]);
                g->FillEllipse(balloonBrush,
                    (*pBaloonCenter[i]).X - *pBalloonRadius[i],
                    (*pBaloonCenter[i]).Y - *pBalloonRadius[i],
                    2 * (*pBalloonRadius[i]),
                    2 * (*pBalloonRadius[i]));
                g->DrawEllipse(Pens::Black,
                    (*pBaloonCenter[i]).X - *pBalloonRadius[i],
                    (*pBaloonCenter[i]).Y - *pBalloonRadius[i],
                    2 * (*pBalloonRadius[i]),
                    2 * (*pBalloonRadius[i]));
                // ~balloonBrush();  or balloonBrush->Dispose();
                topBalloon = i;
            }

            if (-1 != topBalloon)       // Put a X in the center of the top balloon.
            {
                Pen ^ myBlackPen = gcnew Pen(Color::Black, 10);
                myBlackPen->StartCap = System::Drawing::Drawing2D::LineCap::Round;
                myBlackPen->EndCap = System::Drawing::Drawing2D::LineCap::Round;

                Pen ^ myWhitePen = gcnew Pen(Color::White, 5);
                myWhitePen->StartCap = System::Drawing::Drawing2D::LineCap::Round;
                myWhitePen->EndCap = System::Drawing::Drawing2D::LineCap::Round;

                g->DrawLine(myBlackPen,
                    (*pBaloonCenter[topBalloon]).X - 10, (*pBaloonCenter[topBalloon]).Y - 10,
                    (*pBaloonCenter[topBalloon]).X + 10, (*pBaloonCenter[topBalloon]).Y + 10);
                g->DrawLine(myBlackPen,
                    (*pBaloonCenter[topBalloon]).X - 10, (*pBaloonCenter[topBalloon]).Y + 10,
                    (*pBaloonCenter[topBalloon]).X + 10, (*pBaloonCenter[topBalloon]).Y - 10);
                g->DrawLine(myWhitePen,
                    (*pBaloonCenter[topBalloon]).X - 10, (*pBaloonCenter[topBalloon]).Y - 10,
                    (*pBaloonCenter[topBalloon]).X + 10, (*pBaloonCenter[topBalloon]).Y + 10);
                g->DrawLine(myWhitePen,
                    (*pBaloonCenter[topBalloon]).X - 10, (*pBaloonCenter[topBalloon]).Y + 10,
                    (*pBaloonCenter[topBalloon]).X + 10, (*pBaloonCenter[topBalloon]).Y - 10);
                //myBlackPen->Dispose();
                //myWhitePen->Dispose();
            }
        }

"Random Access" questions start at 7:30 Tuesday night. See you there.

SOURCE CODE

Source Code Files

For help, email me at b a r n o l d @ i e e e . o r g
Back to C++ Main Page