Forum » Programiranje » c# e.HasMorePages
c# e.HasMorePages
japol ::
Mam kodo:
private void doc36_PrintPage(object sender, PrintPageEventArgs e)
{
float linesPerPage36 = 0;
float yposition36 = 0;
int count36 = 0;
float leftmargin36 = e.MarginBounds.Left;
float topmargin36 = e.MarginBounds.Top;
string line36 = null;
Font printFont36 = this.richTextBox2.Font;
SolidBrush printbrush36 = new SolidBrush(Color.Black);
linesPerPage36 = e.MarginBounds.Height / printFont36.GetHeight(e.Graphics);
StringReader reader36 = new StringReader(richTextBox2.Text);
while (count36 < linesPerPage36 && ((line36 = reader36.ReadLine()) != null))
{
yposition36 = topmargin36 + (count36 * printFont36.GetHeight(e.Graphics));
e.Graphics.DrawString(line36, printFont36, printbrush36, leftmargin36, yposition36, new StringFormat());
count36++;
}
if (line36 != null)
{
e.HasMorePages = true;
}
else
{
e.HasMorePages = false;
}
printbrush36.Dispose();
}
Ta koda dela dokler imam le eno stran za stiskat, v kolkr mam v richtextboxu materiala za npr. 2, 3,... strani, vse stiska na en list. Na listu nardi "zmazek". Kaj ne štima, k jst pr vseh teh primerih na netu ne najdem odogovora.
private void doc36_PrintPage(object sender, PrintPageEventArgs e)
{
float linesPerPage36 = 0;
float yposition36 = 0;
int count36 = 0;
float leftmargin36 = e.MarginBounds.Left;
float topmargin36 = e.MarginBounds.Top;
string line36 = null;
Font printFont36 = this.richTextBox2.Font;
SolidBrush printbrush36 = new SolidBrush(Color.Black);
linesPerPage36 = e.MarginBounds.Height / printFont36.GetHeight(e.Graphics);
StringReader reader36 = new StringReader(richTextBox2.Text);
while (count36 < linesPerPage36 && ((line36 = reader36.ReadLine()) != null))
{
yposition36 = topmargin36 + (count36 * printFont36.GetHeight(e.Graphics));
e.Graphics.DrawString(line36, printFont36, printbrush36, leftmargin36, yposition36, new StringFormat());
count36++;
}
if (line36 != null)
{
e.HasMorePages = true;
}
else
{
e.HasMorePages = false;
}
printbrush36.Dispose();
}
Ta koda dela dokler imam le eno stran za stiskat, v kolkr mam v richtextboxu materiala za npr. 2, 3,... strani, vse stiska na en list. Na listu nardi "zmazek". Kaj ne štima, k jst pr vseh teh primerih na netu ne najdem odogovora.
Vredno ogleda ...
Tema | Ogledi | Zadnje sporočilo | |
---|---|---|---|
Tema | Ogledi | Zadnje sporočilo | |
» | [c#] ukaz radirkaOddelek: Programiranje | 1120 (913) | japol |
» | [c#] picturebox, slika na slikoOddelek: Programiranje | 1089 (899) | japol |
» | c# tiho tiskanje slik.Oddelek: Programiranje | 1947 (1618) | OmegaM |
» | [C#]Analogna uraOddelek: Programiranje | 2750 (2387) | cekr |
» | [c#] enostavna Igrca -> poraba procesorja 95%Oddelek: Programiranje | 2167 (1531) | elKaktus |