Steps through the common dialogs. Does nothing else useful : Print Dialog « GUI Windows Form « C# / C Sharp






Steps through the common dialogs. Does nothing else useful

Steps through the common dialogs. Does nothing else useful
/*
C# Programming Tips & Techniques
by Charles Wright, Kris Jamsa

Publisher: Osborne/McGraw-Hill (December 28, 2001)
ISBN: 0072193794
*/

// CmnDlgs.cs -- steps through the common dialogs. Does nothing else useful.
//
//               Compile this program with the following command line:
//                   C:>csc CmnDlgs.cs
using System;
using System.Windows.Forms;
using System.Drawing.Printing;

namespace clsCommonDialogs
{
    public class CommonDialogs
    {
        [STAThread]
        static public void Main ()
        {
            // Create and display a Choose Color dialog box.
            ColorDialog cd = new ColorDialog ();
            cd.ShowDialog ();
            cd.Dispose ();
            
            // Create and display a Choose Font dialog box.
            FontDialog fd = new FontDialog ();
            fd.ShowDialog ();
            fd.Dispose ();
                
            // Create and display an Open File dialog box.
            OpenFileDialog ofd = new OpenFileDialog ();
            ofd.ShowDialog ();
            ofd.Dispose ();
            
            // Create and display a Save File dialog box.
            SaveFileDialog sfd = new SaveFileDialog();
            sfd.ShowDialog ();
            sfd.Dispose ();
            
            // Create and display a Page Setup dialog box.
            PrintDocument printDoc = new PrintDocument();
            PageSetupDialog psd = new PageSetupDialog ();
            psd.Document = printDoc;
            psd.ShowDialog ();
            psd.Dispose ();
            
            // Create and display an Print dialog box.
            PrintDialog pd = new PrintDialog ();
            pd.Document = printDoc;
            pd.ShowDialog ();
            pd.Dispose ();
            
            // Create and display an Print Preview File dialog box.
            // This dialog is not a part of the common dialog library.
            PrintPreviewDialog ppd = new PrintPreviewDialog ();
            ppd.ShowDialog ();
            ppd.Dispose ();
            printDoc.Dispose ();
        }
    }
}


           
       








Related examples in the same category

1.Using PrintPreviewDialog