您好,我换了种办法,您可以试试
- PrintDocument pd = new PrintDocument();
- pd = c1FlexGrid1.PrintParameters.PrintDocument;
- pd.DefaultPageSettings.Landscape = true;
- c1FlexGrid1.PrintParameters.HeaderFont = new Font("Arial Black", 14, FontStyle.Bold);
- c1FlexGrid1.PrintParameters.FooterFont = new Font("Arial Narrow", 8, FontStyle.Italic);
- c1FlexGrid1.PrintParameters.Footer.Remove(0);
- string docName = "sampleGrid";
- string header = "FlexGrid打印示例";
- string footer = "";// string.Format("{0:yyyy/MM/dd}", DateTime.Now) + (char)(9) + (char)(9) + "Page {0} of {1}";
- PrintGridFlags flgs = PrintGridFlags.ActualSize;
- for (int i = 0; i <= optionList.Count - 1; i++)
- {
- if (i == 0)
- {
- flgs = (PrintGridFlags)optionList[i];
- }
- else
- {
- flgs = flgs | (PrintGridFlags)optionList[i];
- }
- }
- // 印刷
- c1FlexGrid1.PrintGrid(docName, flgs, header, footer);
复制代码 |