Click here to Skip to main content
15,902,299 members
Home / Discussions / Windows Forms
   

Windows Forms

 
QuestionDesigning the GUI outside of VS2005 Pin
yuvalby7425-Feb-07 0:48
yuvalby7425-Feb-07 0:48 
AnswerRe: Designing the GUI outside of VS2005 Pin
Hesham Amin26-Feb-07 1:08
Hesham Amin26-Feb-07 1:08 
AnswerRe: Designing the GUI outside of VS2005 Pin
Pete O'Hanlon26-Feb-07 8:52
mvePete O'Hanlon26-Feb-07 8:52 
Questionhow i can do that??? Pin
Member 283282724-Feb-07 22:54
Member 283282724-Feb-07 22:54 
AnswerBind a data grid with an array list (Re: how i can do that???) Pin
RabidHamster2-Mar-07 4:18
RabidHamster2-Mar-07 4:18 
QuestionHow Windows Graphics and mouse movement is mapped Pin
bil_geo24-Feb-07 19:48
bil_geo24-Feb-07 19:48 
QuestionIExtenderProvider [modified] Pin
Scott Dorman22-Feb-07 16:39
professionalScott Dorman22-Feb-07 16:39 
AnswerRe: IExtenderProvider Pin
Pete O'Hanlon28-Feb-07 10:24
mvePete O'Hanlon28-Feb-07 10:24 
Scott

Sorry that it has taken so long to get back to you, but the way to do this is fairly straight forward. In your Set... method, add a handler for the ParentChanged event like this:
txtItem.ParentChanged += new EventHandler(txtItem_ParentChanged);
Then, your method will look like this:
void txtItem_ParentChanged(object sender, EventArgs e)
{
  TextBox control = sender as TextBox;

  string labelText = Get...(control);
  LabelExtender(labelText, control);
}
Finally, create a method for the label extender:
private void LabelExtender(string labelText, TextBox txtBox)
{
  Point loc = txtBox.Location;
  Label label = new Label();
  label.Name = string.Format("label{0}", Guid.NewGuid().ToString());
  label.Location = loc;
  label.Text = labelText;
  label.AutoSize = true;
  label.TabIndex = 0;
  label.Size = new System.Drawing.Size(35, 13);
  label.Visible = true;

  if (txtBox.Parent != null)
  {
    txtBox.Parent.Controls.Add(label);
  }
  txtBox.Left += label.Width;
  if (txtBox.Parent != null)
    txtBox.Parent.Invalidate();
}



the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer

Deja View - the feeling that you've seen this post before.

GeneralRe: IExtenderProvider Pin
Scott Dorman1-Mar-07 15:36
professionalScott Dorman1-Mar-07 15:36 
GeneralRe: IExtenderProvider Pin
Pete O'Hanlon1-Mar-07 22:40
mvePete O'Hanlon1-Mar-07 22:40 
QuestionIs there a way to create a file of type PST with our own structure [modified] Pin
Sivaprakash4u21-Feb-07 18:04
Sivaprakash4u21-Feb-07 18:04 
QuestionHow to load a document into an existing instance of an application via ShellExecute() ? Pin
MatthiasBiel21-Feb-07 1:11
MatthiasBiel21-Feb-07 1:11 
AnswerRe: How to load a document into an existing instance of an application via ShellExecute() ? Pin
kubben21-Feb-07 3:20
kubben21-Feb-07 3:20 
AnswerRe: How to load a document into an existing instance of an application via ShellExecute() ? Pin
Mike Dimmick21-Feb-07 4:41
Mike Dimmick21-Feb-07 4:41 
QuestionHow to customize the WinPE with Internet Explorer Pin
Vamsee_Krishna20-Feb-07 4:11
Vamsee_Krishna20-Feb-07 4:11 
QuestionHow to work with ToggleButton Pin
pashitech19-Feb-07 17:41
pashitech19-Feb-07 17:41 
QuestionRe: How to work with ToggleButton Pin
Newbie0020-Feb-07 0:27
Newbie0020-Feb-07 0:27 
AnswerRe: How to work with ToggleButton Pin
Bulky Fellow20-Feb-07 20:49
Bulky Fellow20-Feb-07 20:49 
GeneralRe: How to work with ToggleButton Pin
Newbie0021-Feb-07 0:58
Newbie0021-Feb-07 0:58 
QuestionVSTO error handling Pin
FlorentBzh19-Feb-07 5:48
FlorentBzh19-Feb-07 5:48 
QuestionKeeping MDI children alive Pin
CPP_Student18-Feb-07 23:18
CPP_Student18-Feb-07 23:18 
AnswerRe: Keeping MDI children alive Pin
Newbie0019-Feb-07 5:05
Newbie0019-Feb-07 5:05 
GeneralRe: Keeping MDI children alive Pin
CPP_Student19-Feb-07 17:20
CPP_Student19-Feb-07 17:20 
QuestionEquivalent to WM_HOTKEY? Pin
LionAM18-Feb-07 1:34
LionAM18-Feb-07 1:34 
AnswerRe: Equivalent to WM_HOTKEY? Pin
Dave Kreskowiak18-Feb-07 11:54
mveDave Kreskowiak18-Feb-07 11:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.