OTTOMAN 42
Öğrenci
- Katılım
- 30 Ocak 2014
- Mesajlar
- 10
- Reaksiyon puanı
- 0
- Puanları
- 0
C# ile yazıcıdan çıktı almak isitiyorum çıktıyı listvievden alıcam fakat bunu gerçekleştiremedim bu konuda bana yardımcı olacak arkadaşlara şimdiden tşkr ediyorum..
Kot bloğum ;
private void sayfayapisi_Click(object sender, EventArgs e)
{
pageSetupDialog1.PageSettings = printDocument1.DefaultPageSettings;
if (pageSetupDialog1.ShowDialog() == DialogResult.OK)
{
printDocument1.DefaultPageSettings = pageSetupDialog1.PageSettings;
}
}
private void baskionizleme_Click(object sender, EventArgs e)
{
printPreviewDialog1.Document = printDocument1;
printPreviewDialog1.ShowDialog();
}
private void yazdir_Click(object sender, EventArgs e)
{
printDocument1.Print();
}
int i;
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
int x = 135, y = 135, say = listView1.Items.Count;
System.Drawing.Printing.PageSettings p = printDocument1.DefaultPageSettings;
e.Graphics.DrawLine(new Pen(Color.Black, 2), p.Margins.Left, 125, p.PaperSize.Width = p.Margins.Right, 125);
e.Graphics.DrawString("Gelir Açıklama",this.label1.Font,Brushes.Black,300,130);
e.Graphics.DrawString("Gider Açıklama",this.label1.Font,Brushes.Black,300,130);
e.Graphics.DrawString("Gelir TL", this.label1.Font, Brushes.Black, 300, 130);
e.Graphics.DrawString("Gider TL", this.label1.Font, Brushes.Black, 300, 130);
e.Graphics.DrawString("EURO gelir", this.label1.Font, Brushes.Black, 300, 130);
e.Graphics.DrawString("EURO GİDER", this.label1.Font, Brushes.Black, 300, 130);
e.Graphics.DrawString("DOLAR GELİR", this.label1.Font, Brushes.Black, 300, 130);
e.Graphics.DrawString("DOLAR GİDER", this.label1.Font, Brushes.Black, 300, 130);
e.Graphics.DrawString("TARİH", this.label1.Font, Brushes.Black, 300, 130);
e.Graphics.DrawString("KASA", this.label1.Font, Brushes.Black, 300, 130);
e.Graphics.DrawLine(new Pen(Color.Black, 2), p.Margins.Left, 153, p.PaperSize.Width = p.Margins.Right, 153);
while (i < say)
{
x+=25;
string geliraciklama = listView1.Items.ToString();
string gideracikalama = listView1.Items.ToString();
string gelirtl = listView1.Items.ToString();
string gidertl = listView1.Items.ToString();
string eurogelir= listView1.Items.ToString();
string eurogider = listView1.Items.ToString();
string dolargelir = listView1.Items.ToString();
string dolargider = listView1.Items.ToString();
string tarih = listView1.Items.ToString();
string kasa = listView1.Items.ToString();
e.Graphics.DrawString("Gelir Açıklama", this.label1.Font, Brushes.Black, 150, x);
e.Graphics.DrawString("Gider Açıklama", this.label1.Font, Brushes.Black, 250, x);
e.Graphics.DrawString("Gelir TL", this.label1.Font, Brushes.Black, 350, x);
e.Graphics.DrawString("Gider TL", this.label1.Font, Brushes.Black, 450, x);
e.Graphics.DrawString("EURO gelir", this.label1.Font, Brushes.Black, 550, x);
e.Graphics.DrawString("EURO GİDER", this.label1.Font, Brushes.Black, 650, x);
e.Graphics.DrawString("DOLAR GELİR", this.label1.Font, Brushes.Black, 750, x);
e.Graphics.DrawString("DOLAR GİDER", this.label1.Font, Brushes.Black, 850, x);
e.Graphics.DrawString("TARİH", this.label1.Font, Brushes.Black, 950, x);
e.Graphics.DrawString("KASA", this.label1.Font, Brushes.Black, 1050, x);
e.Graphics.DrawLine(new Pen(Color.Black, 2), p.Margins.Left, x+20, p.PaperSize.Width = p.Margins.Right, x+20);
i++;
if((x+y+20)>(p.PaperSize.Height+80-p.Margins.Bottom+80))
{
e.HasMorePages = true;
}
}
if (i >= say)
{
e.HasMorePages = false;
i = 0;
}
Kot bloğum ;
private void sayfayapisi_Click(object sender, EventArgs e)
{
pageSetupDialog1.PageSettings = printDocument1.DefaultPageSettings;
if (pageSetupDialog1.ShowDialog() == DialogResult.OK)
{
printDocument1.DefaultPageSettings = pageSetupDialog1.PageSettings;
}
}
private void baskionizleme_Click(object sender, EventArgs e)
{
printPreviewDialog1.Document = printDocument1;
printPreviewDialog1.ShowDialog();
}
private void yazdir_Click(object sender, EventArgs e)
{
printDocument1.Print();
}
int i;
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
int x = 135, y = 135, say = listView1.Items.Count;
System.Drawing.Printing.PageSettings p = printDocument1.DefaultPageSettings;
e.Graphics.DrawLine(new Pen(Color.Black, 2), p.Margins.Left, 125, p.PaperSize.Width = p.Margins.Right, 125);
e.Graphics.DrawString("Gelir Açıklama",this.label1.Font,Brushes.Black,300,130);
e.Graphics.DrawString("Gider Açıklama",this.label1.Font,Brushes.Black,300,130);
e.Graphics.DrawString("Gelir TL", this.label1.Font, Brushes.Black, 300, 130);
e.Graphics.DrawString("Gider TL", this.label1.Font, Brushes.Black, 300, 130);
e.Graphics.DrawString("EURO gelir", this.label1.Font, Brushes.Black, 300, 130);
e.Graphics.DrawString("EURO GİDER", this.label1.Font, Brushes.Black, 300, 130);
e.Graphics.DrawString("DOLAR GELİR", this.label1.Font, Brushes.Black, 300, 130);
e.Graphics.DrawString("DOLAR GİDER", this.label1.Font, Brushes.Black, 300, 130);
e.Graphics.DrawString("TARİH", this.label1.Font, Brushes.Black, 300, 130);
e.Graphics.DrawString("KASA", this.label1.Font, Brushes.Black, 300, 130);
e.Graphics.DrawLine(new Pen(Color.Black, 2), p.Margins.Left, 153, p.PaperSize.Width = p.Margins.Right, 153);
while (i < say)
{
x+=25;
string geliraciklama = listView1.Items.ToString();
string gideracikalama = listView1.Items.ToString();
string gelirtl = listView1.Items.ToString();
string gidertl = listView1.Items.ToString();
string eurogelir= listView1.Items.ToString();
string eurogider = listView1.Items.ToString();
string dolargelir = listView1.Items.ToString();
string dolargider = listView1.Items.ToString();
string tarih = listView1.Items.ToString();
string kasa = listView1.Items.ToString();
e.Graphics.DrawString("Gelir Açıklama", this.label1.Font, Brushes.Black, 150, x);
e.Graphics.DrawString("Gider Açıklama", this.label1.Font, Brushes.Black, 250, x);
e.Graphics.DrawString("Gelir TL", this.label1.Font, Brushes.Black, 350, x);
e.Graphics.DrawString("Gider TL", this.label1.Font, Brushes.Black, 450, x);
e.Graphics.DrawString("EURO gelir", this.label1.Font, Brushes.Black, 550, x);
e.Graphics.DrawString("EURO GİDER", this.label1.Font, Brushes.Black, 650, x);
e.Graphics.DrawString("DOLAR GELİR", this.label1.Font, Brushes.Black, 750, x);
e.Graphics.DrawString("DOLAR GİDER", this.label1.Font, Brushes.Black, 850, x);
e.Graphics.DrawString("TARİH", this.label1.Font, Brushes.Black, 950, x);
e.Graphics.DrawString("KASA", this.label1.Font, Brushes.Black, 1050, x);
e.Graphics.DrawLine(new Pen(Color.Black, 2), p.Margins.Left, x+20, p.PaperSize.Width = p.Margins.Right, x+20);
i++;
if((x+y+20)>(p.PaperSize.Height+80-p.Margins.Bottom+80))
{
e.HasMorePages = true;
}
}
if (i >= say)
{
e.HasMorePages = false;
i = 0;
}