0 امتیاز

سلام دوستان من از فرمم پرینت میگیرم متهی دکمه فرمم پرینت گرفته میشه چیکار کنم گرفته نشه؟

 

  [System.Runtime.InteropServices.DllImport("gdi32.dll")]
        public static extern long BitBlt(IntPtr hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, IntPtr hdcSrc, int nXSrc, int nYSrc, int dwRop);
        private Bitmap memoryImage;
        private void CaptureScreen()
        {
            Graphics mygraphics = this.CreateGraphics();
            Size s = this.Size;
            memoryImage = new Bitmap(s.Width, s.Height, mygraphics);
            Graphics memoryGraphics = Graphics.FromImage(memoryImage);
            IntPtr dc1 = mygraphics.GetHdc();
            IntPtr dc2 = memoryGraphics.GetHdc();
            BitBlt(dc2, 0, 0, this.ClientRectangle.Width, this.ClientRectangle.Height, dc1, 0, 0, 13369376);
            mygraphics.ReleaseHdc(dc1);
            memoryGraphics.ReleaseHdc(dc2);
        }

        private void button2_Click(object sender, EventArgs e)
        {
       
            CaptureScreen();
           // printDocument1.Print();
            //button2.Visible = false;
            pageSetupDialog1.Document = printDocument1;
            pageSetupDialog1.ShowDialog();
            printPreviewDialog1.Document = printDocument1;
            DialogResult re = printDialog1.ShowDialog();
            if (re == DialogResult.OK)
            {
               
                printDocument1.Print();
            }
            else
            {
                MessageBox.Show(" print cancel");
               // button2.Visible = true;
            }
            
        }

 

1 پاسخ

0 امتیاز
عكسشو بزار
دایی علی میتونی کدی بهم بدی که مستقیم وارد بانک بشه؟
توسط (222 امتیاز) 4 28 49
توسط (222 امتیاز) 4 28 49
سوال جدید

2,337 سوال

2,871 پاسخ

3,725 دیدگاه

3,921 کاربر

دسته بندی ها

...