Misplaced custom button text

Z

z_yves

Hi all,

I just want to create a custom web button, but the button
text appears in the top left corner of IE6!

Can someone nice please pinpoint to me what makes the button text
not to appear in the middle of the button?
(... as I would have thought it could not appear anywhere else!)

Thanks a lot!

Yves

==========================================================

using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;
using System.Drawing;

namespace Test
{

/// <summary>
/// Summary description for BlueButton.
/// </summary>
[DefaultProperty("Text"),
DefaultEvent("Click"),
ToolboxData("<{0}:BlueButton runat=server></{0}:BlueButton>")]

public class BlueButton : System.Web.UI.WebControls.Button
{

private string text;

[Bindable(true),
Category("Appearance"),
DefaultValue("")]
new public string Text
{
get
{
return text;
}

set
{
text = value;
}
}


/// <summary>
/// Render this control to the output parameter specified.
/// </summary>
/// <param name="output"> The HTML writer to write out to </param>
protected override void Render(HtmlTextWriter output)
{
base.Render(output);
output.Write(Text);
}



private void BlueButton_Click(object sender, System.EventArgs e)
{
this.BackColor = System.Drawing.Color.LimeGreen ;
}

protected override void OnInit(EventArgs e)
{
// TODO: Add BlueButton.OnInit implementation
this.Click += new System.EventHandler(this.BlueButton_Click);
this.BorderStyle = System.Web.UI.WebControls.BorderStyle.None ;
this.BackColor = System.Drawing.Color.MediumSlateBlue ;
this.ForeColor = System.Drawing.Color.White ;
base.OnInit (e);
}
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top