Which code segment should you use?

You use Microsoft .NET Framework 4 to create a Windows Forms client application.
You write the following code segment.
sealed class FormSettings : ApplicationSettingsBase {
[UserScopedSetting()]
[DefaultSettingValue(“225, 200”)]
public Size FormSize
{
get { return (Size)this[“FormSize”]; }
set { this[“FormSize”] = value; }
}
}
The application contains a form of type Form1 that contains a FormSettings object named frmSettings1.
You need to maintain the user’s form size preference each time the user executes the application.
Which code segment should you use?

You use Microsoft .NET Framework 4 to create a Windows Forms client application.
You write the following code segment.
sealed class FormSettings : ApplicationSettingsBase {
[UserScopedSetting()]
[DefaultSettingValue(“225, 200”)]
public Size FormSize
{
get { return (Size)this[“FormSize”]; }
set { this[“FormSize”] = value; }
}
}
The application contains a form of type Form1 that contains a FormSettings object named frmSettings1.
You need to maintain the user’s form size preference each time the user executes the application.
Which code segment should you use?

A.
private void Form1_Load(object sender, EventArgs e)
{
frmSettings1.Reset();
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e) { frmSettings1.FormSize =
this.Size;
frmSettings1.Save(); }

B.
private void Form1_Load(object sender, EventArgs e)
{
frmSettings1.Reset();
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{ frmSettings1.FormSize = this.Size;
frmSettings1.Upgrade(); }

C.
private void Form1_Load(object sender, EventArgs e) { this.Size = frmSettings1.FormSize;
} private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{ frmSettings1.FormSize = this.Size;
frmSettings1.Upgrade(); }

D.
private void Form1_Load(object sender, EventArgs e)
{
this.Size = frmSettings1.FormSize;
} private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{ frmSettings1.FormSize = this.Size;
frmSettings1.Save(); }



Leave a Reply 0

Your email address will not be published. Required fields are marked *