question an eventuality perculiarity tabcontrol
i have small explanation next rare problem.
using system;
using system.windows.forms;
namespace windowsapplication1
{
open category testform : form
{
private system.windows.forms.tabcontrol tabcontrol1;
private system.windows.forms.tabpage tabpage1;
private system.windows.forms.tabpage tabpage2;
private system.windows.forms.textbox textbox1;
open testform()
{
//controls
this.tabcontrol1 = new system.windows.forms.tabcontrol();
this.tabpage1 = new system.windows.forms.tabpage();
this.tabpage2 = new system.windows.forms.tabpage();
this.textbox1 = new system.windows.forms.textbox();
// tabcontrol1
this.tabcontrol1.anchor = ((system.windows.forms.anchorstyles)((((system.windows.forms.anchorstyles.top | system.windows.forms.anchorstyles.bottom)
| system.windows.forms.anchorstyles.left)
| system.windows.forms.anchorstyles.right)));
this.tabcontrol1.controls.add(this.tabpage1);
this.tabcontrol1.controls.add(this.tabpage2);
this.tabcontrol1.location = new system.drawing.point(12, 12);
this.tabcontrol1.name = "tabcontrol1";
this.tabcontrol1.selectedindex = 0;
this.tabcontrol1.size = new system.drawing.size(260, 240);
this.tabcontrol1.tabindex = 0;
this.tabcontrol1.selected += new system.windows.forms.tabcontroleventhandler(this.tabcontrol1_selected);
// tabpage1
this.tabpage1.controls.add(this.textbox1);
this.tabpage1.location = new system.drawing.point(4, 22);
this.tabpage1.name = "tabpage1";
this.tabpage1.size = new system.drawing.size(252, 214);
this.tabpage1.tabindex = 0;
this.tabpage1.text = "tabpage1";
// tabpage2
this.tabpage2.location = new system.drawing.point(4, 22);
this.tabpage2.name = "tabpage2";
this.tabpage2.size = new system.drawing.size(192, 74);
this.tabpage2.tabindex = 1;
this.tabpage2.text = "tabpage2";
// textbox1
this.textbox1.anchor = ((system.windows.forms.anchorstyles)(((system.windows.forms.anchorstyles.top | system.windows.forms.anchorstyles.left)
| system.windows.forms.anchorstyles.right)));
this.textbox1.location = new system.drawing.point(6, 38);
this.textbox1.name = "textbox1";
this.textbox1.size = new system.drawing.size(240, 20);
this.textbox1.tabindex = 0;
// testform
this.clientsize = new system.drawing.size(284, 264);
this.controls.add(this.tabcontrol1);
this.name = "form1";
this.text = "form1";
}
//tab selected
private vacant tabcontrol1_selected(object sender, eventargs e)
{
this.text = "textbox width: " + this.textbox1.width.tostring();
}
}
//main
stationary category program
{
stationary vacant main()
{
application.run(new testform());
}
}
}
if run above c# formula have little form containing tabcontrol. within tabcontrol texbox initial tab. follow stairs problem:
- select tabpage2 (textbox1's extent reported form title)
- resize form
- select tabpage1 (the wrong textbox1 extent reported)
any ideas going here? textbox apparently bigger being reported. click again tabpage2 repremand distance following updated. apparently there an eventuality updating extent textbox1. i trigger tabpage1 selected?
Comments
Post a Comment