Graphical User Interface
-
Upload
harper-mclaughlin -
Category
Documents
-
view
19 -
download
0
description
Transcript of Graphical User Interface
![Page 1: Graphical User Interface](https://reader031.fdocuments.in/reader031/viewer/2022032206/5681332d550346895d9a2781/html5/thumbnails/1.jpg)
Dr. AbrahamProfessor
UTPA
Graphical User Interface
![Page 2: Graphical User Interface](https://reader031.fdocuments.in/reader031/viewer/2022032206/5681332d550346895d9a2781/html5/thumbnails/2.jpg)
FormsForms used to create GUIs for programs and
it is a container for controls and components.Active window has a highlighted title bar and
It has the focusWhen a control or component is dragged
onto the form, visual studio generates code for it and can be viewed.
A programmer can write the code to place these controls as well.
See the example of adding pictures I discussed in class.
![Page 3: Graphical User Interface](https://reader031.fdocuments.in/reader031/viewer/2022032206/5681332d550346895d9a2781/html5/thumbnails/3.jpg)
Coding to add a buttonFriend WithEvents BtnMine As
System.Windows.Forms.Button Private Sub Form1_Load(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
BtnMine = New System.Windows.Forms.Button BtnMine.Location = New System.Drawing.Point(20,
20) BtnMine.Name = "BtnMine" BtnMine.Size = New System.Drawing.Size(75, 23) BtnMine.Text = "My Button" Controls.Add(BtnMine) End Sub
![Page 4: Graphical User Interface](https://reader031.fdocuments.in/reader031/viewer/2022032206/5681332d550346895d9a2781/html5/thumbnails/4.jpg)
Code generated for picture boxPictureBox1 = New PictureBox PictureBox1.Image =
Global.windowsForms.My.Resources.Resources._1 Me.PictureBox1.Location = New
System.Drawing.Point(12, 51) Me.PictureBox1.Name = "PictureBox1" Me.PictureBox1.Size = New
System.Drawing.Size(74, 97) Me.AutoScaleDimensions = New
System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode =
System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(284,
264) Me.Controls.Add(Me.PictureBox1)
![Page 5: Graphical User Interface](https://reader031.fdocuments.in/reader031/viewer/2022032206/5681332d550346895d9a2781/html5/thumbnails/5.jpg)
Now look at the program I discussed in class ‘PictureName = InputBox("What is the Name of
the Picture?", "Picture") PictureName = "C:\vb2008\addPictures\" +
PictureName pictBox = New PictureBox Controls.Add(pictBox) pictBox.BringToFront() pictBox.Image =
Image.FromFile(PictureName) pictBox.Top = offset pictBox.Width = 100 pictBox.Height = 100 pictBox.Left = offset offset = offset + 10
![Page 6: Graphical User Interface](https://reader031.fdocuments.in/reader031/viewer/2022032206/5681332d550346895d9a2781/html5/thumbnails/6.jpg)
Change parameters in the code generated
Example comment picture box locationAdd picturebox1.topEtc.You can learn coding for controls like this
![Page 7: Graphical User Interface](https://reader031.fdocuments.in/reader031/viewer/2022032206/5681332d550346895d9a2781/html5/thumbnails/7.jpg)
Control Properties & LayoutTab IndexEnabled – focusAnchor (remain at fixed distance from the
sides)Docking (Attaches a control to a container)Labels, TextBoxes and Buttons. Password
Textboxt box hides information typed.Checkboxes,comboboxes, and radio buttonsGroupboxes and Panels to arrange controls
and group them.
![Page 8: Graphical User Interface](https://reader031.fdocuments.in/reader031/viewer/2022032206/5681332d550346895d9a2781/html5/thumbnails/8.jpg)
Keyboard & mouse Event HandlingMouseEnter, MouseLeave, MouseDown,
MouseUp, MouseMove, MovesHoverKeyDown, KeyUp, KeyPress, KeyChar,
Handled, Alt, Control, Shift, etc.
![Page 9: Graphical User Interface](https://reader031.fdocuments.in/reader031/viewer/2022032206/5681332d550346895d9a2781/html5/thumbnails/9.jpg)
Rich Text BoxWriting a text editor.File Opening and ReadingWriting to FileDrop Down MenusContext Sensitive MenusChanging Font attributesSee demo
![Page 10: Graphical User Interface](https://reader031.fdocuments.in/reader031/viewer/2022032206/5681332d550346895d9a2781/html5/thumbnails/10.jpg)
Other FeaturesSplash ScreenCheck boxes and dropdown lists covered
earlierBackground color changeFade-in effectButton tricksSee math game demo
![Page 11: Graphical User Interface](https://reader031.fdocuments.in/reader031/viewer/2022032206/5681332d550346895d9a2781/html5/thumbnails/11.jpg)
Printing to Default PrinterSee demo
![Page 12: Graphical User Interface](https://reader031.fdocuments.in/reader031/viewer/2022032206/5681332d550346895d9a2781/html5/thumbnails/12.jpg)