これは私が持っているものです。
Dim frmSettings As New frmOptions
frmSettings.ShowDialog(Me)
frmSettingsは、form1(Me)の背景色を選択できる設定フォームです。しかし、form1プロパティにアクセスして背景色を変更することはできません。
これは私が持っているものです。
Dim frmSettings As New frmOptions
frmSettings.ShowDialog(Me)
frmSettingsは、form1(Me)の背景色を選択できる設定フォームです。しかし、form1プロパティにアクセスして背景色を変更することはできません。
ただし、現在のフォームでコールバックを提供することはできます。このコールバックは、プロパティが変更されたときに設定フォームが呼び出すことができます。C#でごめんなさい。午前中にVBを書くには早すぎます。おそらく、プロパティを変更するために使用される一連のメソッドを定義するインターフェイスが必要であり、呼び出し元がメソッドにアクセスできるように、フォームをインターフェイスとして渡す必要があります。
public interface IChangeableProperties
{
void ChangeBackgroundColor( Color newColor );
...
}
public class MyForm : Form, IChangeableProperties
{
...
public void ChangeBackgroundColor( Color newColor )
{
...
}
}
次に、設定フォームで
private IChangeableProperties callingForm;
public void ShowDialog( IChangeableProperties caller )
{
callingForm = caller;
...
}
そしてあなたのイベントハンドラーで
callingForm.ChangeBackgroundColor( selectedColor );