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 9229869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T05:40:47+00:00 2026-06-18T05:40:47+00:00

In my C# program I have a Picturebox in which i want to show

  • 0

In my C# program I have a Picturebox in which i want to show a stream of video (consecutive frames). I receive raw data, that I then transform into Bitmap or Image. I can show one image at a time without a problem (to reproduce the video stream).

Now my issue is that I want to merge 2 or more bitmaps (like layers) with the same size and alpha values (ARGB) and show it on the picturebox.

I have read lots of websites and posts here on SO, but many use the Graphics class, and I just can’t draw it on my application (very likely because i’m new to C#! and already have my program setup, so I didn’t want to change the structure).

What i need (to know):

  1. How to overlay two or more Bitmaps with alpha values;
  2. NO pixel manipulation please, can’t afford that cost in performance.

Thank you so much in advance!

NOTE: I think this question shouldn’t be marked (or closed) as duplicate, because everything i found in SO is done either with pixel manipulation or through the Graphics class. (but I might be wrong!)

EDIT: Possible workaround (NOT the solution to the question)
In
A PictureBox Problem, the 4th answer (from user comecme) tells me to have 2 picturebox, one on top of the other. The only (extra) thing I had to do to make it work with this approach was:

private void Form1_Load(object sender, EventArgs e)
{
    pictureBox2.Parent = pictureBox1;
}

Where pictureBox2 will be the one on top.

I won’t consider this an answer to this problem, because I consider it a workaround (specially because having more than 10 pictureboxes doesn’t seem ideal! lol). That’s why I will leave this question opened waiting for a real answer to my question.

EDIT: Resolved! check my answer.

  • 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-18T05:40:48+00:00Added an answer on June 18, 2026 at 5:40 am

    Here is the real answer to my problem.
    1) Use a List<Bitmap> to store all the images you want to blend;
    2) Create a new Bitmap to hold the final image;
    3) Draw each image on top of the final image’s graphics using the using statement.

    The code:

    List<Bitmap> images = new List<Bitmap>();  
    Bitmap finalImage = new Bitmap(640, 480);
    
    ...
    
    //For each layer, I transform the data into a Bitmap (doesn't matter what kind of
    //data, in this question) and add it to the images list
    for (int i = 0; i < nLayers; ++i)
    {
        Bitmap bitmap = new Bitmap(layerBitmapData[i]));
        images.Add(bitmap);
    }
    
    using (Graphics g = Graphics.FromImage(finalImage))
    {
        //set background color
        g.Clear(Color.Black);
    
        //go through each image and draw it on the final image (Notice the offset; since I want to overlay the images i won't have any offset between the images in the finalImage)
        int offset = 0;
        foreach (Bitmap image in images)
        {
            g.DrawImage(image, new Rectangle(offset, 0, image.Width, image.Height));
        }   
    }
    //Draw the final image in the pictureBox
    this.layersBox.Image = finalImage;
    //In my case I clear the List because i run this in a cycle and the number of layers is not fixed 
    images.Clear();
    

    Credits go to Brandon Cannaday in this tech.pro webpage.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have program that runs fast enough. I want to see the number of
with my RCP program I have the problem that I want to have more
I have a program that adds a series of blips to a graph: PictureBox
Background: My program is live video winform application. I have three PictureBox on my
I'm planning on creating a program that will have a login form and then
I have made a program that allows users to draw lines onto a picturebox
I have a jpeg shown in a picturebox on my WinForm program, I want
I have developed a c++ program which uses OpenCV. Now i want to develop
I have a program that gets the incoming number, date and time. I want
I am working on a program that i want to have a information image

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.