Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 676
  • Last Modified:

system.windows.forms.imagelist.getbitmap(int) is inaccessible due to its protection level

Hi

My problem is : system.windows.forms.imagelist.getbitmap(int) is inaccessible due to its protection level.
the source code :

public class Desktop : System.Windows.Forms.UserControl
...
private System.Windows.Forms.ImageList IconImageList;
...
protected override void OnPaint( PaintEventArgs pe )
{...
Bitmap IconBitmap = IconImageList.GetBitmap(1);
...
}
I cannot mean, beacuse everyibody do it same ?
0
wwwbetyar
Asked:
wwwbetyar
1 Solution
 
aacoolCommented:
I am not sure why you want to access GetBitmap - if you need the image from within the imageList - here's how you do it

protected override void OnPaint(PaintEventArgs pe)
{
    ImageList.ImageCollection images = IconImageList.GetImages();
    foreach(Image img in Images)
    {
        // do your operation with the images - you can also access them using Images[k]
        // you can cast img to Bitmap if needed
        Bitmap iconBmp = (Bitmap)img;
        //do something
    }
}
0
 
wwwbetyarAuthor Commented:
IconImageList does not contain definition GetImages();
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now