Presentation is loading. Please wait.

Presentation is loading. Please wait.

GUI-Labels, TextBoxes and Buttons Label- displays read-only text Common properties:  Font – font used by the text of label  Text – text to appear on.

Similar presentations


Presentation on theme: "GUI-Labels, TextBoxes and Buttons Label- displays read-only text Common properties:  Font – font used by the text of label  Text – text to appear on."— Presentation transcript:

1 GUI-Labels, TextBoxes and Buttons Label- displays read-only text Common properties:  Font – font used by the text of label  Text – text to appear on the label  TextAlign – Alignment of the label’s text Button – user click to trigger a specific action Common properties  Text Common event  click

2 GUI- TextBoxes Common properties  AcceptsReturn: If true, pressing Enter creates a new line in the text box, if that text box spans multiple lines. If false, press enter clicks the default button of the form  Multiline: if true, text box can span multiple line  PasswordChar:single character to display instead of typed text.  ReadOnly: if true, text box has grey background and its text cannot be edited  ScrollBars: for multiple lines text, indicated which scrollbars appear  Text : text to be displayed in the text box Common event  TextChanged

3 GUI-CheckBoxes Checkbox:  A group of check boxes allow the user to select combinations of choices.  Any number may be selected at a time  The text that appear alongside a check box is referred to as the checkbox label. Properties  Checked  CheckState Events  CheckedChanged  CheckStateChanged

4 GUI-RadioButton RadioButton:  Several radio buttons group together  Only one of the radio buttons in the group can be selected (true) at any time Properties:  Checked : specifies whether the radio button is checked  Text: Text displayed to the right of the radio button Events:  Click: Raised when user click the control  CheckedChanged: Raised every time the radio button is checked or unchecked

5 Font property To change the font, the Font property must be set to a Font object The Font constructor takes the font name, size and style  FontStyle enumeration contains Regular Bold Italic Strikeout Underline

6 Style property A Font object’s Style property is set when the Font object is created – the Style property itself is read-only Styles can be combined using bitwise operators, or operators that perform manipulation on bits. Use bitwise XOR operator, we can set the font style so that the text will appear bold if it was not bold originally, and vice versa.

7 Bitwise XOR operator ^ Bitwise operator perform manipulation on bits. Actions are taken and data are modified using these bits values Bitwise XOR operator ^  0 0 0  1 0 1  0 1 1  1 1 0 If style is not bold(0), then set to bold(1) If style is already bold(1), then set to not bold(0)

8 Set the font style for a label Lb_message->Font = new Drawing::Font( lb_message->Font->name, lb_message- >Font->size, static_cast (lb_message- >Font->Style^FontStyle::Bold) );

9 MessageBox MessageBox::Show() can take three argument, and return DialogResult  String  MessageBoxButtons OK OKCancel YesNo YesNoCancel AbortRetryIgnore  MessageBoxIcon Error Exclamation Information Question

10 DialogResult DialogResult from MessageBox Contain enumeration value DialogResult::OK DialogResult::Cancel DialogResult::Abort DialogResult::Retry DialogResult::Ignore DialogResult::Yes DialogResult::No

11 Object passed to event handler Private: System::Void radio_MouseEnter( Object * sender, EventArg * e) { if ( sender == radioButton1) { // action } if ( sender == radioButton2) { // action } } Register one event handler to more object

12 Example code Private: System::Void buttonType_CheckedChanged( System::Object * sender, Ssytem::Eventarg *e) { if (sender == okButton) buttonType = MessageBoxButtons::OK; }


Download ppt "GUI-Labels, TextBoxes and Buttons Label- displays read-only text Common properties:  Font – font used by the text of label  Text – text to appear on."

Similar presentations


Ads by Google