Hi Martin,
just fake it. Create a custum usercontrol.
Place a normal textbox control on it. Then
add a transparent label to the left corner
of the textbox. Add an imagelist to your
control create a gif set this imagelist
as imagelist for your label. At least add
a new textbox and place it over the rest
of the visible underlaying textbox. Set
the second textbox to borderstyle none.
Et voila.
Here is a quick made one. Notice, that you
will have to add your graphics.
Cheers
Lars Behrmann
Nothing is impossible. UML is the key for all your problems.
AODL - Make your .net apps OpenOffice ready
http://aodl.sourceforge.net/
using System;
using System.Collecti ons;
using System.Componen tModel;
using System.Drawing;
using System.Data;
using System.Windows. Forms;
namespace TestControl
{
/// <summary>
/// Zusammenfassung für UserControl1.
/// </summary>
public class UserControl1 : System.Windows. Forms.UserContr ol
{
private System.Componen tModel.IContain er components;
private System.Windows. Forms.TextBox textBox1;
private System.Windows. Forms.Label label1;
private System.Windows. Forms.ImageList imageList1;
private System.Windows. Forms.TextBox textBox2;
private string _test;
public UserControl1(st ring test)
{
InitializeCompo nent();
}
/// <summary>
/// Die verwendeten Ressourcen bereinigen.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if( components != null )
components.Disp ose();
}
base.Dispose( disposing );
}
#region Vom Komponenten-Designer generierter Code
/// <summary>
/// Erforderliche Methode für die Designerunterst ützung.
/// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert
werden.
/// </summary>
private void InitializeCompo nent()
{
this.components = new System.Componen tModel.Containe r();
System.Resource s.ResourceManag er resources = new
System.Resource s.ResourceManag er(typeof(UserC ontrol1));
this.textBox1 = new System.Windows. Forms.TextBox() ;
this.label1 = new System.Windows. Forms.Label();
this.imageList1 = new
System.Windows. Forms.ImageList (this.component s);
this.textBox2 = new System.Windows. Forms.TextBox() ;
this.SuspendLay out();
//
// textBox1
//
this.textBox1.L ocation = new System.Drawing. Point(0, 0);
this.textBox1.N ame = "textBox1";
this.textBox1.S ize = new System.Drawing. Size(232, 20);
this.textBox1.T abIndex = 0;
this.textBox1.T ext = "";
//
// label1
//
this.label1.Bac kColor = System.Drawing. Color.Transpare nt;
this.label1.Ima geAlign = System.Drawing. ContentAlignmen t.TopLeft;
this.label1.Ima geIndex = 0;
this.label1.Ima geList = this.imageList1 ;
this.label1.Loc ation = new System.Drawing. Point(1, 1);
this.label1.Nam e = "label1";
this.label1.Siz e = new System.Drawing. Size(17, 17);
this.label1.Tab Index = 1;
this.label1.Tex t = "label1";
//
// imageList1
//
this.imageList1 .ImageSize = new System.Drawing. Size(16, 16);
this.imageList1 .ImageStream =
((System.Window s.Forms.ImageLi stStreamer)(res ources.GetObjec t("imageList1.I mageStream")));
this.imageList1 .TransparentCol or = System.Drawing. Color.Transpare nt;
//
// textBox2
//
this.textBox2.A nchor =
((System.Window s.Forms.AnchorS tyles)((((Syste m.Windows.Forms .AnchorStyles.T op
| System.Windows. Forms.AnchorSty les.Bottom)
| System.Windows. Forms.AnchorSty les.Left)
| System.Windows. Forms.AnchorSty les.Right)));
this.textBox2.B orderStyle = System.Windows. Forms.BorderSty le.None;
this.textBox2.L ocation = new System.Drawing. Point(24, 4);
this.textBox2.N ame = "textBox2";
this.textBox2.S ize = new System.Drawing. Size(200, 13);
this.textBox2.T abIndex = 2;
this.textBox2.T ext = "textBox2";
//
// UserControl1
//
this.Controls.A dd(this.textBox 2);
this.Controls.A dd(this.label1) ;
this.Controls.A dd(this.textBox 1);
this.Name = "UserContro l1";
this.Size = new System.Drawing. Size(232, 22);
this.ResumeLayo ut(false);
}
#endregion
}
}
Visual Systems AB (Martin Arvidsson) schrieb:
Hi!
Can any one point me in direction of modify a TextBox control.
What i want to do is to add a button, like the ComboBox have. with my own
bitmap
and execute an Event when clicked.
I will use this to bring a lookup table when searching for customers.
Regards
Martin Arvidsson