Click here to Skip to main content
15,919,500 members
Home / Discussions / C#
   

C#

 
AnswerRe: Opening our windows application by double clicking a file... Pin
Giorgi Dalakishvili25-Mar-09 20:30
mentorGiorgi Dalakishvili25-Mar-09 20:30 
GeneralRe: Opening our windows application by double clicking a file... Pin
jaypatel51225-Mar-09 20:32
jaypatel51225-Mar-09 20:32 
GeneralRe: Opening our windows application by double clicking a file... Pin
V.25-Mar-09 20:50
professionalV.25-Mar-09 20:50 
AnswerRe: Opening our windows application by double clicking a file... Pin
Xmen Real 25-Mar-09 20:32
professional Xmen Real 25-Mar-09 20:32 
GeneralRe: Opening our windows application by double clicking a file... Pin
jaypatel51225-Mar-09 20:37
jaypatel51225-Mar-09 20:37 
JokeRe: Opening our windows application by double clicking a file... Pin
dan!sh 25-Mar-09 20:55
professional dan!sh 25-Mar-09 20:55 
GeneralRe: Opening our windows application by double clicking a file... Pin
jaypatel51225-Mar-09 20:57
jaypatel51225-Mar-09 20:57 
QuestionControl background color/image Pin
Sandeep Kalra25-Mar-09 19:30
Sandeep Kalra25-Mar-09 19:30 
Hi All

Look at the code

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace DealingWithImages
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}


private void Form1_Load(object sender, EventArgs e)
{
this.label1 = new System.Windows.Forms.Label();
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(53, 52);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(211, 13);
this.label1.TabIndex = 2;
this.label1.Text = "This is windows forms do you like it?";
this.Controls.Add(label1);

Image myimage = Image.FromFile(@"Give path of the image");


this.BackgroundImage = myimage;
this.MaximumSize = new System.Drawing.Size(400, 400);
this.MinimumSize = new System.Drawing.Size(400, 400);




}
protected override void OnMove(EventArgs e)
{
base.OnMove(e);
this.Refresh();
this.Invalidate();
}

protected override void OnPaintBackground(PaintEventArgs e)
{
if (this.BackgroundImage != null)
{

e.Graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;
e.Graphics.DrawImage(this.BackgroundImage, 0, 0, this.ClientRectangle.Width, this.ClientRectangle.Height);
}
else
{
base.OnPaintBackground(e);
}
}

}
}


I have to put image on the background of my windows form which I am doing using the code above.
I have some controls which I am generating at runtime.

Now the challenge is the background color of the control(here label1) looks odd on the form.

Does anybody know How to solve it?


Thanks


Regards
THE SK
AnswerRe: Control background color/image Pin
Xmen Real 25-Mar-09 19:44
professional Xmen Real 25-Mar-09 19:44 
GeneralRe: Control background color/image Pin
Sandeep Kalra25-Mar-09 20:24
Sandeep Kalra25-Mar-09 20:24 
QuestionJavascript : Disable buttone Pin
Ramkithepower25-Mar-09 19:03
Ramkithepower25-Mar-09 19:03 
AnswerRe: Javascript : Disable buttone Pin
tech60325-Mar-09 19:24
tech60325-Mar-09 19:24 
AnswerRe: Javascript : Disable buttone Pin
Cracked-Down25-Mar-09 19:28
Cracked-Down25-Mar-09 19:28 
Questiondynamic table in data base Pin
Mangesh Tomar25-Mar-09 18:43
Mangesh Tomar25-Mar-09 18:43 
AnswerRe: dynamic table in data base Pin
tech60325-Mar-09 19:35
tech60325-Mar-09 19:35 
GeneralRe: dynamic table in data base Pin
dano2k325-Mar-09 22:28
dano2k325-Mar-09 22:28 
GeneralRe: dynamic table in data base Pin
Mangesh Tomar26-Mar-09 0:10
Mangesh Tomar26-Mar-09 0:10 
Question[Message Deleted] Pin
rpopple25-Mar-09 16:47
rpopple25-Mar-09 16:47 
AnswerRe: line number in a multiline edit window Pin
Xmen Real 25-Mar-09 19:46
professional Xmen Real 25-Mar-09 19:46 
AnswerRe: line number in a multiline edit window Pin
Henry Minute26-Mar-09 1:32
Henry Minute26-Mar-09 1:32 
Questionhow to browse a remote directory using ftp client Pin
T_Teef25-Mar-09 13:07
T_Teef25-Mar-09 13:07 
AnswerRe: how to browse a remote directory using ftp client Pin
ky_rerun25-Mar-09 16:56
ky_rerun25-Mar-09 16:56 
AnswerRe: how to browse a remote directory using ftp client Pin
logiclabz25-Mar-09 22:30
logiclabz25-Mar-09 22:30 
GeneralRe: how to browse a remote directory using ftp client Pin
T_Teef26-Mar-09 13:11
T_Teef26-Mar-09 13:11 
QuestionReflection ! Pin
Mohammad Dayyan25-Mar-09 11:29
Mohammad Dayyan25-Mar-09 11:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.