waseem1345 0 Light Poster

Hello, I used the CodeDom provider to convert a string into an exe (the string is partial):

        string partial = "using System;\nusing gButtonnamespace;\nusing System.Windows.Forms;\nusing System.Drawing;";
        partial+="\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Text;";
        partial+="\nusing System.Threading.Tasks;\nusing System.Reflection;\nnamespace prog{static class program{static void Main(){";
        partial += "Form thiss=new Form();\nApplication.EnableVisualStyles();";
        partial += "thiss.ShowDialog();";
        partial += "}}}";
        CSharpCodeProvider codeProvider = new CSharpCodeProvider();
        ICodeCompiler icc = codeProvider.CreateCompiler();
        System.CodeDom.Compiler.CompilerParameters parameters = new CompilerParameters();
        parameters.GenerateExecutable = true;
        parameters.CompilerOptions = "/target:winexe /platform:x86";
        parameters.OutputAssembly = "Program.exe";
        parameters.ReferencedAssemblies.Add("System.dll");
        parameters.ReferencedAssemblies.Add("System.Windows.Forms.dll");
        parameters.ReferencedAssemblies.Add("System.Drawing.dll");
        parameters.ReferencedAssemblies.Add("System.Threading.Tasks.dll");
        parameters.EmbeddedResources.Add("Panel.png");
        parameters.ReferencedAssemblies.Add("System.Data.dll");
        parameters.GenerateInMemory = false;
        CompilerResults results = codeProvider.CompileAssemblyFromSource(parameters, partial);

What code can I add to partial so I can use Panel.png as the background of the form "thiss"?

Thanks in advance :D

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.