Upload presentasi
Presentasi sedang didownload. Silahkan tunggu
Diterbitkan olehDira Arnold Telah diubah "9 tahun yang lalu
1
Basic Components Devi, Erick, Hendrawan, Reddy © Sekolah Tinggi Teknik Surabaya 1
2
» Important entities: ˃Properties: define component’s behavior ˃Events » Event-Driven Programming ˃Source code is executed when an event is triggered ˃Every component has event slots that can be coded ˃ Example: click event on Button. » Every components has (name) to identify components’ ID. 2 © Sekolah Tinggi Teknik Surabaya
3
3
4
» Text: Form title » Maximize Box » Minimize Box » FormBorderStyle ˃None ˃FixedSingle ˃Fixed3D ˃FixedDialog ˃Sizeable (Default) ˃FixedToolWindow ˃SizableToolWindow 4 © Sekolah Tinggi Teknik Surabaya
5
» WindowState ˃Normal (Default) ˃Minimized ˃Maximized » StartPosition ˃Manual ˃CenterScreen ˃WindowsDefaultLocation ˃WindowsDefaultBounds ˃CenterParent 5 © Sekolah Tinggi Teknik Surabaya
6
» Load: Occurs whenever the user loads the form » FormClosed: Occurs whenever the form is closed 6 © Sekolah Tinggi Teknik Surabaya
7
7
8
» Text: Content within TextBox » TextAlign ˃Left ˃Right ˃Center » PasswordChar: Determine what character should be shown as character replacement » MaxLength 8 © Sekolah Tinggi Teknik Surabaya
9
» TextChanged: Occurs whenever text property is changed 9 © Sekolah Tinggi Teknik Surabaya
10
10 © Sekolah Tinggi Teknik Surabaya
11
» Text: Button Caption ˃Add ampersand (&) in front of a character to make it a mnemonic key for that button » TextAlign 11 © Sekolah Tinggi Teknik Surabaya TopLeftTopCenterTopRight MiddleLeftMiddleCenterMiddleRight BottomLeftBottomCenterBottomRight
12
» Click 12 © Sekolah Tinggi Teknik Surabaya
13
13 © Sekolah Tinggi Teknik Surabaya
14
» Text » TextAlign (refer to Button TextAlign) » AutoSize: determine whether its size should automatically resize to text 14 © Sekolah Tinggi Teknik Surabaya
15
» Click » TextChanged 15 © Sekolah Tinggi Teknik Surabaya
16
16 © Sekolah Tinggi Teknik Surabaya
17
» Text » Checked 17 © Sekolah Tinggi Teknik Surabaya
18
» CheckedChanged 18 © Sekolah Tinggi Teknik Surabaya
19
19 © Sekolah Tinggi Teknik Surabaya
20
» Text » Checked 20 © Sekolah Tinggi Teknik Surabaya
21
» CheckedChanged 21 © Sekolah Tinggi Teknik Surabaya
22
22 © Sekolah Tinggi Teknik Surabaya
23
» Items: collection of objects to be displayed » MultiColumn: one column only or not » Sorted: whether objects in it should be sorted naturally in ascending manner » SelectionMode ˃None ˃Single ˃MultiSimple (on click basis) ˃MultiExtended (on drag basis) 23 © Sekolah Tinggi Teknik Surabaya
24
» SelectedIndexChanged 24 © Sekolah Tinggi Teknik Surabaya
25
» listBox1.Items.Clear(); ˃Clear Items » listBox1.Items.Add("string"); ˃Add an item to Items » listBox1.Items.RemoveAt(2); ˃Remove an item from Items » int x = listBox1.SelectedIndex; ˃Retrieve selected item index » string x = listBox1.SelectedItem.ToString(); ˃Retrieve selected item string 25 © Sekolah Tinggi Teknik Surabaya
26
» For multi selection: foreach (int i in listBox1.SelectedIndices) { MessageBox.Show(i.ToString()); } foreach (string i in listBox1.SelectedItems) { MessageBox.Show(i); } 26 © Sekolah Tinggi Teknik Surabaya
27
27 © Sekolah Tinggi Teknik Surabaya
28
» Items » MaxLength » DropDownStyle ˃Simple ˃DropDown (Default) ˃DropDownList » Sorted » Text: String displayed if DropDownStyle is not DropDownList 28 © Sekolah Tinggi Teknik Surabaya
29
» SelectionIndexChanged » SelectionChangeCommitted: Occurs whenever the item is truly chosen 29 © Sekolah Tinggi Teknik Surabaya
30
» comboBox1.Items.Clear(); ˃Clear Items » comboBox1.Items.Add("string"); ˃Add an item to Items » comboBox1.Items.RemoveAt(2); ˃Remove an item from Items » int x = comboBox1.SelectedIndex; ˃Retrieve selected item index » string x = comboBox1.SelectedItem.ToString(); ˃Retrieve selected item string 30 © Sekolah Tinggi Teknik Surabaya
31
31 © Sekolah Tinggi Teknik Surabaya
32
32 © Sekolah Tinggi Teknik Surabaya
33
33 © Sekolah Tinggi Teknik Surabaya
34
34 © Sekolah Tinggi Teknik Surabaya
35
35 © Sekolah Tinggi Teknik Surabaya
36
36 © Sekolah Tinggi Teknik Surabaya
37
37 © Sekolah Tinggi Teknik Surabaya
38
» Add additional functions for previous example ˃Update selected data ˃Delete selected data. Provide a confirmation dialog before deletion. 38 © Sekolah Tinggi Teknik Surabaya
Presentasi serupa
© 2024 SlidePlayer.info Inc.
All rights reserved.