Click here to Skip to main content
16,008,299 members
Home / Discussions / C#
   

C#

 
Answer[Wrong Forum] Pin
Keith Barrow31-Mar-10 5:20
professionalKeith Barrow31-Mar-10 5:20 
QuestionTabcontrol flicker Pin
Wannes Geysen31-Mar-10 4:24
Wannes Geysen31-Mar-10 4:24 
AnswerRe: Tabcontrol flicker Pin
Luc Pattyn31-Mar-10 4:39
sitebuilderLuc Pattyn31-Mar-10 4:39 
GeneralRe: Tabcontrol flicker Pin
Wannes Geysen31-Mar-10 4:57
Wannes Geysen31-Mar-10 4:57 
GeneralRe: Tabcontrol flicker Pin
Luc Pattyn31-Mar-10 5:54
sitebuilderLuc Pattyn31-Mar-10 5:54 
AnswerRe: Tabcontrol flicker Pin
Som Shekhar31-Mar-10 5:12
Som Shekhar31-Mar-10 5:12 
GeneralRe: Tabcontrol flicker Pin
Wannes Geysen31-Mar-10 5:18
Wannes Geysen31-Mar-10 5:18 
QuestionPrintDocument clipping / wrapping text problem Pin
Mark F.31-Mar-10 3:07
Mark F.31-Mar-10 3:07 
I have the following code which prints three RichTextBox controls to a page. The format is Avery 5388 which is the perforated index card stock paper (8.5x11). The print preview shows the text in each box but the lines don't wrap.

Any way to fix the wrapping problem?
private void fcPrintDocument_PrintPage( object sender, PrintPageEventArgs e )
{
    cardDataTabPage.Focus();
    DrawPage( e.Graphics );
}

private void DrawPage( Graphics graphics )
{
    Graphics g = graphics;
    Pen boxPen = new Pen( Brushes.Black );

    int pageWidth = fcPrintDocument.DefaultPageSettings.PaperSize.Width;
    int pageHeight = fcPrintDocument.DefaultPageSettings.PaperSize.Height;

    RectangleF srcRect = cardDataTabPage.ClientRectangle;
    RectangleF destRect = new Rectangle( 0, 0, pageWidth, pageHeight );

    float scaleX = destRect.Width / 850;
    float scaleY = destRect.Height / 1100;

    for ( int i = 0; i < cardDataTabPage.Controls.Count; i++ )
    {
        if ( cardDataTabPage.Controls[i].GetType() == richTextBox1.GetType() )
        {
            RichTextBox rich = (RichTextBox)cardDataTabPage.Controls[i];
            g.DrawRectangle( boxPen, rich.Bounds );  // draws 3x5 box where card should be
            g.DrawString( rich.Text, rich.Font, Brushes.Black,
                rich.Bounds.Left * scaleX, rich.Bounds.Top * scaleY, new StringFormat() );
        }
    }
}

Thanks.

AnswerRe: PrintDocument clipping / wrapping text problem Pin
Luc Pattyn31-Mar-10 4:46
sitebuilderLuc Pattyn31-Mar-10 4:46 
General[Solved] Re: PrintDocument clipping / wrapping text problem Pin
Mark F.31-Mar-10 5:20
Mark F.31-Mar-10 5:20 
GeneralRe: [Solved] Re: PrintDocument clipping / wrapping text problem Pin
Luc Pattyn31-Mar-10 6:01
sitebuilderLuc Pattyn31-Mar-10 6:01 
QuestionPassing TextWriter through a function Pin
Steve-Co31-Mar-10 2:36
Steve-Co31-Mar-10 2:36 
AnswerRe: Passing TextWriter through a function Pin
Keith Barrow31-Mar-10 2:43
professionalKeith Barrow31-Mar-10 2:43 
GeneralRe: Passing TextWriter through a function Pin
Steve-Co31-Mar-10 2:47
Steve-Co31-Mar-10 2:47 
GeneralRe: Passing TextWriter through a function Pin
Keith Barrow31-Mar-10 2:58
professionalKeith Barrow31-Mar-10 2:58 
GeneralRe: Passing TextWriter through a function Pin
Mirko198031-Mar-10 3:00
Mirko198031-Mar-10 3:00 
AnswerRe: Passing TextWriter through a function Pin
R. Giskard Reventlov31-Mar-10 2:45
R. Giskard Reventlov31-Mar-10 2:45 
GeneralRe: Passing TextWriter through a function Pin
Luc Pattyn31-Mar-10 2:54
sitebuilderLuc Pattyn31-Mar-10 2:54 
GeneralRe: Passing TextWriter through a function Pin
R. Giskard Reventlov31-Mar-10 2:59
R. Giskard Reventlov31-Mar-10 2:59 
AnswerRe: Passing TextWriter through a function Pin
Steve-Co31-Mar-10 2:56
Steve-Co31-Mar-10 2:56 
QuestionSafe thread calls Pin
faheemnadeem31-Mar-10 1:41
faheemnadeem31-Mar-10 1:41 
AnswerRe: Safe thread calls Pin
Luc Pattyn31-Mar-10 1:52
sitebuilderLuc Pattyn31-Mar-10 1:52 
GeneralRe: Safe thread calls Pin
faheemnadeem31-Mar-10 2:04
faheemnadeem31-Mar-10 2:04 
GeneralRe: Safe thread calls Pin
Luc Pattyn31-Mar-10 2:26
sitebuilderLuc Pattyn31-Mar-10 2:26 
GeneralRe: Safe thread calls Pin
faheemnadeem31-Mar-10 2:39
faheemnadeem31-Mar-10 2:39 

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.