Click here to Skip to main content
15,895,740 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am attempting to Write simple game without DirectX in c# .net. How to make BackStyle to transparent? How to make Transparent GIF Image to have the backGround of the form elements?
Posted
Comments
Kenneth Haugland 1-Sep-12 13:25pm    
In wpf I think I would use a canvas and a background ImageBrush, in WinForms I donno...

1 solution

 
Share this answer
 
Comments
[no name] 1-Sep-12 15:19pm    
its contain the solve
but indirectly.
please explain a little bit to help him to change the colors.
he can use MSPaint to pick the color.
BTW +5
Sarrrva 2-Sep-12 8:53am    
creating transparent logo:

private void Form1_Load(object sender, EventArgs e)
{
pictureBox1.Image = CreateLogo("Sarva Pvt Ltd");
}

private Bitmap CreateLogo(string subdomain)
{
Bitmap objBmpImage = new Bitmap(1, 1);
int intWidth = 0;
int intHeight = 0;
Font objFont = new Font("Arial", 13, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Pixel);
Graphics objGraphics = Graphics.FromImage(objBmpImage);
intWidth = (int)objGraphics.MeasureString(subdomain, objFont).Width+100;
intHeight = (int)objGraphics.MeasureString(subdomain, objFont).Height+100;
objBmpImage = new Bitmap(objBmpImage, new Size(intWidth, intHeight));
objGraphics = Graphics.FromImage(objBmpImage);
objGraphics.Clear(Color.Transparent);
objGraphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
objGraphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
objGraphics.DrawString(subdomain, objFont, new SolidBrush(Color.FromArgb(255, 255, 255)), 0, 0);
// Image x=Image.FromFile(Application.StartupPath+"\\images.jpg");
//objGraphics.DrawImage(x,new Point(0,0));
objGraphics.Flush();
return (objBmpImage);

}

regards

sarva
D-Kishore 3-Sep-12 1:20am    
good 5:)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900