예제 #1
0
        private void menuFile_New_Click(object sender, EventArgs e)
        {
            FormDocument frmDocument = new FormDocument();

            frmDocument.Show(this.dockMain, DockState.Document);
            frmDocument.FormMain = this;
        }
예제 #2
0
        private void printDoc_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
            FormDocument activeDocument = this.ActiveMdiChild as FormDocument;

            if (activeDocument == null)
            {
                return;
            }
            activeDocument.PrintShapes(e.Graphics);
        }
예제 #3
0
        private void menuFile_Print_Click(object sender, EventArgs e)
        {
            FormDocument activeDocument = this.ActiveMdiChild as FormDocument;

            if (activeDocument == null)
            {
                return;
            }

            this.printPreview          = new PrintPreviewDialog();
            this.printPreview.Document = this.printDoc;
            this.printPreview.ShowDialog();
        }
예제 #4
0
        private void menuFile_Export_Click(object sender, EventArgs e)
        {
            //As转换,如果转换失败,对象为空
            FormDocument activeDocument = this.ActiveMdiChild as FormDocument;

            if (activeDocument == null)
            {
                return;
            }


            SaveFileDialog saveDlg = new SaveFileDialog();

            saveDlg.Filter = "位图|*.bmp|JPEG|*.jpg|PNG|*.png|GIF|*.gif";

            if (saveDlg.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            string fileName = saveDlg.FileName;

            string extFileName = fileName.Substring(fileName.LastIndexOf(".") + 1);//这句话什么意思

            extFileName = extFileName.ToUpper();

            Bitmap bitmap = activeDocument.ExportToBitmap();


            switch (extFileName)
            {
            case "BMP":
                bitmap.Save(fileName, ImageFormat.Bmp);
                break;

            case "JPG":
                bitmap.Save(fileName, ImageFormat.Jpeg);
                break;

            case "PNG":
                bitmap.Save(fileName, ImageFormat.Png);
                break;

            case "GIF":
                bitmap.Save(fileName, ImageFormat.Gif);
                break;
            }
        }
예제 #5
0
        private void menuFile_Open_Click(object sender, EventArgs e)
        {
            FormDocument activeDocument = this.ActiveMdiChild as FormDocument;

            if (activeDocument == null)
            {
                activeDocument          = new FormDocument();
                activeDocument.FormMain = this;
                activeDocument.Show(this.dockMain, DockState.Document);
            }

            OpenFileDialog openDlg = new OpenFileDialog();

            openDlg.Filter = "Net.10|*.net.10|XML文件|*.xml|所有文件|*.*";

            if (openDlg.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            string fileName = openDlg.FileName;

            activeDocument.OpenDocument(fileName);
        }
예제 #6
0
        private void menuFile_Save_Click(object sender, EventArgs e)
        {
            //As转换,如果转换失败,对象为空
            FormDocument activeDocument = this.ActiveMdiChild as FormDocument;

            if (activeDocument == null)
            {
                return;
            }


            SaveFileDialog saveDlg = new SaveFileDialog();

            saveDlg.Filter = "Net.10|*.net.10|XML文件|*.xml";

            if (saveDlg.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            string fileName = saveDlg.FileName;

            activeDocument.SaveDocument(fileName);
        }