Esempio n. 1
0
        /// <summary>
        /// 直接打印报表。
        /// </summary>
        /// <param name="Control"></param>
        /// <param name="dataSource"></param>
        public static void Print(this System.Windows.Forms.Control Control, object dataSource, bool showDialog = false)
        {
            EAS.Explorer.Entities.Report R = GetReport(Control);
            if (!R.Exists)
            {
                return;
            }

            EAS.Report.Controls.PrintViewDialog ViewDialog = new EAS.Report.Controls.PrintViewDialog();
            ViewDialog.Report     = R;
            ViewDialog.DataObject = dataSource;
            ViewDialog.Print(showDialog);
        }
Esempio n. 2
0
        /// <summary>
        /// 显示打印预览窗口。
        /// </summary>
        /// <param name="Control"></param>
        /// <param name="dataSource"></param>
        public static void PrintPreview(this System.Windows.Forms.Control Control, object dataSource)
        {
            EAS.Explorer.Entities.Report R = GetReport(Control);
            if (!R.Exists)
            {
                return;
            }

            EAS.Report.Controls.PrintViewDialog ViewDialog = new EAS.Report.Controls.PrintViewDialog();
            ViewDialog.Report        = R;
            ViewDialog.DataObject    = dataSource;
            ViewDialog.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            ViewDialog.WindowState   = System.Windows.Forms.FormWindowState.Maximized;
            ViewDialog.ShowDialog();
        }
Esempio n. 3
0
        static EAS.Explorer.Entities.Report GetReport(System.Windows.Forms.Control Control)
        {
            EAS.Explorer.Entities.Report R = new EAS.Explorer.Entities.Report();
            string Name = string.Empty;

            m_PrintNames.TryGetValue(Control, out Name);
            if (string.IsNullOrEmpty(Name))
            {
                return(R);
            }

            if (!m_Reports.TryGetValue(Name, out R))
            {
                R      = new EAS.Explorer.Entities.Report();
                R.Name = Name;
                R.Read();
                m_Reports.Add(Name, R);
            }
            return(R);
        }