winform 列印控制項

來源:互聯網
上載者:User

標籤:event   graph   image   show   字串   images   preview   dia   wstring   

(1)PageSetupDialog1    列印設定視窗 

(2)PrintDocument     向印表機輸送的對象

事件:PrintPage   對於列印的每一頁都執行一次

(3)PrintPreviewControl     預覽列印,在本視窗中預覽,不包含任何對話方塊和按鈕

 

(4)PrintPreviewDialog     預覽列印,彈出一個預覽視窗

(5)PrintDialog     列印   彈出列印視窗可選擇印表機和任何列印項設定

 

//對於列印的每一頁都執行一次        private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)        {            Font f = new Font("微軟雅黑",15);//字型            Brush br = new SolidBrush(Color.Black);//畫刷            //繪製字串,字型,畫刷,左邊距,上邊距            e.Graphics.DrawString(richTextBox1.Text,f,br,10,20);        }        //列印設定        private void button1_Click(object sender, EventArgs e)        {            pageSetupDialog1.Document = printDocument1;//擷取版面設定的printDocument(向印表機輸送的對象)            pageSetupDialog1.ShowDialog();        }        //預覽列印        private void button2_Click(object sender, EventArgs e)        {            printPreviewControl1.Document = printDocument1;//頁面中預覽            printPreviewDialog1.Document = printDocument1;//彈出預覽框            printPreviewDialog1.ShowDialog();        }        //列印        private void button3_Click(object sender, EventArgs e)        {            printDialog1.Document = printDocument1;//列印對象            printDialog1.ShowDialog();        }

 

winform 列印控制項

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.