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.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;
namespace TestControl
{
/// <summary>
/// Zusammenfassung für UserControl1.
/// </summary>
public class UserControl1 : System.Windows.Forms.UserControl
{
private System.ComponentModel.IContainer 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(string test)
{
InitializeComponent();
}
/// <summary>
/// Die verwendeten Ressourcen bereinigen.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if( components != null )
components.Dispose();
}
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 InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Resources.ResourceManager resources = new
System.Resources.ResourceManager(typeof(UserContro l1));
this.textBox1 = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.imageList1 = new
System.Windows.Forms.ImageList(this.components);
this.textBox2 = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(0, 0);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(232, 20);
this.textBox1.TabIndex = 0;
this.textBox1.Text = "";
//
// label1
//
this.label1.BackColor = System.Drawing.Color.Transparent;
this.label1.ImageAlign = System.Drawing.ContentAlignment.TopLeft;
this.label1.ImageIndex = 0;
this.label1.ImageList = this.imageList1;
this.label1.Location = new System.Drawing.Point(1, 1);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(17, 17);
this.label1.TabIndex = 1;
this.label1.Text = "label1";
//
// imageList1
//
this.imageList1.ImageSize = new System.Drawing.Size(16, 16);
this.imageList1.ImageStream =
((System.Windows.Forms.ImageListStreamer)(resource s.GetObject("imageList1.ImageStream")));
this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
//
// textBox2
//
this.textBox2.Anchor =
((System.Windows.Forms.AnchorStyles)((((System.Win dows.Forms.AnchorStyles.Top
| System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.textBox2.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.textBox2.Location = new System.Drawing.Point(24, 4);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(200, 13);
this.textBox2.TabIndex = 2;
this.textBox2.Text = "textBox2";
//
// UserControl1
//
this.Controls.Add(this.textBox2);
this.Controls.Add(this.label1);
this.Controls.Add(this.textBox1);
this.Name = "UserControl1";
this.Size = new System.Drawing.Size(232, 22);
this.ResumeLayout(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