class CusomPictureBox : PictureBox { private Font font=null; private string alt=string.Empty; private Color foreColor=Color.Black; public CusomPictureBox() { } protected override void OnCreateControl() { font = this.FindForm().Font; } public Font Font { get { return font; } set { font = value; } } public Color ForeColor { get { return foreColor; } set { foreColor = value; } } public string Alt { set { alt = value; } get { return alt; } } protected override void OnPaint(PaintEventArgs pe) { base.OnPaint(pe); if (this.Image == null) { pe.Graphics.DrawString(alt, font, new SolidBrush(foreColor), new PointF(10, 10)); } } }
class CusomPictureBox : PictureBox
{
private Font font=null;
private string alt=string.Empty;
private Color foreColor=Color.Black;
public CusomPictureBox()
{
} protected override void OnCreateControl()
{
font = this.FindForm().Font;
} public Font Font
{
get { return font; }
set { font = value; }
} public Color ForeColor
{
get { return foreColor; }
set { foreColor = value; }
} public string Alt
{
set { alt = value; }
get { return alt; }
} protected override void OnPaint(PaintEventArgs pe)
{
base.OnPaint(pe);
if (this.Image == null)
{
pe.Graphics.DrawString(alt, font, new SolidBrush(foreColor), new PointF(10, 10));
}
}
}
{
toolTip1.Show("tttt", this.pictureBox1, 100);
toolTip1.AutoPopDelay = 5000;
toolTip1.InitialDelay = 1000;
toolTip1.ReshowDelay = 500;
}
ToolTip tip = new ToolTip(this.components);
tip.SetToolTip(this.pictureBox1, txt);