Copyriht © 2011 PcDr SysDba
  Baskı Ön İzleme
 

Baskı Ön İzleme

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Drawing.Design;
namespace PcDr
{
    public partial class RibbonForm2 : DevExpress.XtraBars.Ribbon.RibbonForm
    {
        public RibbonForm2()
        {
            InitializeComponent();
          }

        private void barButtonItem16_ItemClick(object sender, ItemClickEventArgs e)
        {
            {
                printPreviewDialog1.Document = printDocument1;
                printPreviewDialog1.ShowDialog();
            }
        }

        private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
            float x1, x2, x3, y, y2 = 0;
            Font etiket_fontu = new Font("Tahoma", 12, FontStyle.Bold);
            Font yazı_fontu = new Font("Tahoma", 12, FontStyle.Regular);
            Font başlık_fontu = new Font("Tahoma", 20, FontStyle.Bold);
            string metin;
            System.Drawing.Printing.PageSettings p;
            p = printDocument1.DefaultPageSettings;

            x1 = p.Margins.Left;
            metin = "Telefon numarası:";
            x2 = x1 + e.Graphics.MeasureString(metin, etiket_fontu).Width;
            x3 = x2 + 200;
            y = p.Margins.Top;

            metin = "...... MÜDÜRLÜĞÜ FAALİYET RAPORU";
            e.Graphics.DrawString(metin, başlık_fontu, Brushes.Black, x1, y);
            y += e.Graphics.MeasureString(metin, başlık_fontu).Height;

            e.Graphics.DrawLine(new Pen(Color.Blue, 2),
             x1, y, p.PaperSize.Width - p.Margins.Left, y);
            y += 2;

            metin = "SIRA NO:";
            e.Graphics.DrawString(metin, etiket_fontu, Brushes.Black, x1, y);
            metin = textEdit1.Text;
            e.Graphics.DrawString(metin, yazı_fontu, Brushes.Black, x2, y);

            metin = "....GENEL MÜDÜRLÜĞÜ:";
            e.Graphics.DrawString(metin, etiket_fontu, Brushes.Black, x3, y);
            y += e.Graphics.MeasureString(metin, etiket_fontu).Height;

            metin = "İSTASYON BİLGİLERİ:";
            e.Graphics.DrawString(metin, etiket_fontu, Brushes.Black, x1, y);
            metin = imageComboBoxEdit1.Text;
            e.Graphics.DrawString(metin, yazı_fontu, Brushes.Black, x2, y);
            try
            {
                e.Graphics.DrawImage(pictureBox1.Image, x3, y, 100, 100);
                y2 = y + 150;
            }
            catch
            {
                metin = "Resim yazdırılamadı";
                e.Graphics.DrawString(metin, yazı_fontu, Brushes.Blue, x3, y);
            }
            y += e.Graphics.MeasureString(metin, etiket_fontu).Height;

            metin = "İSTASYON ADI:";
            e.Graphics.DrawString(metin, etiket_fontu, Brushes.Black, x1, y);
            metin = ımageComboBoxEdit2.Text;
            e.Graphics.DrawString(metin, yazı_fontu, Brushes.Black,
             new RectangleF(x2, y, x3 - x2, p.PaperSize.Height));
            y += e.Graphics.MeasureString(metin, etiket_fontu).Height;
            if (y2 > y)
                e.Graphics.DrawLine(new Pen(Color.Blue, 2),
                 x1, y2, p.PaperSize.Width - p.Margins.Left, y2);
            else
                e.Graphics.DrawLine(new Pen(Color.Blue, 2),
                 x1, y, p.PaperSize.Width - p.Margins.Left, y);
        }
    }
}

 
 
  Bugün 8 ziyaretçi (9 klik) kişi burdaydı!  
 
Bu web sitesi ücretsiz olarak Bedava-Sitem.com ile oluşturulmuştur. Siz de kendi web sitenizi kurmak ister misiniz?
Ücretsiz kaydol