C# Printing උදව්වක්

hans078

Active member
  • Feb 17, 2008
    496
    179
    43
    Colombo
    මචන්ංලා මට මෙන්න මේ pic එකේ Text fields වල තියන data ටික ප්‍රින්ට් කර ගන්න ඕනෙ. පිංතූරෙත් එක්කම. මේකට ඩෙටා එන්නෙ ඩේට බේස් එකකින්. Picture එකේ path එක තමා database එකේ තියෙන්නෙත්. ආයෙමත් database එක access නොකර මේ තියන data ටික print කර ගන්න විදිහක් කියනවද? මේක C# windows form application එකක්. ලොකු උදව්වක් guys.. Bump එකක්වත් දාල යන්න....

    Capture.jpg
     

    nuni

    Member
    Feb 5, 2009
    277
    24
    0
    Colombo
    Last edited:
    • Like
    Reactions: hans078

    NO_MeRcY

    Well-known member
  • Jun 14, 2010
    5,423
    449
    83
    Singapore
    Code:
    protected void btnPrint_Click(object sender, EventArgs e)
    {
    	PrintDocument pd = new PrintDocument();
    	pd.PrintPage += new PrintPageEventHandler(PrintImage);
    	pd.Print();      
    }
    
    void PrintImage(object o, PrintPageEventArgs e)
    {
    	int x = SystemInformation.WorkingArea.X;
    	int y = SystemInformation.WorkingArea.Y;
    	int width = this.Width;
    	int height = this.Height; 
    
    	Rectangle bounds = new Rectangle(x, y, width, height); 
    
    	Bitmap img = new Bitmap(width, height); 
    
    	this.DrawToBitmap(img, bounds);
    	Point p = new Point(100, 100);
    	e.Graphics.DrawImage(img, p);    
     }

    :P :P :P

    http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/eb80fbbe-6b89-4c3d-9ede-88a2b105c714/
     
    • Like
    Reactions: hans078