I can not put a background image on my form .. in visual studio

0

This is the code for you to assign background in the designer:

internal static Bitmap email_bg
{
    get
    {
        return (Bitmap)RuntimeHelpers.GetObjectValue(AutoOffers.My.Resources.Resources.ResourceManager.GetObject("email_bg", AutoOffers.Resources.resourceCulture));
    }
}

Since otherwise I can only put color background xd.

I get the following error:

  

'Resources.resourceCulture' is not accessible due to its level of protection

I need to put something in the bitmap because otherwise the value is null then it does not show me the background ..

A catch just in case

    
asked by Perl 26.06.2016 в 16:13
source

2 answers

1

You can try using the BackgroundImage property of the form in the Properties window. Click the ellipsis button to open the Select Resource dialog box and add it to the bottom of your WinForm

I leave you a tutorial that details how to do it link

Greetings !!

    
answered by 27.06.2016 в 04:16
0

Hi, you can do something like:

private string ruta = Path.Combine(Application.StartupPath, @"ImagenesForm\Moda.png");
private void frmMDI_Load(object sender, EventArgs e)
    {
        BackgroundImageLayout = ImageLayout.Stretch;
        this.BackgroundImage = Image.FromFile(ruta);
        SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
    }

I hope you find it useful.

    
answered by 30.12.2016 в 15:56