サンプルコード001
メニュー部分のサンプルコードです。
New()で必要なクラスを初期化して、AddIn_Load()でユーザーメニューを用意しています。AddIn_Start()から実際の処理を記述すればいいでしょう。
'CYTOLOGY2 サンプルコード001
'===================================================

Imports System.Windows.Forms
Imports System.Drawing

Public Class AddIn

    Private std As Std
    Private ddItemCombo1(,) As ToolStripComboBox
	Private ddLabelNow As ToolStripLabel
    Private ddItemProcessNum As ToolStripTextBox
    Private ddItemProcessApply As ToolStripButton

    Public Sub New()
        std = New Std()
    End Sub

    Public Sub AddIn_Load()
        ddButtonInitial01()
        ddButtonInitial02()
    End Sub

    Public Sub AddIn_Stop()
        ddLabelNow.Text = "STOP"
		'ここに終了処理を記述します。
    End Sub

    Public Sub AddIn_Start()
        ddLabelNow.Text = "START"	'これは現在の実行状況を記述するなどに使用します。
		'ここにメインの処理を記述します。
    End Sub

    Private Sub ddButtonInitial01()
        Dim action As String() = New String() { _
			"おはよう", "こんにちは", "こんばんは", "さようなら", ""}
		Dim item As String(,) = New String(,) { _
		   {"a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8"} _
		 , {"b1", "b2", "b3", "b4", "b5", "b6", "b7", "b8"} _
		 , {"c1", "c2", "c3", "c4", "c5", "c6", "c7", "c8"} _
		 , {"d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8"} _
		}

        Dim ddButton As ToolStripDropDownButton = New ToolStripDropDownButton("設定")
        Dim dd As ToolStripDropDownMenu = New ToolStripDropDownMenu()
        ddButton.DropDown = dd
        ReDim ddItemCombo1(item.GetLength(0) - 1, item.GetLength(1) - 1)

        Dim ddButton0 As ToolStripMenuItem = New ToolStripMenuItem("グループ1")
        Dim dd0 As ToolStripDropDown = New ToolStripDropDown()
        ddButton0.DropDown = dd0
        ddButton0.DropDownDirection = ToolStripDropDownDirection.Right
        For i1 As Integer = 0 To item.GetLength(1) - 1 Step 1
            ddItemCombo1(0, i1) = New ToolStripComboBox()
            For i2 As Integer = 0 To action.Length - 1 Step 1
                ddItemCombo1(0, i1).Items.Add(item(0, i1) & " : " & action(i2))
            Next
            dd0.Items.Add(ddItemCombo1(0, i1))
			ddItemCombo1(0, i1).SelectedIndex = 4
        Next
        dd.Items.Add(ddButton0)

        Dim ddButton1 As ToolStripMenuItem = New ToolStripMenuItem("グループ2")
        Dim dd1 As ToolStripDropDown = New ToolStripDropDown()
        ddButton1.DropDown = dd1
        ddButton1.DropDownDirection = ToolStripDropDownDirection.Right
        For i1 As Integer = 0 To item.GetLength(1) - 1 Step 1
            ddItemCombo1(1, i1) = New ToolStripComboBox()
            For i2 As Integer = 0 To action.Length - 1 Step 1
                ddItemCombo1(1, i1).Items.Add(item(1, i1) & " : " & action(i2))
            Next
            dd1.Items.Add(ddItemCombo1(1, i1))
			ddItemCombo1(1, i1).SelectedIndex = 4
        Next
        dd.Items.Add(ddButton1)

        Dim ddButton2 As ToolStripMenuItem = New ToolStripMenuItem("グループ3")
        Dim dd2 As ToolStripDropDown = New ToolStripDropDown()
        ddButton2.DropDown = dd2
        ddButton2.DropDownDirection = ToolStripDropDownDirection.Right
        For i1 As Integer = 0 To item.GetLength(1) - 1 Step 1
            ddItemCombo1(2, i1) = New ToolStripComboBox()
            For i2 As Integer = 0 To action.Length - 1 Step 1
                ddItemCombo1(2, i1).Items.Add(item(2, i1) & " : " & action(i2))
            Next
            dd2.Items.Add(ddItemCombo1(2, i1))
			ddItemCombo1(2, i1).SelectedIndex = 4
        Next
        dd.Items.Add(ddButton2)

        Dim ddButton3 As ToolStripMenuItem = New ToolStripMenuItem("グループ4")
        Dim dd3 As ToolStripDropDown = New ToolStripDropDown()
        ddButton3.DropDown = dd3
        ddButton3.DropDownDirection = ToolStripDropDownDirection.Right
        For i1 As Integer = 0 To item.GetLength(1) - 1 Step 1
            ddItemCombo1(3, i1) = New ToolStripComboBox()
            For i2 As Integer = 0 To action.Length - 1 Step 1
                ddItemCombo1(3, i1).Items.Add(item(3, i1) & " : " & action(i2))
            Next
            dd3.Items.Add(ddItemCombo1(3, i1))
			ddItemCombo1(3, i1).SelectedIndex = 4
        Next
        dd.Items.Add(ddButton3)

        Dim ddItemSeparator As ToolStripSeparator
        ddItemSeparator = New ToolStripSeparator()
        ddItemSeparator.AutoSize = True
        dd.Items.Add(ddItemSeparator)

        Dim ddButton4 As ToolStripMenuItem = New ToolStripMenuItem("オプション番号")
        Dim dd4 As ToolStripDropDown = New ToolStripDropDown()
        ddButton4.DropDown = dd4
        ddButton4.DropDownDirection = ToolStripDropDownDirection.Right
        ddItemProcessNum = New ToolStripTextBox()
        ddItemProcessNum.BackColor = Color.WhiteSmoke
        dd4.Items.Add(ddItemProcessNum)
        ddItemProcessApply = New ToolStripButton("適用")
        dd4.Items.Add(ddItemProcessApply)
        dd.Items.Add(ddButton4)

        std.AddInMenuAddOnce(ddButton)

    End Sub

    Private Sub ddButtonInitial02()
        ddLabelNow = New ToolStripLabel("STOP")
        std.AddInMenuAddOnce(ddLabelNow)
    End Sub

End Class
 
 
 
 
このサイトでお気付きの点がございましたら
ご連絡いただけますと幸いです。
Eメール(任意)
送信内容
 
このサイトでお気付きの点がございましたら
ご連絡いただけますと幸いです。
 
Eメール(任意)
送信内容
 
このサイトでお気付きの点がございましたら
ご連絡いただけますと幸いです。
 
Eメール(任意)
送信内容
 
便




top of page