私の質問は、記事Preserve Size and Location of Windows Forms – Part I by Dennis Wallentin に示されているこの簡単なウォークスルーに関するものです。
VB.NET を使用する場合、このアプローチは 100% 正常に機能します。ただし、C# で同じ手順を使用すると、アプリケーションのプロパティの [設定] タブ内の設定は正しく表示され、app.config ファイルも正しく表示されますが、実行時に値が保存されません。
app.config ファイルは次のようになります。
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="WindowsAppCs.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<userSettings>
<WindowsAppCs.Properties.Settings>
<setting name="Location" serializeAs="String">
<value>0, 0</value>
</setting>
<setting name="Size" serializeAs="String">
<value>284, 262</value>
</setting>
</WindowsAppCs.Properties.Settings>
</userSettings>
</configuration>
私には正しいように見えますが、Visual Studio 内でホストされている場合、またはコンパイルされた EXE を実行している場合、値は更新されません。
非常に単純なことを追加または実行する必要があると確信していますが、何がわかりません。ここに何かアイデアはありますか?
事前にどうもありがとう...