Home Robotics C++ Physics II AP Physics B Electronics AP Java Astronomy Independent Study Summer Session Contests  About
                                                       

Creating an Application Programming Interface

Windows Border Style

Form ForeColor, BackColor

Form Title and Font

Message Box Parameters

MessageBox Example 1: Displaying a Message

MessageBox Example 2: Logic Statements



Windows Border Style
Click on Form, right click, select Properties, click
on drop down, select one of the following
Form ForeColor, BackColor
Same as above, note that a description of the selection
appears at the bottom of the properties list
Form Title and Font
For that appears at the upper left of the Form, select the Text option, Select Font for Font

Message Boxes

Parameters Available For the Message::Show Method - Partial List

Parameter

Description

Text

The text string to be displayed in the pop-up window

Caption

The text string to be displayed in the pop-up window's title bar

Buttons

The button or group of buttons to be displayed in the pop-up window

Icon

the type of icon to be displayed in the pop-up window



Buttons Available to the MessageBox::Show Method

Button

Description

AbortRetryIgnore

Displays an Abort, a Retry, and an Ignore Button

OK

Displays an OK button

OKCancel

Displays an OK and a Cancel button

RetryCancel

Displays a Retry and a Cancel button

Yes/No

Displays a Yes and a No button

YesNoCancel

Displays a Yes, a No, and a Cancel button



Icons Available to the MessageBox::Show Method

Button

Description

Asterisk

Displays an Asterisk Icon

Error

Displays an Error Icon

Exclamation

Displays an Exclamation Mark Icon

Hand

Displays a Hand Icon

Information

Displays an Informational Icon

None

Displays the pop-up window without displaying an Icon

Question

Displays a Question Mark Icon

Stop

Displays a Stop Icon

Warning

Displays a Warning Icon


MessageBox Example 1



private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e)

{

      MessageBox::Show("Please select one of the following",        //Message

     "MessageBox::Show,MessageBoxes",                                  //Title

      MessageBoxButtons::AbortRetryIgnore,                                //Button options to show

      MessageBoxIcon::Exclamation);                                           //Icon

}



MessageBox Example 2


private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e)

             {

                if (MessageBox::Show("Examples","If Statements", MessageBoxButtons::OKCancel) == System::Windows::Forms::DialogResult::Cancel)                               

                {

                        MessageBox::Show("You clicked cancel");

                }

                else

                {

                       MessageBox::Show("You clicked OK");

                }

            }