コンボボックスと同じ機能を取得しようとしています。たとえば、combobox1.Items.Add() // editor.Tags.Tags1()
このような:
class Main()
{
// The editor is passed into the editor class, that allows the editor class to update the editor.
MyEditorClass editor = new MyEditorClass(editorBox);
editor.Tags.InsertTag1();
// Now i don't want people to do this
// MyEditorClass.TagClass tags = new MyEditorClass.TagClass();
}
これは、tags クラスが MyEditorClass に渡された editorBox を呼び出し、そのエディターなしで tags クラスを作成すると機能しないためです。
私の MyEditorClass は次のようになります。
public class MyEditorClass
{
static RichTextBox editor;
public TagClass Tags;
public MyEditorClass(RichTextBox editorBox)
{
editor = editorBox;
Tags = new TagClass();
}
public class TagClass
{
public void InsertTag1()
{
editor.Text += "Test tag 1";
}
}
}
TagClass を静的にしようとしましたが、うまくいきませんでした。コンボボックスはどのように構成されていますか? Combobox.Items は使用できませんが、宣言すると、宣言したもので Combobox.Items を使用できます。