• Martes 16 de Abril de 2024, 11:45

Autor Tema:  IMPRESION  (Leído 752 veces)

infielofcielo

  • Nuevo Miembro
  • *
  • Mensajes: 8
    • Ver Perfil
IMPRESION
« en: Sábado 7 de Noviembre de 2009, 15:22 »
0
hola ah todos saben tengo aca un duda quiero ingresar el ancho y el alto de la impresion de la pagina mediante 2 TEXTBOX aca esta mi codgo solo quiero aumentar como hago para darle ancho y alto ah la impresion.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WindowsApplication1
{
    public partial class Form1 : Form
    {
        public OpenFileDialog ofdImagen = new OpenFileDialog();
        public Form1()
        {
            InitializeComponent();
        }
        private void button2_Click(object sender, EventArgs e)
        {
            ofdImagen.Filter = "Ficheros BMP|*.bmp" +
                "|Ficheros documento |*.doc" +
                "|Ficheros JPG|*.jpg" +
                "|Ficheros PNG |*.png" +
                "|Ficheros EXIF|*.exif" +
                "|Ficheros TIFF|*.tiff" +
                "|Abrir Todos los Archivos|*.*";
            pictureBox1.ImageLocation = (ofdImagen.ShowDialog() == DialogResult.OK) ? ofdImagen.FileName : null;
        }
        private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
            e.Graphics.DrawString("MI VISTA PREVIA", new Font(txttexto.Font.FontFamily, txttexto.SelectionFont.Size), Brushes.Black, 250, 50);
            e.Graphics.DrawString(txttexto.Text, new Font(txttexto.Font.FontFamily, txttexto.SelectionFont.Size), Brushes.Black, 0, 100);
            e.Graphics.DrawImage(pictureBox1.Image, 400, 100, 435, 435);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            printDocument1.PrinterSettings = printDialog1.PrinterSettings;
            printPreviewDialog1.Document = printDocument1;            
            printPreviewDialog1.ShowDialog();            
        }
    }
}