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

  • Home
  • SEARCH
  • 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 160855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T11:06:33+00:00 2026-05-11T11:06:33+00:00

Im trying to generate a small square 32 by 32 pixels with a 10

  • 0

Im trying to generate a small square 32 by 32 pixels with a 10 by 10 squareish transparent gap in the middle.

This is what I have so far:

private Image CreatePicture(){     // Create a new Bitmap object, 32 x 32 pixels in size     Bitmap canvas = new Bitmap(32,32,System.Drawing.Imaging.PixelFormat.Format16bppRgb555);     for(int i=10;i<21;i++){         for(int p=10;p<21;p++){             canvas.SetPixel(i,p,Color.Lime);         }     }     canvas.MakeTransparent(Color.Lime);     // return the picture     return canvas; } 

Its a it rough and not going to be the final ‘optimized version’ its just a rough demo script. The problem is the returned image does not transparency instead its just a grey box :(.

Any help appreciated.

Michael

UPDATE: I have updated the script with the PixelFormat set to an Alpha RGB format which it actually accepts without erroring on runtime. Now though if I remove the ‘canvas.MakeTransparent(Color.Lime);’ line it shows a lime box in the middle with it it just shows a grey box the same colour as the grey background; so it seems as if transparency is being recognised just not implimenting the transparency!

private Bitmap CreatePicture(){     // Create a new Bitmap object, 50 x 50 pixels in size     Bitmap canvas = new Bitmap(82,82,System.Drawing.Imaging.PixelFormat.Format32bppArgb);      for(int i=10;i<71;i++){         for(int p=10;p<71;p++){             canvas.SetPixel(i,p,Color.Lime);         }     }     canvas.MakeTransparent(Color.Lime);     // return the picture     return canvas; } 
  • 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. 2026-05-11T11:06:34+00:00Added an answer on May 11, 2026 at 11:06 am

    It depends on how your going to use or display the image. PNG and Gif are the two file formats that support transparency.

    For the bitmap setting of transparency, i used:

    Graphics.FromImage(bitmap).FillRectangle(Brushes.Transparent, …) to set the area I wanted as transparent, then I saved the file out as a PNG to get an image with transparency.

    I also tried the MakeTransparent method and ran into problems and the Brushes.Transparent was the solution that worked for my situation.

    Hope this gives you a direction to look into.

    One last note, I create the Bitmap object with width and height only, I don’t specify the pixel format or whatever that’s called i.e. bitmap = New Bitmap(width, height);

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

Sidebar

Ask A Question

Stats

  • Questions 92k
  • Answers 92k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Use a FileSystemWatcher. That will throw a "Changed" (Or even… May 11, 2026 at 6:30 pm
  • Editorial Team
    Editorial Team added an answer You want to remove an item from a list and… May 11, 2026 at 6:30 pm
  • Editorial Team
    Editorial Team added an answer You should be able to use varchar(max) (SQL 2005 and… May 11, 2026 at 6:30 pm

Related Questions

I'm trying to consume some .NET web services using JAX-WS. I have generated the
I'm implementing a small application in C, which I would like to sell as
I've got a db like this: Accounts -------- id BankName AcctNumber Balance AccountGroups -------------
Is it possible to detect if a page is opened in 2 different browsers?

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.