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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T09:31:38+00:00 2026-05-25T09:31:38+00:00

I want my webBrowser to look transparent. My code looks like that: Bitmap backGroungImage

  • 0

I want my webBrowser to look transparent. My code looks like that:

        Bitmap backGroungImage = new Bitmap(Width, Height);
        myWebBrowser1.Visible = false;
        DrawToBitmap(backGroungImage, new Rectangle(0, 0, backGroungImage.Width, backGroungImage.Height));
        myWebBrowser1.Visible = true;
        Bitmap backGroundImage2 = new Bitmap(myWebBrowser1.Width - 20, myWebBrowser1.Height - 20);
        Graphics.FromImage(backGroundImage2).DrawImage(backGroungImage, new Rectangle(0, 0, backGroundImage2.Width, backGroundImage2.Height), new Rectangle(SystemInformation.FrameBorderSize.Width + myWebBrowser1.Location.X + 10, SystemInformation.CaptionHeight + SystemInformation.FrameBorderSize.Height + 10 + myWebBrowser1.Location.Y, myWebBrowser1.Width - 20, myWebBrowser1.Height - 20), GraphicsUnit.Pixel);

        ImageAttributes imageAttributes = new ImageAttributes();
        ColorMatrix colorMatrix = new ColorMatrix(new float[][]
            { 
                new float[] {1,  0,  0,  0, 0},     
                new float[] {0,  1,  0,  0, 0},     
                new float[] {0,  0,  1,  0, 0},     
                new float[] {0,  0,  0, 1f - 230f/255f, 0},        
                new float[] {0, 0, 0, 0, 1}
            });
        imageAttributes.SetColorMatrix(colorMatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap);
        Bitmap backGroundImage3 = new Bitmap(backGroundImage2.Width, backGroundImage2.Height);
        Graphics.FromImage(backGroundImage3).DrawImage(backGroundImage2, new Rectangle(0, 0, backGroundImage3.Width, backGroundImage3.Height), 0, 0, backGroundImage2.Width, backGroundImage2.Height, GraphicsUnit.Pixel, imageAttributes);

        backGroundImage3.Save("d:\\BG.png", ImageFormat.Png);

and then I use “d:\BG.png” in html code.

It works fine on my windows 7, but on windows XP it’s darker, doesn’t fit other white elements drawn in GDI+ with alpha = 230 (I mean round frame around the WebBrowser control).

Before, when I didn’t use ColorMatrix, I did that:

int alpha = 230;
Color c1, color = Color.FromArgb(255, 255, 255);
for (int x = 0; x < d.Width; x++)
            for (int y = 0; y < d.Height; y++)
            {
                c1 = d.GetPixel(x, y);
                d.SetPixel(x, y, Color.FromArgb(((255 - alpha) * c1.R + alpha * color.R) / 255, ((255 - alpha) * c1.G + alpha * color.G) / 255, ((255 - alpha) * c1.B + alpha * color.B) / 255));
            }

And looked great on both OSes, but was very slow.
I want it to look the same as white color with alpha 230 in GDI+ and to be fast.
BTW. is there a way to put in WebBrowser a background image and then make it transparent?

PS. it’s Visual Studio 2010 Professional and .NET Framework 4 installed from the same file on both computers.

  • 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-05-25T09:31:39+00:00Added an answer on May 25, 2026 at 9:31 am

    I updated my IE browser to version 8, and works perfect.

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

Sidebar

Related Questions

I want to know if I can create a WebBrowser through code in Vb.NET,
How can I get source code from WebBrowser component? I want to get source
I'm trying to load WebBrowser content and after that I want to add some
I have a HTML page that I want to display in a WebBrowser control,
I want to call a JavaScript function through C#, using a WinForm's WebBrowser control.
I want to create a new web-browser for android, but this browser is not
I just don't want my WebBrowser to execute javascript at all. I don't need
I want to use WebBrowser control to load some localfile html page. I am
I want to add javascript enable pane in my java webbrowser. I have heard
We have a very lengthy newsletter that has been designed and developed to look

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.