Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7956471
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T03:59:56+00:00 2026-06-04T03:59:56+00:00

I have a situation here. I need to create an employee card structure in

  • 0

I have a situation here. I need to create an employee card structure in windows form using C# in Visual Studio 2010. The structure may contains labels and picture boxes with white background. I had no problem creating it but I am also giving a button named “Print” on this form so that user can print that card. I googled it but nothing concrete stuff found.
Please help me out.

namespace Employee_Card_Manager
{
public partial class Card : Form
{
    public Card(String a, String b, String c, String d, String e, String f, String g, String h, String i)
    {
        InitializeComponent();
        this.label2.Text = a;
        this.label9.Text = b;
        this.label10.Text = c;
        this.label11.Text = d;
        this.label12.Text = e;
        this.label13.Text = f;
        this.label14.Text = g;
        this.label16.Text = h;
        this.pictureBox1.Image = Image.FromFile(i);
        Image myimg = Code128Rendering.MakeBarcodeImage(h, 2, true);
        this.pictureBox2.Image = myimg;
    }
    private void button1_Click(object sender, EventArgs e)
    {
          //Print Card Code
    }
  }
}

The card template is as below:

Employee Card Structure

I have placed all card structure on a Panel Control and set Panel background to white. Can you fill the code which will print this card?
Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T03:59:57+00:00Added an answer on June 4, 2026 at 3:59 am

    I have found following code which is working perfectly!!

        //declare event handler for printing in constructor
            printdoc1.PrintPage += new PrintPageEventHandler(printdoc1_PrintPage);
    
        //Rest of the code
        Bitmap MemoryImage;
        public void GetPrintArea(Panel pnl)
        {
            MemoryImage = new Bitmap(pnl.Width, pnl.Height);
            pnl.DrawToBitmap(MemoryImage, new Rectangle(0, 0, pnl.Width, pnl.Height));
        }
        protected override void OnPaint(PaintEventArgs e)
        {
            if (MemoryImage != null)
            {
                e.Graphics.DrawImage(MemoryImage, 0, 0);
                base.OnPaint(e);
            }
        }
        void printdoc1_PrintPage(object sender, PrintPageEventArgs e)
        {
            Rectangle pagearea = e.PageBounds;
            e.Graphics.DrawImage(MemoryImage, (pagearea.Width / 2) - (this.panel1.Width / 2), this.panel1.Location.Y);
        }
        public void Print(Panel pnl)
        {
            pannel = pnl;
            GetPrintArea(pnl);
            previewdlg.Document = printdoc1;
            previewdlg.ShowDialog();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            Print(this.panel1);
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's the situation: we have an Oracle database we need to connect to to
I have a simple situation here. lets face html code first => <form name=geoKey
I have a unique situation over here. I have a button on a form
Here is situation I have been trying to solve Lets take a Employee table
I have a situation where i need to create a left panel. My manager
I have a situation, where I need to create a new JavaScript object that
I have a very dramatic situation here. I need the android sdk and I'm
i have a situation where i need to create some json from some id's
I have a situation where I need to create a (arguably dirty) soak test
I have a situation here with post fix and prefix operator.Take a look at

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.