Example #1
0
 private bool isAll = false; //是否全部打印
 /// <summary>
 /// 打印函数
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void pdDocument_PrintPage(object sender, PrintPageEventArgs e)
 {
     try
     {
         e.Graphics.ScaleTransform(1f, 0.97f);
         Graphics g = e.Graphics;
         pt.TemperturePaintInternal(e.Graphics, null, cm.Pages[0], false);
     }
     catch (Exception ex)
     {
         MessageBox.Show("错误原因:" + ex.Message);
         // this.Close();
     }
 }
        private void picTemperatureShow_Paint(object sender, PaintEventArgs e)
        {
            // 每0.1毫米多少个像素(丝米)
            double cxLogPixPerDMM = e.Graphics.DpiX / 254.0;
            double cyLogPixPerDMM = e.Graphics.DpiY / 254.0;

            //A4纸大小(2100*2970丝米)
            picTemperatureShow.Width  = cm.MaxWidth;
            picTemperatureShow.Height = cm.MaxHeight + 100;
            cm.CurrentTree            = trvTemperture; //获取当前树控件
            printTp.TemperturePaintInternal(e.Graphics, trvTemperture.SelectedNode, cm.Pages[0], true);

            //实现类似tooltip样式效果
            if (null != _strTip && "" != _strTip)
            {
                Font ftTip;                 //数据提示信息字体
                ftTip = new Font("宋体", 12); //创建数据提示信息字体
                e.Graphics.DrawString(_strTip, ftTip, Brushes.Black, _ptTip);
                ftTip.Dispose();
            }
        }