0

I have a custom TabPage class:

class CustomTabPage : TabPage { TextBox tbCode = new TextBox(); public CustomTabPage() { } public CustomTabPage(string title) { tbCode.Multiline = true; tbCode.Size = this.Size; } //Something like this... private void OnThisControlSizeChanged() { tbCode.Size = this.Size; } } 

What I need for this class is to raise the OnSizeChanged event of the TabPage control when I resize it from where I create the control. The reason for this is when I resize the TabPage control, I want to adapt the TextBox size accordingly so that they stay the same.

2 Answers 2

1
class CustomTabPage : TabPage { TextBox tbCode = new TextBox(); public CustomTabPage() { SizeChanged += CustomTabPage_SizeChanged; } void CustomTabPage_SizeChanged(object sender, EventArgs e) { OnThisControlSizeChanged(); } public CustomTabPage(string title) { tbCode.Multiline = true; tbCode.Size = this.Size; } private void OnThisControlSizeChanged() { tbCode.Size = this.Size; } } 
Sign up to request clarification or add additional context in comments.

Comments

0
this.OnSizeChanged(new EventArgs()); 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.