Exemplo n.º 1
0
        private void printDoc_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
            e.HasMorePages = false;
//			e.Graphics.DrawString("江苏金茂",new Font("宋体",10F),Brushes.Black,192F,100F);

            try
            {
                string path = System.IO.Path.GetDirectoryName(Application.ExecutablePath) + @"\SetPoint.xml";
                System.Xml.XmlDocument xmldoc = new System.Xml.XmlDocument();
                xmldoc.Load(path);


                if (this.ActiveMdiChild == null)
                {
                    return;
                }
                frmDocument doc = this.ActiveMdiChild as frmDocument;
                if (doc == null)
                {
                    return;
                }
                this.forPrint(doc, ref e, ref xmldoc);
            }
            catch (Exception err)
            {
                MessageBox.Show("打印格式未被找到或已经损坏!");
                return;
            }
        }
Exemplo n.º 2
0
        private void UnloadPopup(object sender, System.EventArgs e)
        {
            ButtonItem item = sender as ButtonItem;

            if (item.Name == "bTextColor")
            {
                DevComponents.DotNetBar.PopupContainerControl container = item.PopupContainerControl as PopupContainerControl;
                ColorPicker clr = container.Controls[0] as ColorPicker;
                if (clr.SelectedColor != Color.Empty)
                {
                    frmDocument activedocument = this.ActiveMdiChild as frmDocument;
                    if (activedocument != null)
                    {
                        activedocument.ExecuteCommand(item.Name, clr.SelectedColor);
                    }
                }
            }
            else if (item.Name == "bTabColor")
            {
                DevComponents.DotNetBar.PopupContainerControl container = item.PopupContainerControl as PopupContainerControl;
                ColorPicker clr = container.Controls[0] as ColorPicker;
                if (clr.SelectedColor != Color.Empty)
                {
                    tabStrip1.ColorScheme.TabBackground  = ControlPaint.LightLight(clr.SelectedColor);
                    tabStrip1.ColorScheme.TabBackground2 = clr.SelectedColor;
                    tabStrip1.Refresh();
                }
                // Close popup menu, since it is not closed when Popup Container is closed...
                item.Parent.Expanded = false;
            }
        }
Exemplo n.º 3
0
        private void SaveDocumentAs()
        {
            if (this.ActiveMdiChild == null)
            {
                return;
            }
            frmDocument doc = this.ActiveMdiChild as frmDocument;

            if (doc == null || !doc.DocumentChanged)
            {
                return;
            }
            if (doc.FileName == "")
            {
                SaveDocument(doc);
                return;
            }

            saveFileDialog1.ShowDialog();
            if (saveFileDialog1.FileName == "")
            {
                return;
            }
            doc.FileName = saveFileDialog1.FileName;
            doc.SaveFile();
        }
Exemplo n.º 4
0
        public void SearchActiveDocument(string text)
        {
            frmDocument activedocument = this.ActiveMdiChild as frmDocument;

            if (activedocument != null)
            {
                activedocument.ExecuteCommand("bFind", text);
            }
        }
Exemplo n.º 5
0
        private void CreateNewDocument()
        {
            frmDocument doc = new frmDocument();

            doc.MdiParent   = this;
            doc.WindowState = FormWindowState.Maximized;
            doc.Show();
            doc.Update();
            doc.Text = "空白发票 " + this.MdiChildren.Length.ToString();
        }
Exemplo n.º 6
0
        /// <summary>
        /// Save active document
        /// </summary>
        private void SaveDocument()
        {
            if (this.ActiveMdiChild == null)
            {
                return;
            }
            frmDocument doc = this.ActiveMdiChild as frmDocument;

            if (doc == null)
            {
                return;
            }
            doc.Save();
        }
Exemplo n.º 7
0
        /// <summary>
        /// Save active document
        /// </summary>
        private void SaveDocument()
        {
            if (this.ActiveMdiChild == null)
            {
                return;
            }
            frmDocument doc = this.ActiveMdiChild as frmDocument;

            if (doc == null || !doc.DocumentChanged)
            {
                return;
            }
            SaveDocument(doc);
        }
Exemplo n.º 8
0
        private void OpenDocument()
        {
            openFileDialog1.FileName = "";
            openFileDialog1.ShowDialog();
            if (openFileDialog1.FileName == "")
            {
                return;
            }
            frmDocument doc = new frmDocument();

            doc.Text      = openFileDialog1.FileName;
            doc.MdiParent = this;
            doc.Show();
            doc.OpenFile(openFileDialog1.FileName);
        }
Exemplo n.º 9
0
 internal void SaveDocument(frmDocument doc)
 {
     if (doc.FileName == "")
     {
         if (saveFileDialog1.ShowDialog() != DialogResult.OK)
         {
             return;
         }
         if (saveFileDialog1.FileName == "")
         {
             return;
         }
         doc.FileName = saveFileDialog1.FileName;
     }
     if (doc.FileName != "")
     {
         doc.SaveFile();
     }
 }
Exemplo n.º 10
0
 public void SearchActiveDocument(string text)
 {
     try
     {
         string path = System.IO.Path.GetDirectoryName(Application.ExecutablePath) + @"\BillData\" + text + @".xml";
         System.Xml.XmlDocument xmldoc = new System.Xml.XmlDocument();
         xmldoc.Load(path);
         frmDocument doc = new frmDocument();
         doc.MdiParent   = this;
         doc.WindowState = FormWindowState.Maximized;
         doc.Show();
         doc.Update();
         doc.Text = text;
         forOpen(doc, ref xmldoc);
     }
     catch
     {
         MessageBox.Show("未能打开发票信息,可能该发票不存在或数据已经被损坏!");
     }
 }
Exemplo n.º 11
0
        private void BarItemClick(object sender, EventArgs e)
        {
            BaseItem    objItem        = sender as BaseItem;
            frmDocument activedocument = this.ActiveMdiChild as frmDocument;

            switch (objItem.Name)
            {
            // File menu
            case "bNew":
                CreateNewDocument();
                break;

            case "bTaskNewDocument":
                CreateNewDocument();
                break;

            case "bOpen":
                OpenDocument(objItem);
                break;

            case "bTaskOpenDocument":
                OpenDocument(objItem);
                break;

            case "bSave":
                SaveDocument();
                break;

            case "bClose":
            {
                if (activedocument != null)
                {
                    activedocument.Close();
                }
                break;
            }

            case "bPageSetup":
                MessageBox.Show("Not implemented yet.");
                break;

            case "bPrintPreview":
                PrintPreview();
                break;

            case "bPrint":
                Printer();
                break;

            case "bExit":
                this.Close();
                break;

            case "bTaskHelp":
                MessageBox.Show("Starts the help file.");
                break;

            default:
            {
                // Pass them to the active document
                if (activedocument != null)
                {
                    activedocument.ExecuteCommand(objItem.Name, null);
                }
                break;
            }
            }
        }
Exemplo n.º 12
0
        private void BarItemClick(object sender, EventArgs e)
        {
            BaseItem    objItem        = sender as BaseItem;
            frmDocument activedocument = this.ActiveMdiChild as frmDocument;

            switch (objItem.Name)
            {
            // File menu
            case "bNew":
                CreateNewDocument();
                break;

            case "bTaskNewDocument":
                CreateNewDocument();
                break;

            case "bOpen":
                OpenDocument();
                break;

            case "bTaskOpenDocument":
                OpenDocument();
                break;

            case "bSave":
                SaveDocument();
                break;

            case "bSaveAs":
                SaveDocumentAs();
                break;

            case "bClose":
            {
                if (activedocument != null)
                {
                    activedocument.Close();
                }
                break;
            }

            case "bPageSetup":
                MessageBox.Show("Not implemented yet.");
                break;

            case "bPrintPreview":
                MessageBox.Show("Not implemented yet.");
                break;

            case "bPrint":
                MessageBox.Show("Not implemented yet.");
                break;

            case "bExit":
                this.Close();
                break;

            // Window menu
            case "bArrangeAll":
                this.LayoutMdi(MdiLayout.Cascade);
                break;

            case "bNewWindow":
                goto case "bNew";

            case "window_list":
                ((Form)objItem.Tag).Activate();
                break;

            // Style switching
            case "bSwitchStyle":
                dotNetBarManager1.Style = (objItem.Style == eDotNetBarStyle.Office2000)?eDotNetBarStyle.OfficeXP:eDotNetBarStyle.Office2000;
                break;

            case "bTaskNewFromExisting":
                MessageBox.Show("Not implemented.");
                break;

            case "bTaskHelp":
                MessageBox.Show("Starts the help file.");
                break;

            case "bTaskSampleDoc":
                MessageBox.Show("This is only a sample item that when clicked should open most recently used document.");
                break;

            case "bThemes":
                EnableThemes((ButtonItem)objItem);
                break;

            case "bTabbedMdi":
            {
                ButtonItem button = objItem as ButtonItem;
                SwitchWorkingMode(!button.Checked);
                button.Checked = !button.Checked;
                break;
            }

            case "bStyle2000":
                ChangeDotNetBarStyle(eDotNetBarStyle.Office2000);
                break;

            case "bStyle2003":
                ChangeDotNetBarStyle(eDotNetBarStyle.Office2003);
                break;

            case "bStyleXP":
                ChangeDotNetBarStyle(eDotNetBarStyle.OfficeXP);
                break;

            case "bFind":
            {
                if (m_Search == null || m_Search.IsDisposed)
                {
                    m_Search       = new BalloonSearch();
                    m_Search.Owner = this;
                    m_Search.Show(objItem, true);
                }
                break;
            }

            default:
            {
                // Pass them to the active document
                if (activedocument != null)
                {
                    activedocument.ExecuteCommand(objItem.Name, null);
                }
                break;
            }
            }
        }