• Anasayfa
  • Yazılım
    • Android
    • Asp.net
    • Css
    • C#
    • Devexpress
    • Mysql
    • MSSQL
    • Hosting
    • Wcf
    • WordPress
  • Hayattan
  • Referanslarım
  • İletişim

SanalData

SanalData

Monthly Archives: Aralık 2016

C# Windows Formunu Yazdırma

02 Cuma Ara 2016

Posted by Burak in C#

≈ Leave a comment

Tags

c# windows form print

Merhaba arkadaşlar;

Kullandığınız bir windows formunu yazdırmak isterseniz aşağıdaki kodlar işinizi rahatlıkla görücektir.Öncelikle kütüphanemizi yükleyelim

C#
1
using System.Drawing.Printing;

Kullanacagınız kodlar aşağıdaki gibidir;

C#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
   private void button1_Click(object sender, EventArgs e)
        {
 
            PrintDocument doc = new PrintDocument();
            doc.PrintPage += this.Doc_PrintPage;
            PrintDialog dlgSettings = new PrintDialog();
            dlgSettings.Document = doc;
            if (dlgSettings.ShowDialog() == DialogResult.OK)
            {
                doc.Print();
            }
        }
 
 
        private void Doc_PrintPage(object sender, PrintPageEventArgs e)
        {
            float x = e.MarginBounds.Left;
            float y = e.MarginBounds.Top;
            Bitmap bmp = new Bitmap(this.groupBox1.Width, this.groupBox1.Height);
            this.groupBox1.DrawToBitmap(bmp, new Rectangle(0, 0, this.groupBox1.Width, this.groupBox1.Height));
            e.Graphics.DrawImage((Image)bmp, x, y);
        }

Son Yazılar

  • Korumalı: C# da çoklu iskonto uygulama fonksiyonu
  • Korumalı: C# Windows Form ile ftp upload yapmak
  • Korumalı: Textbox’da sayısal değer kontrolü
  • Korumalı: C# datagridview da çoklu satır silme
  • Korumalı: WordPress’de tüm yayınlanmış yazıları taslak yapma

Son Yorumlar

  • Korumalı: Android Studio Unable to locate adb hatası çözümü için Burak
  • Korumalı: Android Studio Unable to locate adb hatası çözümü için hasan
  • Php ile döviz kurlarını çekmek için delicoder
  • Asp.net ile tarayıcı önbellekleme (webconfig) için Burak
  • Asp.net ile tarayıcı önbellekleme (webconfig) için MEHMET SEMİZ

Arşivler

  • Nisan 2018
  • Mart 2018
  • Ocak 2018
  • Aralık 2017
  • Kasım 2017
  • Ekim 2017
  • Eylül 2017
  • Ağustos 2017
  • Temmuz 2017
  • Haziran 2017
  • Mayıs 2017
  • Nisan 2017
  • Mart 2017
  • Şubat 2017
  • Ocak 2017
  • Aralık 2016
  • Kasım 2016
  • Ekim 2016
  • Eylül 2016
  • Ağustos 2016
  • Temmuz 2016
  • Haziran 2016
  • Mayıs 2016

Kategoriler

  • Android
  • Asp.net
  • C#
  • Devexpress
  • Hayattan
  • Hosting
  • MSSQL
  • Mysql
  • Php
  • Wordpress
  • Yazılım

Dinliyorum