using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using System.Drawing.Imaging;using System.IO;using System.Drawing.Printing;using System.Runtime.InteropServices;namespace printSample{ public partial class Form2 : Form { public Form2() { InitializeComponent(); } void PrintImage(object o, PrintPageEventArgs e) { int x = SystemInformation.WorkingArea.X; int y = SystemInformation.WorkingArea.Y; int width = this.Width; int height = this.Height; Rectangle bounds = new Rectangle(x, y, width, height); Bitmap img = new Bitmap(width, height); this.DrawToBitmap(img, bounds); Point p = new Point(100, 100); e.Graphics.DrawImage(img, p); } private void button1_Click(object sender, EventArgs e) { //this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; PrintDocument pd = new PrintDocument(); pd.PrintPage += new PrintPageEventHandler(PrintImage); printPreviewDialog1.Document = pd; printPreviewDialog1.ShowDialog(); // this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Sizable; //pd.Print(); } private void button2_Click(object sender, EventArgs e) { MessageBox.Show(this.Width + " - " + SystemInformation.FrameBorderSize.Width); } }}