Hi all,
I'm sort of very new to C# and haven't programmed in OO for a while.
I'm trying to override the backgroundimage to the tabcontrol but it just
doesn't seem to want to do it, can someone please help me and tell me what
I'm doing wrong?
namespace RHInvestmentApp lication
{
public class FormRHMain : System.Windows. Forms.Form
{
public class tabMainNewBackg round: System.Windows. Forms.TabContro l
{
public override Image BackgroundImage
{
set
{
System.Resource s.ResourceManag er resourcesII = new
System.Resource s.ResourceManag er(typeof(FormR HMain));
BackgroundImage =
((System.Drawin g.Image)(resour cesII.GetObject ("tabCustomer.B ackgroundImage" )
));
}
}
}
private System.Windows. Forms.PictureBo x ImgRHLogo;
private System.Windows. Forms.PictureBo x ImgISNLogo;
private System.Windows. Forms.TabPage tabCustomer;
private RHInvestmentApp lication.FormRH Main.tabMainNew Background tabMain;
private System.Windows. Forms.TabPage tabAppointment;
private System.Componen tModel.Containe r components = null;
public FormRHMain()
{
InitializeCompo nent();
}
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Disp ose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
private void InitializeCompo nent()
{
System.Resource s.ResourceManag er resources = new
System.Resource s.ResourceManag er(typeof(FormR HMain));
this.ImgRHLogo = new System.Windows. Forms.PictureBo x();
this.tabMain = new
RHInvestmentApp lication.FormRH Main.tabMainNew Background();
this.tabCustome r = new System.Windows. Forms.TabPage() ;
this.tabAppoint ment = new System.Windows. Forms.TabPage() ;
this.ImgISNLogo = new System.Windows. Forms.PictureBo x();
this.tabMain.Su spendLayout();
this.SuspendLay out();
//
// ImgRHLogo
//
this.ImgRHLogo. Image =
((System.Drawin g.Bitmap)(resou rces.GetObject( "ImgRHLogo.Imag e")));
this.ImgRHLogo. Location = new System.Drawing. Point(8, 16);
this.ImgRHLogo. Name = "ImgRHLogo" ;
this.ImgRHLogo. Size = new System.Drawing. Size(512, 72);
this.ImgRHLogo. TabIndex = 0;
this.ImgRHLogo. TabStop = false;
//
// tabMain
//
this.tabMain.An chor = (((System.Windo ws.Forms.Anchor Styles.Top |
System.Windows. Forms.AnchorSty les.Bottom)
| System.Windows. Forms.AnchorSty les.Left)
| System.Windows. Forms.AnchorSty les.Right);
this.tabMain.Co ntrols.AddRange (new System.Windows. Forms.Control[] {
this.tabCustome r,
this.tabAppoint ment});
this.tabMain.Fo nt = new System.Drawing. Font("Verdana", 9.75F,
System.Drawing. FontStyle.Regul ar, System.Drawing. GraphicsUnit.Po int,
((System.Byte)( 0)));
this.tabMain.It emSize = new System.Drawing. Size(82, 26);
this.tabMain.Lo cation = new System.Drawing. Point(15, 100);
this.tabMain.Na me = "tabMain";
this.tabMain.Pa dding = new System.Drawing. Point(5, 5);
this.tabMain.Ap pearance = System.Windows. Forms.TabAppear ance.Buttons;
this.tabMain.Ri ghtToLeft = System.Windows. Forms.RightToLe ft.Yes;
this.tabMain.Se lectedIndex = 0;
this.tabMain.Si ze = new System.Drawing. Size(760, 500);
this.tabMain.Ta bIndex = 1;
//
// tabCustomer
//
this.tabCustome r.BackgroundIma ge =
((System.Drawin g.Bitmap)(resou rces.GetObject( "tabCustomer.Ba ckgroundImage") )
);
this.tabCustome r.Location = new System.Drawing. Point(4, 30);
this.tabCustome r.Name = "tabCustome r";
this.tabCustome r.Size = new System.Drawing. Size(752, 466);
this.tabCustome r.TabIndex = 0;
this.tabCustome r.Text = "Customer";
//
// tabAppointment
//
this.tabAppoint ment.Background Image =
((System.Drawin g.Bitmap)(resou rces.GetObject( "tabAppointment .BackgroundImag e
")));
this.tabAppoint ment.Location = new System.Drawing. Point(4, 30);
this.tabAppoint ment.Name = "tabAppointment ";
this.tabAppoint ment.Size = new System.Drawing. Size(752, 466);
this.tabAppoint ment.TabIndex = 1;
this.tabAppoint ment.Text = "Appointmen t";
//
// ImgISNLogo
//
this.ImgISNLogo .Anchor = (System.Windows .Forms.AnchorSt yles.Bottom |
System.Windows. Forms.AnchorSty les.Right);
this.ImgISNLogo .Image =
((System.Drawin g.Bitmap)(resou rces.GetObject( "ImgISNLogo.Ima ge")));
this.ImgISNLogo .Location = new System.Drawing. Point(624, 616);
this.ImgISNLogo .Name = "ImgISNLogo ";
this.ImgISNLogo .Size = new System.Drawing. Size(150, 49);
this.ImgISNLogo .TabIndex = 2;
this.ImgISNLogo .TabStop = false;
//
// FormRHMain
//
this.AutoScaleB aseSize = new System.Drawing. Size(5, 13);
this.Background Image =
((System.Drawin g.Bitmap)(resou rces.GetObject( "$this.Backgrou ndImage")));
this.ClientSize = new System.Drawing. Size(792, 673);
this.Controls.A ddRange(new System.Windows. Forms.Control[] {
this.ImgISNLogo ,
this.tabMain,
this.ImgRHLogo} );
this.Name = "FormRHMain ";
this.Text = "FormRHMain ";
this.Load += new System.EventHan dler(this.FormR HMain_Load);
this.tabMain.Re sumeLayout(fals e);
this.ResumeLayo ut(false);
}
#endregion
[STAThread]
static void Main()
{
Application.Run (new FormRHMain());
}
private void FormRHMain_Load (object sender, System.EventArg s e)
{
}
private void tabPageAppointm ent_Click(objec t sender, System.EventArg s e)
{
}
private void ImgISNLogo_Clic k(object sender, System.EventArg s e)
{
}
}
}
I'm sort of very new to C# and haven't programmed in OO for a while.
I'm trying to override the backgroundimage to the tabcontrol but it just
doesn't seem to want to do it, can someone please help me and tell me what
I'm doing wrong?
namespace RHInvestmentApp lication
{
public class FormRHMain : System.Windows. Forms.Form
{
public class tabMainNewBackg round: System.Windows. Forms.TabContro l
{
public override Image BackgroundImage
{
set
{
System.Resource s.ResourceManag er resourcesII = new
System.Resource s.ResourceManag er(typeof(FormR HMain));
BackgroundImage =
((System.Drawin g.Image)(resour cesII.GetObject ("tabCustomer.B ackgroundImage" )
));
}
}
}
private System.Windows. Forms.PictureBo x ImgRHLogo;
private System.Windows. Forms.PictureBo x ImgISNLogo;
private System.Windows. Forms.TabPage tabCustomer;
private RHInvestmentApp lication.FormRH Main.tabMainNew Background tabMain;
private System.Windows. Forms.TabPage tabAppointment;
private System.Componen tModel.Containe r components = null;
public FormRHMain()
{
InitializeCompo nent();
}
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Disp ose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
private void InitializeCompo nent()
{
System.Resource s.ResourceManag er resources = new
System.Resource s.ResourceManag er(typeof(FormR HMain));
this.ImgRHLogo = new System.Windows. Forms.PictureBo x();
this.tabMain = new
RHInvestmentApp lication.FormRH Main.tabMainNew Background();
this.tabCustome r = new System.Windows. Forms.TabPage() ;
this.tabAppoint ment = new System.Windows. Forms.TabPage() ;
this.ImgISNLogo = new System.Windows. Forms.PictureBo x();
this.tabMain.Su spendLayout();
this.SuspendLay out();
//
// ImgRHLogo
//
this.ImgRHLogo. Image =
((System.Drawin g.Bitmap)(resou rces.GetObject( "ImgRHLogo.Imag e")));
this.ImgRHLogo. Location = new System.Drawing. Point(8, 16);
this.ImgRHLogo. Name = "ImgRHLogo" ;
this.ImgRHLogo. Size = new System.Drawing. Size(512, 72);
this.ImgRHLogo. TabIndex = 0;
this.ImgRHLogo. TabStop = false;
//
// tabMain
//
this.tabMain.An chor = (((System.Windo ws.Forms.Anchor Styles.Top |
System.Windows. Forms.AnchorSty les.Bottom)
| System.Windows. Forms.AnchorSty les.Left)
| System.Windows. Forms.AnchorSty les.Right);
this.tabMain.Co ntrols.AddRange (new System.Windows. Forms.Control[] {
this.tabCustome r,
this.tabAppoint ment});
this.tabMain.Fo nt = new System.Drawing. Font("Verdana", 9.75F,
System.Drawing. FontStyle.Regul ar, System.Drawing. GraphicsUnit.Po int,
((System.Byte)( 0)));
this.tabMain.It emSize = new System.Drawing. Size(82, 26);
this.tabMain.Lo cation = new System.Drawing. Point(15, 100);
this.tabMain.Na me = "tabMain";
this.tabMain.Pa dding = new System.Drawing. Point(5, 5);
this.tabMain.Ap pearance = System.Windows. Forms.TabAppear ance.Buttons;
this.tabMain.Ri ghtToLeft = System.Windows. Forms.RightToLe ft.Yes;
this.tabMain.Se lectedIndex = 0;
this.tabMain.Si ze = new System.Drawing. Size(760, 500);
this.tabMain.Ta bIndex = 1;
//
// tabCustomer
//
this.tabCustome r.BackgroundIma ge =
((System.Drawin g.Bitmap)(resou rces.GetObject( "tabCustomer.Ba ckgroundImage") )
);
this.tabCustome r.Location = new System.Drawing. Point(4, 30);
this.tabCustome r.Name = "tabCustome r";
this.tabCustome r.Size = new System.Drawing. Size(752, 466);
this.tabCustome r.TabIndex = 0;
this.tabCustome r.Text = "Customer";
//
// tabAppointment
//
this.tabAppoint ment.Background Image =
((System.Drawin g.Bitmap)(resou rces.GetObject( "tabAppointment .BackgroundImag e
")));
this.tabAppoint ment.Location = new System.Drawing. Point(4, 30);
this.tabAppoint ment.Name = "tabAppointment ";
this.tabAppoint ment.Size = new System.Drawing. Size(752, 466);
this.tabAppoint ment.TabIndex = 1;
this.tabAppoint ment.Text = "Appointmen t";
//
// ImgISNLogo
//
this.ImgISNLogo .Anchor = (System.Windows .Forms.AnchorSt yles.Bottom |
System.Windows. Forms.AnchorSty les.Right);
this.ImgISNLogo .Image =
((System.Drawin g.Bitmap)(resou rces.GetObject( "ImgISNLogo.Ima ge")));
this.ImgISNLogo .Location = new System.Drawing. Point(624, 616);
this.ImgISNLogo .Name = "ImgISNLogo ";
this.ImgISNLogo .Size = new System.Drawing. Size(150, 49);
this.ImgISNLogo .TabIndex = 2;
this.ImgISNLogo .TabStop = false;
//
// FormRHMain
//
this.AutoScaleB aseSize = new System.Drawing. Size(5, 13);
this.Background Image =
((System.Drawin g.Bitmap)(resou rces.GetObject( "$this.Backgrou ndImage")));
this.ClientSize = new System.Drawing. Size(792, 673);
this.Controls.A ddRange(new System.Windows. Forms.Control[] {
this.ImgISNLogo ,
this.tabMain,
this.ImgRHLogo} );
this.Name = "FormRHMain ";
this.Text = "FormRHMain ";
this.Load += new System.EventHan dler(this.FormR HMain_Load);
this.tabMain.Re sumeLayout(fals e);
this.ResumeLayo ut(false);
}
#endregion
[STAThread]
static void Main()
{
Application.Run (new FormRHMain());
}
private void FormRHMain_Load (object sender, System.EventArg s e)
{
}
private void tabPageAppointm ent_Click(objec t sender, System.EventArg s e)
{
}
private void ImgISNLogo_Clic k(object sender, System.EventArg s e)
{
}
}
}