Tip !!!/C# tip
사용자정의Control이 메인폼의 Control에 접근하기
MCNT
2022. 7. 27. 03:55
UserControl에서 Control properties를 만들어 넘겨 받으면 끝.
[ UserControl 에서]
TextBox tBox;
[Category("txtBox"), Description("explanation")] //속성추가
public TextBox txtBox{ get { return tBox; } set { tBox = value; } }
[MainForm에서]
UserControl속성 중 txtBox에 Control name을 입력함
이제 tbox는 메인폼의 Control으로 사용하면 됨
tBox.Text="123"; 하면 MainForm의 Control.Text="123" 에 입력됨.