Dialog boxes
This presentation is the property of its rightful owner.
Sponsored Links
1 / 13

Dialog Boxes PowerPoint PPT Presentation


  • 86 Views
  • Uploaded on
  • Presentation posted in: General

Dialog Boxes. The OpenFileDialog and SaveFileDialog Controls. All dialog boxes derive from the CommonDialog class and share similar features The OpenFileDialog and SaveFileDialog controls are derived from the CommonDialog class

Download Presentation

Dialog Boxes

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Dialog boxes

Dialog Boxes


The openfiledialog and savefiledialog controls

The OpenFileDialog and SaveFileDialog Controls

  • All dialog boxes derive from the CommonDialog class and share similar features

    • The OpenFileDialog and SaveFileDialog controls are derived from the CommonDialog class

      • These classes allow the end user to select a file to open or save

    • The FolderBrowserDialog control also derives from the CommonDialog class

      • This control allows the end user to select a folder


Members of the openfiledialog and savefiledialog classes

Members of the OpenFileDialog and SaveFileDialog Classes

  • The CheckFileExists and CheckPathExists properties control whether the end user can select a file or folder that does not exist

  • The FileName property contains the filename selected by the end user

  • The Filter property defines the type of files that will be displayed for selection

  • The FilterIndex property contains the index of the current filter

    • The Filter and FilterIndex properties work together


Members of the openfiledialog and savefiledialog classes continued

Members of the OpenFileDialog and SaveFileDialog Classes (continued)

  • The InitialDirectory property contains the initial folder where the search for files begins

  • The OverwritePrompt property applies only to the SaveFileDialog. If True, the end user will be prompted before a file is overwritten

  • The RestoreDirectory property defines whether the current directory will be restored after the end user selects a file

  • The ShowDialog method displays the respective dialog box


The filter property introduction

The Filter Property (introduction)

  • The Filter property restricts the files displayed based on a file extension

  • A filter consists of

    • A description

    • Followed by a vertical bar

    • Followed by the actual filter

  • Multiple filters can be connected together

  • Do not put spaces between the vertical bars


The filter property example

The Filter Property (Example)

  • Set the Filter to three possible filters (*.txt), (*.rtf), and (*.*)

  • Set the FilterIndex to select the second filter by default

    ofdMain.Filter = "Text files (*.txt)|*.txt|" _

    "Rich text files (*.rtf)|*.rtf|All files" _ "(*.*)|*.*"

    ofdMain.FilterIndex = 2


Using the savefiledialog control

Using the SaveFileDialog Control

  • The SaveFileDialog control works the same way as the OpenFileDialog control

  • Set the OverwritePrompt property to Trueto prevent the end user from accidentally overwriting files


The folderbrowserdialog introduction

The FolderBrowserDialog(Introduction)

  • Use the FolderBrowserDialog to browse for folders instead of files

  • Members

    • The Description property contains the text appearing in the title bar

    • The RootFolder property contains the topmost folder appearing in the dialog box

    • The SelectedPath property contains the folder selected by the end user

    • The ShowDialog method displays the dialog box


Using windows defined directories

Using Windows-Defined Directories

  • Members of the System.Environmentclass are used to get system directories

    • The SystemDirectory property gets the Windows system directory

      • The directory is typically C:\Windows\System32

    • The CurrentDirectory property contains the directory from which the application was run

    • The GetFolderPath method gets a system special folder


Color about

Color (About)

  • Color is made up of RGB values and an “alpha” value that controls opacity

    • Values range between 0 and 255

    • 255,255,255 is white

    • 0,0,0 is black


The colordialog introduction

The ColorDialog (Introduction)

  • It works the same way as the other dialog boxes

    • Call ShowDialog to display the dialog box

    • The Color property contains the selected color

  • Properties

    • AllowFullOpen allows the user to select custom colors

    • FullOpen displays the full color palette


The fontdialog introduction

The FontDialog (Introduction)

  • It works the same way as the other dialog boxes

    • Call ShowDialog to display the dialog box

    • There are many more properties to work with

  • ShowApply, ShowColor, ShowEffects control how the dialog box appears

  • Font gets or sets the desired font

  • MaxSize and MinSize control the selectable font sizes


  • Login