Click here to Skip to main content
15,903,203 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Multiple Data Fields in List Box Pin
Anonymous23-Sep-04 9:29
Anonymous23-Sep-04 9:29 
GeneralRe: Multiple Data Fields in List Box Pin
lildragon@hotmail.com23-Sep-04 9:29
susslildragon@hotmail.com23-Sep-04 9:29 
GeneralEvent handler that can apply to all controls Pin
lildragon21-Sep-04 4:37
lildragon21-Sep-04 4:37 
GeneralRe: Event handler that can apply to all controls Pin
Chris Quick21-Sep-04 11:19
Chris Quick21-Sep-04 11:19 
GeneralRe: Event handler that can apply to all controls Pin
Anonymous23-Sep-04 9:32
Anonymous23-Sep-04 9:32 
GeneralEvent in VBA Pin
macmac3821-Sep-04 1:47
macmac3821-Sep-04 1:47 
GeneralCustom PaperSize for printing a receipt Pin
Member 132035221-Sep-04 0:01
Member 132035221-Sep-04 0:01 
GeneralRe: Custom PaperSize for printing a receipt Pin
sreejith ss nair21-Sep-04 1:23
sreejith ss nair21-Sep-04 1:23 
hi,

The reson is because of few factors.
1) Font Size of your content.
2) No of lines per page etc.

What you can do is, if you want to print without any breaking then please see the below mwntioned code. This will deside howmany lines need to print based on Font Size

private void menuItem6_Click(object sender, System.EventArgs e)
{
try
{
PrintDia=new PrintDialog();
PrintDia.Document=printDocument1;
string content=this.Editor.Text;
StrReader=new StringReader(content);
if(PrintDia.ShowDialog()==DialogResult.OK)
{
this.printDocument1.Print();
}
}
catch(Exception Ex)
{
MessageBox.Show(Ex.Message.ToString());
}
}

private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
try
{
float Lines_Per_Page = 0;
float Y_Position = 0;
int Count = 0;
float Left_Margin = e.MarginBounds.Left;
float Top_Margin = e.MarginBounds.Top;

string Line = null;
Font fnt = Editor.Font;
SolidBrush Solid = new SolidBrush(Color.Black);

Lines_Per_Page=e.MarginBounds.Height/Font.GetHeight(e.Graphics);

while(Count < Lines_Per_Page && ((Line=StrReader.ReadLine())!=null ))

{

// calculate the next line position based on
// the height of the font according to the printing device
Y_Position =Top_Margin + (Count * fnt.GetHeight(e.Graphics));

// draw the next line in the rich edit control

e.Graphics.DrawString(Line ,fnt ,Solid ,Left_Margin ,Y_Position ,new StringFormat());

Count++;
}

if(Line !=null)
e.HasMorePages=true;
else
e.HasMorePages=false;
}
catch(Exception Ex)
{
MessageBox.Show(Ex.Message.ToString());
}


}

private void menuItem4_Click(object sender, System.EventArgs e)
{
try
{
string Content=Editor.Text;
StrReader = new StringReader(Content);
PrintPreviewDialog Print_Preview=new PrintPreviewDialog();
Print_Preview.Document=printDocument1;
Print_Preview.ShowDialog();
}
catch(Exception Ex)
{
MessageBox.Show(Ex.Message.ToString());
}
}
}
}


**************************
S r e e j i t h N a i r
**************************
GeneralRe: Custom PaperSize for printing a receipt Pin
Member 132035221-Sep-04 1:47
Member 132035221-Sep-04 1:47 
GeneralRe: Custom PaperSize for printing a receipt Pin
sreejith ss nair21-Sep-04 1:59
sreejith ss nair21-Sep-04 1:59 
GeneralRe: Custom PaperSize for printing a receipt Pin
21-Sep-04 5:13
suss21-Sep-04 5:13 
GeneralRe: Custom PaperSize for printing a receipt Pin
Duncan Edwards Jones22-Sep-04 4:02
professionalDuncan Edwards Jones22-Sep-04 4:02 
GeneralRe: Custom PaperSize for printing a receipt Pin
Member 132035222-Sep-04 21:47
Member 132035222-Sep-04 21:47 
GeneralOUTLOOK Integration Pin
Sumit Domyan20-Sep-04 21:07
Sumit Domyan20-Sep-04 21:07 
Generalpassing variables thru refrence Pin
Member 120813920-Sep-04 20:05
Member 120813920-Sep-04 20:05 
GeneralRe: passing variables thru refrence Pin
Dave Kreskowiak21-Sep-04 0:29
mveDave Kreskowiak21-Sep-04 0:29 
GeneralRe: passing variables thru refrence Pin
21-Sep-04 17:15
suss21-Sep-04 17:15 
GeneralRe: passing variables thru refrence Pin
Dave Kreskowiak22-Sep-04 7:33
mveDave Kreskowiak22-Sep-04 7:33 
GeneralRe: Create PDF / VB.NET Pin
Steven Campbell20-Sep-04 11:24
Steven Campbell20-Sep-04 11:24 
GeneralCreate PDF / VB.NET Pin
partt20-Sep-04 10:55
partt20-Sep-04 10:55 
Generalvb6 - changing printer settings Pin
steff kamush20-Sep-04 4:07
steff kamush20-Sep-04 4:07 
GeneralRe: vb6 - changing printer settings Pin
Duncan Edwards Jones20-Sep-04 4:16
professionalDuncan Edwards Jones20-Sep-04 4:16 
GeneralCrystal Reports and CSV files Pin
KreativeKai20-Sep-04 3:40
professionalKreativeKai20-Sep-04 3:40 
GeneralRe: Crystal Reports and CSV files Pin
KreativeKai24-Sep-04 5:36
professionalKreativeKai24-Sep-04 5:36 
GeneralRe: Crystal Reports and CSV files Pin
NarendraSinghJTV19-Jan-10 19:09
NarendraSinghJTV19-Jan-10 19:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.