public WindowMain()
    {
      InitializeComponent();

      fAppSettings = new AppSettings();
      fLastScanned = PageTypeEnum.Letter;

      fScanner = new Scanner();
      fPrinter = new Printer();
      fPdfExporter = new PdfExporter();
      fPdfImporter = new PdfImporter();
      fImageLoader = new ImageLoader();
      fImageSaver = new ImageSaver();

      fDocument = new Document();
      fDocument.OnPageAdded += fDocument_OnPageAdded;
      fDocument.OnPageRemoved += fDocument_OnPageRemoved;
      fDocument.OnPageUpdated += fDocument_OnPageUpdated;
      fDocument.OnPageMoved += fDocument_OnPageMoved;
       
      fInsertionMark = new InsertionMark();
      fDragStartItem = null;
      fScrollTimer = new System.Timers.Timer(150);
      fScrollTimer.Elapsed += fScrollTimer_Elapsed;
      fScrollTimer.AutoReset = false;

      this.KeyUp += WindowMain_KeyUp;

      fClosing = false;
      fDeleting = false;
    }
    public FormMain()
    {
      InitializeComponent();
      this.Text = AppInfo.GetApplicationName();

      // Create PictureBoxPreview from special component;
      this.PictureBoxPreview = new Cyotek.Windows.Forms.ImageBox();
      this.PictureBoxPreview.Dock = System.Windows.Forms.DockStyle.Fill;
      this.PictureBoxPreview.TabStop = false;
      this.PictureBoxPreview.BorderStyle = BorderStyle.None;
      this.PictureBoxPreview.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
      this.PanelPreview.Controls.Add(this.PictureBoxPreview);

      fAppSettings = new AppSettings();

      fScanner = new Scanner();
      fPrinter = new Printer();
      fPdfExporter = new PdfExporter();
      fPdfImporter = new PdfImporter();
      fImageLoader = new ImageLoader();
      fImageSaver = new ImageSaver();

      fDocument = new Document();
      fDocument.OnPageAdded += fDocument_OnPageAdded;
      fDocument.OnPageRemoved += fDocument_OnPageRemoved;
      fDocument.OnPageUpdated += fDocument_OnPageUpdated;
      fDocument.OnPageMoved += fDocument_OnPageMoved;

      fClosing = false;
      fDeleting = false;

      MenuSettingsPrinterUsePreview.Checked = true;
    }