Presentation is loading. Please wait.

Presentation is loading. Please wait.

Module 1 Window Forms – Basic, Grouping and Graphic controls 1.

Similar presentations


Presentation on theme: "Module 1 Window Forms – Basic, Grouping and Graphic controls 1."— Presentation transcript:

1 Module 1 Window Forms – Basic, Grouping and Graphic controls 1

2 Objective  Overview Window Form and basic Control  Form class  Types of Control  Basic Controls  Grouping an Graphic Controls 2

3 Application 3 User Interface - Easy to learn - Easy to use - Attractive Program

4 WinForms and.NET Framework Windows Forms :  are a part of the.NET Framework that is used to build, deploy and run applications.  Provide with a standard programing model in order to create application with least bugs.  Are executed in the.NET CLR runtime. 4

5 Features Click one deployment Application setting New Windows Forms controls New Data Binding model Rich graphics 5 Create App with least operation Store global data to reuse anywhere Powerfull way to link control with data source ( BindingSource component ) GDI+ : drawing and painting image on forms ToolStrip, MenuStrip ….

6 Form Is the basic unit of an application Presents information to the user Receives information from the user. Is represented as a class in the System.Windows.Forms namespace. 6 Properties Text, BackColor, ForeColor, Font, WindowState, AcceptButton, Location, Modal, Name MethodsActivate, Close, Focus, Hide, Show, Enabled EventsLoad, Activated,Shown,Deactivate, FormClosing, FormClosed, Resize, Click, GotFocus

7 Use of Controls 7 Control class Base class of all controls available in WinForms

8 Control Class CanFocus Controls Enable Name Parent TabIndex Visible 8 Properties  Focus  GetNextControl  Hide  IsMNemonic  Select  Show Method  Click  ControlAdd  DoubleClick  Validating  Validated  KeyPress  Leave  LostFocus  MouseClick  Move Event Example this.[controlname].[propertyname]

9 Common Controls Label Textbox Button ListBox ComboBox LinkLabel 9

10 Label Name Text TextAlign UseMnemonic 10 Properties  Contains  Hide  Show Method  Click Event Label fName = new Label(); fname.Text = “&First Name : “; fName.UseMnemonic = true ; Label

11 TextBox CharacterCasing MaxLength MultiLine Name PasswordChar ReadOnly Text 11  AppendText  Clear  Focus  Copy  Paste  KeyPress  Leave  TextChanged TextBox PropertiesMethodEvent

12 MaskedTextBox Mask MaskFull MaskCompleted Name PromptChar Text 12  GetPositionFrom CharIndex  SelectAll  MaskChanged  MaskedInputRejected MaskedTextBox mks = new MaskedTextBox(); mks.Mask = “00000-9999”; mks.Text = “095204-7763”; if(!mks.MaskFull) { MessageBox.Show(“Enter proper code …”); } PropertiesMethodEvent

13 Mask Description 0Digit, required. [0-9] 9Digit or space, optional. # Digit or space, optional. If this position is blank in the mask, it will be rendered as a space in the property. Plus (+) and minus (-) are allowed. LLetter, required [a-zA-Z]. ?Letter, optional. [a-zA-Z]. &Character, required. If the property = true, behaves like the "L". C Character, optional. Any non-control character. If the property =true, this element behaves like the "?" element. A Alphanumeric, optional. If the property =true, the only characters it will accept are the ASCII letters a-z and A-Z. a Alphanumeric, optional. If the property is set to true, the only characters it will accept are the ASCII letters a-z and A-Z. 13

14 Button DialogResult Enabled FlatStyle Image Name Text 14 Button cmdOK = new Button(); cmdOK.Text = “OK” ; cmdOK.FlatStyle = System.Windows.Forms.FlatStyle.Flat; PropertiesMethodEvent Focus PerformClick Click DoubleClick MouseDoubleClick Button

15 ListBox Can select multivalues 15 DisplayMember Items SelectionMode SelectedIndex ClearSelected GetItemText GetSelected SetSelected SelectedIndexChanged SelectedValueChanged ValueMemberChanged PropertiesMethodEvent

16 ComboBox DropDownStyle Items MaxDropDownItem SelectedItem SelectedIndex Text ValueMember 16  GetItemText  SelectAll  Select (int start, int len)  DropDown  SelectedIndexChanged  SelectedValueChanged  ValueMemberChanged PropertiesMethodEvent

17 LinkLabel 17 Display a Hyperlink that link to a Web Page or another Window Form Properties: ActiveLinkColor, Links, LinkColor, LinkVisited, Text, VisitedLinkColor Method : Select Event : LinkClicked

18 Grouping Controls 18 Value Setting ControlForm class  RadioButton  CheckBox  CheckListBox Grouping Controls  GroupBox  Panel Images Control  PictureBox  ImageList

19 RadioButton Appearance AutoCheck Checked Image 19  PerformClick  Select  Show  CheckedChanged  Click PropertiesMethodEvent

20 CheckBox Checked CheckState ThreeState 20  Select  Show  CheckedChanged  CheckStateChange  Click PropertiesMethodEvent

21 CheckedListBox CheckedIndices CheckedItems CheckOnClick Items SelectedValue SelectedItems SelectedItem 21  ClearSelected  GetItemChecked  GetItemCheckState  GetItemText  SetItemChecked  SetItemCheckState  ItemCheck  MouseClick  SelectedIndexChanged  SelectedValueChanged PropertiesMethodEvent

22 Grouping Control Panel  Contains other Control GroupBox  As Panel but appear as Frame around Control 22

23 Panel AutoSize AutoSizeMode BorderStyle 23  Select  Show  StyleChanged  VisibleChanged PropertiesMethodEvent

24 GroupBox AutoSize, Anchor, FlatStyle 24 Hide, Show StyleChanged, Resize Properties Method Event

25 Graphic Controls PictureBox  Display image on the Form (.bmp,.jpg..)  Can hold sigle image at a time ImageList  Store collection of images 25

26 PictureBox Image ErrorImage InitialImage SizeMode 26  Load  LoadAsync  Click  Leave  LoadCompleted PropertiesMethodEvent

27 ImageList Images ColorDepth ImageSize Name 27  Draw  RecreateHandle PropertiesMethodEvent

28 SplitContainer Divide the form into two resizable panels As Window Explorer 28 Properties BorderStyle FixedPanel IsSplitterFixed Panel1 Panel2 Orientation Method OnSplitterMoved OnSplitterMoving Event SplitterMoved SplitterMoving Click


Download ppt "Module 1 Window Forms – Basic, Grouping and Graphic controls 1."

Similar presentations


Ads by Google