Member Avatar for denonth

Hi all...

I am developing one program but i just came to one obsticle that I really dont know how to pass it.
on my form i will have some options that user needs to enter after that im puting it and drawing it in printpreview eventhandler. So user can see what is going to be printed as regular format.

Problem is starting when i want to send that argument to richtext box and display it to richtext box.
i tried stuff like:
sending an image...its not working...as far as i know...

here is code :

public void PrintPageEventHandler(Object obj, PrintPageEventArgs ev)
        {
            //positions
            Point pocetak= new Point(15,100);
            Point naslov=new Point(15,200);
            Point vrsta_broda_label = new Point(15, 300);
            Point vrsta_broda=new Point(140,300);
            Point godina_label = new Point(15, 330);
            Point godina = new Point(100, 330);
            Point zemlja_label = new Point(15, 360);
            Point zemlja = new Point(100, 360);
            Point baza_label = new Point(15, 390);
            Point baza1 = new Point(100, 390);
            Point duzina_label = new Point(500, 300);
            Point duzina=new Point(580,300);
            Point lezaj_label = new Point(500, 330);
            Point lezaj = new Point(580, 330);
            Point kabina_label = new Point(500, 360);
            Point kabina = new Point(580, 360);
            Point wc_label = new Point(500, 390);
            Point wc = new Point(590, 390);
    
            
            //crtanje
        ev.Graphics.FillRectangle(Brushes.Yellow, new Rectangle(15, 100, 300, 35));
        ev.Graphics.DrawString("Term: " + datum_1 + " - " + datum_2, this.mainTextFont, Brushes.Black, pocetak);

        ev.Graphics.DrawString(naziv_broda_1, this.naslovTextFont, Brushes.Red, naslov);
           ev.Graphics.DrawString("Vrsta broda: ", this.mainTextFont, Brushes.Black, vrsta_broda_label);
           ev.Graphics.DrawString(vrsta_broda_1, this.boldTextFont, Brushes.Black, vrsta_broda);
           ev.Graphics.DrawString("Godina: ", this.mainTextFont, Brushes.Black, godina_label);
           ev.Graphics.DrawString(godina_broda, this.boldTextFont, Brushes.Black, godina);
           ev.Graphics.DrawString("Zemlja: ", this.mainTextFont, Brushes.Black, zemlja_label);
           ev.Graphics.DrawString("HRVATSKA", this.boldTextFont, Brushes.Black, zemlja);
           ev.Graphics.DrawString("Baza: ", this.mainTextFont, Brushes.Black, baza_label);
           ev.Graphics.DrawString(baza_od_1+"-"+baza_do_1, this.boldTextFont, Brushes.Black, baza1);
           ev.Graphics.DrawString("Dužina: ", this.mainTextFont, Brushes.Black, duzina_label);
           ev.Graphics.DrawString(duzina_1+" m", this.boldTextFont, Brushes.Black, duzina);
           ev.Graphics.DrawString("Ležaj: ", this.mainTextFont, Brushes.Black, lezaj_label);
           ev.Graphics.DrawString(lezaj_1, this.boldTextFont, Brushes.Black, lezaj);
           ev.Graphics.DrawString("Kabine: ", this.mainTextFont, Brushes.Black, kabina_label);
           ev.Graphics.DrawString(kabina_1, this.boldTextFont, Brushes.Black, kabina);
           ev.Graphics.DrawString("Tuš/WC: ", this.mainTextFont, Brushes.Black, wc_label);
           ev.Graphics.DrawString(wc_1, this.boldTextFont, Brushes.Black, wc);

any idea or help will be great...
o and i forgot..this print preview should be in richtext box so i can enter some words on top of it...it is for sending e-mail..

thank you all...

public void printInRTB(String strText)
{
richTextBox2.Text+= strText + "..... \n";
}
public void refreshRTB()
{
richTextBox2.Text="";
}

Pass this function what you want to add in richTextBox2 from each event handler and when you want to reuse then call refreshRTB(). I think this will work

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.