示例#1
0
        private void btnPrintSET_Click(object sender, EventArgs e)
        {
            bool bMod = false;

            if (sUserID == "admin" || sUserID == "system" || sUserID == "demo")
            {
                bMod = true;
            }

            if (!Directory.Exists(sProPath + "\\UAP\\Runtime\\print"))
            {
                Directory.CreateDirectory(sProPath + "\\UAP\\Runtime\\print");
            }
            if (!Directory.Exists(sProPath + "\\UAP\\Runtime\\print\\Model"))
            {
                Directory.CreateDirectory(sProPath + "\\UAP\\Runtime\\print\\Model");
            }
            if (!Directory.Exists(sProPath + "\\UAP\\Runtime\\print\\User"))
            {
                Directory.CreateDirectory(sProPath + "\\UAP\\Runtime\\print\\User");
            }

            if (bMod)
            {
                if (File.Exists(sPrintLayOutMod))
                {
                    Rep.LoadLayout(sPrintLayOutMod);
                }
            }
            else
            {
                if (File.Exists(sPrintLayOutUser))
                {
                    Rep.LoadLayout(sPrintLayOutUser);
                }
                else if (File.Exists(sPrintLayOutMod))
                {
                    Rep.LoadLayout(sPrintLayOutMod);
                }
            }

            Rep.ShowDesignerDialog();

            DialogResult d = MessageBox.Show("是否保存?模板调整将在下次打开窗体时体现\n是:保存打印模板\n否:恢复默认打印模板\n", "提示", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Asterisk);

            if (DialogResult.Yes == d)
            {
                if (bMod)
                {
                    Rep.SaveLayoutToXml(sPrintLayOutMod);
                }
                else
                {
                    Rep.SaveLayoutToXml(sPrintLayOutUser);
                }
            }
            else if (DialogResult.No == d)
            {
                if (File.Exists(sPrintLayOutUser))
                {
                    File.Delete(sPrintLayOutUser);
                }
            }
        }