Beispiel #1
0
        /// <summary>
        /// Open the print form and if successful execute print events.
        /// </summary>
        private void printGridButton_Click(object sender, EventArgs e)
        {
            PrintForm prompt = new PrintForm();

            prompt.ShowDialog();

            if (prompt.DialogResult == DialogResult.OK)
            {
                string selectedTable = prompt.SelectedTable;
                tableName = selectedTable;

                PrintDialog printDialog = new PrintDialog();
                printDialog.Document    = gridDocument;
                printDialog.UseEXDialog = true;

                if (DialogResult.OK == printDialog.ShowDialog())
                {
                    gridDocument.DefaultPageSettings.Margins = new Margins(50, 50, 110, 50);
                    gridDocument.Print();
                }
            }
        }