Option Strict Off
Option Explicit On
Imports System.Windows.Forms
Imports VB = Microsoft.VisualBasic
'------------------------------------ 2024/04/10 ------------------------------------
Public Class clsJishoPaco
#Region "宣言"
    Event JishoListBIG_ShowHide(ByVal ShowTrue_HideFalse As Boolean)
    Event JishoListClick(ByVal ListItemText As String, ByVal ListItemIndex As Integer)    'ListItemText の文字が辞書リストから出力されました。
    Event JishoModeChange(ByVal rReadTrue_EditFalse As Boolean, ByRef wTextBox As TextBox, ByRef wListBox As ListBox)    '辞書のモードが^変更されました。
    'rReadTrue_EditFalse = True　　辞書読み出しモードになりました。   'rReadTrue_EditFalse = False　 辞書編集モードになりました。
    '------------------------------------------------------------------------------------------------------
    Private WithEvents mJiText As TextBox
    Private WithEvents mJiModeChgBtn As Button
    Private WithEvents mJiList As ListBox
    Private WithEvents mJiEditText As TextBox
    Private WithEvents mJiEditBtnADD As Button
    Private WithEvents mJiEditBtnDEL As Button
    Private WithEvents mJiEditBtnCAN As Button
    Private WithEvents mJiListBig As ListBox
    Private WithEvents mJiListBigCloseBtn As Button
    Private WithEvents mJiListBigBtn As Button
    '------------------------------------------------------------------------------------------------------
    Private mMake_ing As Boolean = True
    Private mJiListKWD_Click As Boolean
#End Region

#Region "基本"
    Friend Function Make(ByVal rParentCont As Panel) As Boolean
        Dim BK As Color = rParentCont.BackColor, FR As Color = rParentCont.ForeColor
        Try
            mMake_ing = True
            With mJiText
                .Parent = rParentCont
                .Font = .Parent.Font
                .MaxLength = 100
                .Multiline = False
                .WordWrap = False
                .ImeMode = ImeMode.NoControl
                .HideSelection = False
                '.SetBounds(0, 0, 300, 30, BoundsSpecified.All)
            End With
            mMake_ing = False
            With mJiModeChgBtn  ' As Button
                .Parent = rParentCont : .Font = .Parent.Font : .Text = " " : .Visible = False
                .BackColor = BK : .ForeColor = FR
            End With
            With mJiList ' As ListBox
                .Parent = rParentCont : .Font = .Parent.Font : .Sorted = False : .IntegralHeight = False
                .ScrollAlwaysVisible = True
            End With
            With mJiEditText ' As TextBox
                .Parent = mJiList  ' rParentCont
                .Font = .Parent.Font
                .MaxLength = 100
                .Multiline = False
                .BorderStyle = BorderStyle.None  '.FixedSingle
                .WordWrap = False
                .ImeMode = ImeMode.Off
                .HideSelection = False
                .Visible = False
            End With
            With mJiEditBtnADD 'As Button
                .Parent = mJiList : .Font = .Parent.Font : .Text = "追加" : .Visible = False : .AutoEllipsis = True
                .BackColor = BK : .ForeColor = FR
            End With
            With mJiEditBtnDEL 'As Button
                .Parent = mJiList : .Font = .Parent.Font : .Text = "削除" : .Visible = False : .AutoEllipsis = True
                .BackColor = BK : .ForeColor = FR
            End With
            With mJiEditBtnCAN 'As Button
                .Parent = mJiList : .Font = .Parent.Font : .Text = "取消" : .Visible = False : .AutoEllipsis = True
                .BackColor = BK : .ForeColor = FR
            End With
            '***********************************************
            With mJiListBig
                .Parent = rParentCont : .Font = .Parent.Font : .Sorted = False : .IntegralHeight = False : .MultiColumn = True : .HorizontalScrollbar = True : .ColumnWidth = 100
                .Visible = False
            End With
            With mJiListBigCloseBtn
                .Parent = rParentCont : .Font = .Parent.Font : .Text = "×" : .Visible = False
                .BackColor = BK : .ForeColor = FR
            End With
            With mJiListBigBtn
                .Parent = rParentCont : .Font = .Parent.Font : .Text = "+" : .Visible = False : .AutoEllipsis = True
                .BackColor = BK : .ForeColor = FR
            End With
            '***********************************************
            Call Jisho_Initialize()
            Return True
        Catch ex As Exception
            MsgBox("ERROR in clsPacopaco.Make()" & vbCrLf & ex.ToString)
            Return False
        End Try
    End Function
    Friend Function SizeChange(ByVal rFontChg As Boolean, ByVal rLeft As Integer, ByVal rTop As Integer, ByVal rWidth As Integer, ByVal rHeight As Integer) As Boolean
        Static sLeft, ssTop, sOldWD, sOldHT As Integer
        Dim mJiListBig_Visible As Boolean = mJiListBig.Visible
        If mJiListBig_Visible Then
            'OK Do
        ElseIf rFontChg Then  'OK Do
            rLeft = sLeft : rTop = ssTop : rWidth = sOldWD : rHeight = sOldHT
        Else
            If sLeft = rLeft And ssTop = rTop And sOldWD = rWidth And sOldHT = rHeight Then Return False
        End If
        Dim nWD As Integer = Ⅹ数値範囲Int(50, 400, rWidth)
        Dim nHT As Integer = Ⅹ数値範囲Int(100, 2000, rHeight)
        With mJiText
            '.Font = .Parent.Font
            .SetBounds(rLeft, rTop, nWD, 0, BoundsSpecified.Location Or BoundsSpecified.Width)
            .Visible = True
        End With
        Dim yy As Integer = mJiText.Height - 4
        With mJiModeChgBtn
            Dim wd As Integer = Ⅹ数値範囲Int(20, mJiText.ClientRectangle.Width \ 3, yy * 2)
            .SetBounds(mJiText.Right - 2 - wd, rTop + 2, wd, yy, BoundsSpecified.All)
            .Visible = True
        End With
        yy = mJiText.Bottom + 2
        With mJiList
            .SetBounds(rLeft, yy, nWD, rTop + nHT - yy, BoundsSpecified.All)
            .Visible = True
        End With
        '***********************************************
        Dim w As Integer = mJiListBig.Parent.ClientRectangle.Width
        Dim h As Integer = mJiListBig.Parent.ClientRectangle.Height
        With mJiListBig
            .SetBounds(0, 0, w, h, BoundsSpecified.All)
        End With
        w = mJiModeChgBtn.Width
        h = mJiList.ItemHeight * 2
        With mJiList
            mJiListBigBtn.SetBounds(.Left + .ClientRectangle.Width - w, .Top, w, h, BoundsSpecified.All)
        End With
        Call zzmJiListBigBtnSet()
        '***********************************************
        '***********************************************
        If mJiListBig.Visible Then
            mJiListBig.BringToFront()
            mJiListBigCloseBtn.BringToFront()
        Else
            mJiModeChgBtn.BringToFront()
        End If
        mJiListBigCloseBtn.Visible = mJiListBig.Visible
        '***********************************************
        'qqqqq(CStr(mJiList.Bottom))
        sLeft = rLeft : ssTop = rTop : sOldWD = rWidth : sOldHT = rHeight
        Return True
    End Function
    Friend Function 辞書ListBox() As ListBox
        Return Me.mJiList
    End Function
    Friend Function フォントデーターをください(ByRef wFontName As String, ByRef wFontSize As Integer, ByRef wFontBold As Boolean) As Boolean
        With mJiList.Font
            wFontName = .Name
            wFontSize = CInt(.Size)
            wFontBold = .Bold
        End With
        Return True
    End Function
    Friend Function フォントを設定してください(ByVal rFontName As String, ByVal rFontSize As Integer, ByVal rFontBold As Boolean, ByVal DoReDraw As Boolean) As Boolean
        Try
            Dim fsty As FontStyle = IIf(rFontBold, FontStyle.Bold, FontStyle.Regular)
            With mJiList
                .Font = New Font(rFontName, rFontSize, fsty)
                mJiText.Font = .Font
                mJiModeChgBtn.Font = .Font
                mJiList.Font = .Font
                mJiEditText.Font = .Font
                mJiEditBtnADD.Font = .Font
                mJiEditBtnDEL.Font = .Font
                mJiEditBtnCAN.Font = .Font
            End With
            If DoReDraw Then gggbol = SizeChange(True, 0, 0, 0, 0)
            Return True
        Catch ex As Exception
            Return False
        End Try
    End Function
#End Region

#Region "New Finalize"
    Public Sub New()
        mJiText = New TextBox
        mJiModeChgBtn = New Button
        mJiList = New ListBox
        mJiEditText = New TextBox
        mJiEditBtnADD = New Button
        mJiEditBtnDEL = New Button
        mJiEditBtnCAN = New Button
        mJiListBig = New ListBox
        mJiListBigCloseBtn = New Button
        mJiListBigBtn = New Button
    End Sub
    Protected Overrides Sub Finalize()
        mJiText.Dispose()
        mJiModeChgBtn.Dispose()
        mJiList.Dispose()
        mJiEditText.Dispose()
        mJiEditBtnADD.Dispose()
        mJiEditBtnDEL.Dispose()
        mJiEditBtnCAN.Dispose()
        mJiListBig.Dispose()
        mJiListBigCloseBtn.Dispose()
        mJiListBigBtn.Dispose()
        MyBase.Finalize()
    End Sub
#End Region

#Region "コピー from Old CofJisho ********************************"

#Region "宣言"
    Private Const gcAdd As Short = 100
    Private Const gcDel As Short = 101
    Private Const gcRep As Short = 102
    Private Const gcReset As Short = 110
    Private Const cHedBackFile As String = "z-"
    'in 五basCOM.vb -----------------------------------------------------
    'Public Const gggDayTimeFormat_yyyyMMdd_HHmmss As String = "yyyyMMdd-HHmmss"
    'Public Const gggDayTimeFormat_yyyyMMddHHmmss As String = "yyyyMMddHHmmss"   '注意　 VB5  のコード  "yyyymmddhhmmss"  を使用すると　.NET_VB　ではエラーになる。
    'in 五basCOM.vb -----------------------------------------------------
    Private Const cBackFileAddFormat As String = "-" & gggDayTimeFormat_yyyyMMdd_HHmmss '"-yyyyMMdd-HHmmss"
    Private Const cEntryFileTimeFormat As String = gggDayTimeFormat_yyyyMMddHHmmss ' "yyyyMMddHHmmss"
    Private Const cStdJishoName As String = "標準"
    Private Const cJishoFileMaxLen As Integer = 500000
    Private Const c辞書フォルダ As String = "JishoTexts"
    Private Const Format最終更新 As String = "yyyy-MM-dd HH:mm:ss"

    Private Structure wdstring
        'UPGRADE_WARNING: 固定長文字列のサイズはバッファに合わせる必要があります。 詳細については、'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="3C1E4426-0B80-443E-B943-0627CD55D48B"' をクリックしてください。
        <VBFixedString(1), System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst:=1)> Public hed() As Char
        Dim wd() As String
        Dim wDX As Integer
        Dim arymax As Integer
        Dim loaded As Boolean
        Dim change As Boolean
        Dim dosort As Boolean
        <VBFixedArray(99)> Dim Key() As Integer
        Dim keymax As Integer
        Public Sub Initialize() 'この構造体のインスタンスを初期化するには、"Initialize()" を呼び出さなければなりません。
            ReDim Key(99)
        End Sub
    End Structure
    'UPGRADE_WARNING: 配列 mJWD で各要素を初期化する必要があります。 詳細については、'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="B97B714D-9338-48AC-B03F-345B617E2B02"' をクリックしてください。
    Private mJWD(100) As wdstring
    Private mJWDmax As Integer
    Private mJReadWriteMode As Boolean 'true =input read  /  false=change write
    Private mHedKeyStr As String
    Private mHedKeyJpn As String
    Private mHedKeyJpnExt As String
    Private mHedKeyEng As String
    Private mUnDoStr As String
    Private mUnDoCur As Integer
    Private mUnDoJWDIndex As Integer
    Private mUnDoTipIndex As Integer
    Private mOldNullHedStr As String
    Private mJishoFileFolder As String
    Private c13 As String
    Private c32 As String
    Private c44 As String
    Private mJishoChgFiles() As String
#End Region

#Region "関数"
    Friend Function ColorChangeFromOutSide_Buttons(ByVal 辞書キーBK As Integer, ByVal 辞書キーFR As Integer) As Boolean
        Dim BK As Color = ⅩColor_from_INT(辞書キーBK)
        Dim FR As Color = ⅩColor_from_INT(辞書キーFR)
        mJiModeChgBtn.BackColor = BK : mJiModeChgBtn.ForeColor = FR
        mJiListBigBtn.BackColor = BK : mJiListBigBtn.ForeColor = FR
        mJiListBigCloseBtn.BackColor = BK : mJiListBigCloseBtn.ForeColor = FR
        mJiEditBtnADD.BackColor = BK : mJiEditBtnADD.ForeColor = FR
        mJiEditBtnDEL.BackColor = BK : mJiEditBtnDEL.ForeColor = FR
        mJiEditBtnCAN.BackColor = BK : mJiEditBtnCAN.ForeColor = FR
        Return True
    End Function
    Friend Function ColorChangeFromOutSide(ByVal 辞書キーUB As Integer, ByVal 辞書キーUF As Integer, ByVal 辞書キーDB As Integer, ByVal 辞書キーDF As Integer) As Boolean
        Dim BK As Color = ⅩColor_from_INT(IIf(ReadMode, 辞書キーDB, 辞書キーUB))
        Dim FR As Color = ⅩColor_from_INT(IIf(ReadMode, 辞書キーDF, 辞書キーUF))
        mJiText.BackColor = BK : mJiText.ForeColor = FR
        mJiList.BackColor = BK : mJiList.ForeColor = FR
        mJiListBig.BackColor = BK : mJiListBig.ForeColor = FR
        Return True
    End Function
    Friend Function aaKBOD_Click_After_NOT_PacopacoMode_tag辞書(ByVal BtnText As String) As Boolean
        If Not mJiEditText.Visible Then Return False
        mJiEditText.SelectedText = BtnText
        qqqqq(mJiEditText.Text)
        'gggint = aaggTextBoxAddStr(mJiEditText, BtnText, False)
        Return True
    End Function
    Friend Function aaKBOD_Click_After(ByVal BtnText As String) As Boolean
        Return (0 <> aaggTextBoxAddStr(mJiText, BtnText, False))
    End Function
    Friend Function aaKCHG_Click_After() As Boolean
        mJiText.Text = ""
        Return True
    End Function
    Private Sub mJiText_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles mJiText.TextChanged
        On Error GoTo errop
        Dim a, max As Integer : Dim h As String : Dim ary() As String = {""}
        '-----------------------------
        Call JishoKomokuNullDel()
        '-----------------------------
        Call zmJiEditText_OnOff(False)

        mJiList.Items.Clear()
        h = mJiText.Text
        If h <> "" Then
            If KeyWordCheck(h) = False Then
                mJiText.Text = ""
            Else
                If JishoWordAryGet(h, ary, max) Then
                    For a = 2 To max
                        mJiList.Items.Add(ary(a))
                    Next
                End If
                If ReadMode = False Then
                    mJiList.Items.Add("*")
                    Call JishokomokuNullOldSet(h, mJiList)
                End If
            End If
        End If
        gggbol = zzmJiListBigBtnSet()
        Exit Sub
errop:
        If Err.Number Then MsgBox(ErrorToString())
        Exit Sub
    End Sub

    Private Function zzmJiListBigBtnSet() As Boolean
        Dim bol As Boolean = ReadMode And (mJiList.ClientRectangle.Height < mJiList.PreferredHeight)
        If bol Then
            With mJiList
                mJiListBigBtn.SetBounds(2 + .Left + .ClientRectangle.Width - mJiListBigBtn.Width, 2 + .Top, 0, 0, BoundsSpecified.Location)
            End With
            'qqqqq(CStr("item count over"))
        End If
        mJiListBigBtn.Visible = bol
        If bol Then mJiListBigBtn.BringToFront()
        Return bol
    End Function

    Friend Function JishoModeCange(ByRef mode As Boolean, ByRef OnStart As Boolean, Optional ByRef rCurBox As System.Windows.Forms.TextBox = Nothing) As Boolean
        On Error GoTo errop
        Dim oldMode As Integer

        If Not OnStart Then
            oldMode = ReadMode
            ReadMode = mode
        End If
        Select Case ReadMode
            Case True 'inp
                If Not rCurBox Is Nothing Then
                    If rCurBox Is mJiText Then
                    ElseIf rCurBox Is mJiEditText Then
                    ElseIf rCurBox.Enabled Then
                        rCurBox.Focus()
                    End If
                End If
            Case False 'add
                mJiText.Focus()
        End Select
        If oldMode <> ReadMode Then Call mJiText_TextChanged(mJiText, New System.EventArgs())
        RaiseEvent JishoModeChange(mode, mJiText, mJiList)
        Exit Function
errop:
        If Err.Number Then MsgBox(ErrorToString())
        Exit Function
    End Function
    Private Function EntryFileHedsByMainHed(ByRef hed As String, ByRef Key() As String) As Boolean
        Key(1) = hed
        Key(2) = ""
        Key(3) = ""
        Select Case hed
            Case "か" : Key(2) = "が"
            Case "き" : Key(2) = "ぎ"
            Case "く" : Key(2) = "ぐ"
            Case "け" : Key(2) = "げ"
            Case "こ" : Key(2) = "ご"
            Case "さ" : Key(2) = "ざ"
            Case "し" : Key(2) = "じ"
            Case "す" : Key(2) = "ず"
            Case "せ" : Key(2) = "ぜ"
            Case "そ" : Key(2) = "ぞ"
            Case "た" : Key(2) = "だ"
            Case "ち" : Key(2) = "ぢ"
            Case "つ" : Key(2) = "づ"
            Case "て" : Key(2) = "で"
            Case "と" : Key(2) = "ど"
            Case "は" : Key(2) = "ば" : Key(3) = "ぱ"
            Case "ひ" : Key(2) = "び" : Key(3) = "ぴ"
            Case "ふ" : Key(2) = "ぶ" : Key(3) = "ぷ"
            Case "へ" : Key(2) = "べ" : Key(3) = "ぺ"
            Case "ほ" : Key(2) = "ぼ" : Key(3) = "ぽ"
        End Select
    End Function
    Private Function EntryFileStrs(ByRef hed As String, ByRef wText As String, ByRef OldOpenTime As String) As Boolean
        Dim Key(3) As String
        Dim a As Short
        Dim w, s, f As String
        Dim flag As Boolean
        EntryFileStrs = False
        Call EntryFileHedsByMainHed(hed, Key)
        flag = False
        For a = 1 To 3
            s = Key(a)
            If s <> "" Then
                f = zJishoFileName(zJishoIndex(s))
                If Ⅹファイルは存在(f) Then
                    Key(a) = f
                    s = Format(FileDateTime(f), cEntryFileTimeFormat)
                    If StrComp(s, OldOpenTime) > 0 Then
                        flag = True
                    ElseIf Ⅹ文を配列から探す(mJishoChgFiles, f) > 0 Then
                        flag = True
                    End If
                End If
            End If
        Next
        If Not flag Then Exit Function 'all no changed
        w = ""
        For a = 1 To 3
            s = ⅩFileTextOpen(Key(a))
            If s <> "" Then w = w & s
        Next
        If w <> "" Then
            wText = w
            OldOpenTime = Format(Now, cEntryFileTimeFormat)
            EntryFileStrs = True
        End If
    End Function
    Private Function JishoFilesChangedClear() As Boolean
        ReDim mJishoChgFiles(0)
    End Function
    Friend Function SaveAllChangedFile() As Boolean
        gggbol = JishoKomokuNullDel()
        Call AllSave()
    End Function
    Friend Property JishoFileFolder() As String
        Get
            JishoFileFolder = mJishoFileFolder
        End Get
        Set(ByVal Value As String)
            If Ⅹフォルダは存在(Value) Then
                mJishoFileFolder = Value
            Else
                MsgBox("辞書フォルダーが見つかりません。" & vbCrLf & vbCrLf & Value)
                mJishoFileFolder = ""
            End If
        End Set
    End Property
    Friend Property ReadMode() As Boolean
        Get
            ReadMode = mJReadWriteMode
        End Get
        Set(ByVal Value As Boolean)
            mJReadWriteMode = Value
        End Set
    End Property
    Private ReadOnly Property Changed() As Boolean
        Get
            Dim a As Integer
            Changed = False
            For a = 1 To mJWDmax
                If mJWD(a).change = True Then
                    Changed = True
                    Exit Property
                End If
            Next
        End Get
    End Property
    Private Function AllSave() As Boolean
        Try
            Dim a As Integer : Dim f As String : Dim Box As New ListBox : Box.Sorted = True
            For a = 1 To mJWDmax
                If mJWD(a).change = True Then
                    f = zJishoSave(a, Box)
                    If f <> "" Then
                        If Ⅹ文を配列から探す(mJishoChgFiles, f) = 0 Then Call Ⅹ文配列に一つの文要素を追加(mJishoChgFiles, 0, f)
                    End If
                End If
            Next
            Box.Dispose()
            Return True
        Catch ex As Exception
            MsgBox("ERROR in AllSave()" & vbCrLf & ex.ToString)
        End Try
    End Function
    Private Function JishoWordAryGet(ByRef hed As String, ByRef ary() As String, ByRef max As Integer) As Boolean
        Dim h As String : Dim ID, c, a, b, stt, x As Integer : Dim s() As String = {""} : Dim nexth As String
        Dim RET As Boolean = False
        max = 0
        ReDim ary(max)
        h = hed
        ID = zJishoCheckAndLoad(VB.Left(h, 1))
        If ID > 0 Then
            'must be keword = h + c44
            stt = zJishoKeyIndexGet("read", ID, h & c44)
            If stt <= mJWD(ID).wDX Then
                If mJReadWriteMode = False Then 'add mode
                    h = h & c44
                    b = Len(h)
                    For a = stt To mJWD(ID).wDX
                        If VB.Left(mJWD(ID).wd(a), b) = h Then
                            max = Ⅹ文をカットして配列にする(mJWD(ID).wd(a), c44, ary)
                            If max > 0 Then RET = True
                            Exit For
                        End If
                    Next
                Else 'input mode
                    nexth = zKyeWordNext(h)
                    max = 1
                    ReDim ary(max)
                    ary(max) = h
                    If Len(h) = 1 Then h = h & c44
                    b = Len(h)
                    For a = stt To mJWD(ID).wDX
                        If Len(mJWD(ID).wd(a)) >= b Then
                            If VB.Left(mJWD(ID).wd(a), b) = h Then
                                x = Ⅹ文をカットして配列にする(mJWD(ID).wd(a), c44, s)
                                If x > 0 Then
                                    RET = True
                                    For c = 2 To x
                                        max = max + 1
                                        ReDim Preserve ary(max)
                                        ary(max) = s(c)
                                    Next
                                End If
                            ElseIf h > nexth Then
                                Exit For
                            End If
                        End If
                    Next
                End If
            End If
        End If
        Return RET
    End Function
    Private Function JishoKomokuChange(ByRef h As String, ByRef w As String) As Boolean
        Dim op, n, ID As Integer
        ID = zJishoIndex(h)
        If ID > 0 And h <> "" And w <> "" Then
            h = h & c44
            n = zJishKomokuIndexforWrite(ID, h, Len(h))
            If n > 0 Then
                op = gcRep
            Else
                op = gcAdd
                If n = 0 Then n = mJWD(ID).wDX + 1 Else n = System.Math.Abs(n)
            End If
            If zJishoKomokuAddRepDel(op, ID, n, w) = False Then Return False
        End If
        Return True
    End Function
    Private Function JishokomokuNullOldSet(ByRef h As String, ByRef lt As System.Windows.Forms.ListBox) As Boolean
        mOldNullHedStr = ""
        If lt.Items.Count = 1 Then
            If Trim(lt.GetItemText(lt.Items(0)) = "*") Then
                mOldNullHedStr = Trim(h)
            End If
        End If
        Return True
    End Function
    Private Function JishoKomokuNullDel() As Boolean
        Dim ID, n As Integer
        Dim RET As Boolean = False
        If mOldNullHedStr <> "" Then
            ID = zJishoIndex(mOldNullHedStr)
            If ID > 0 Then
                If VB.Right(mOldNullHedStr, 1) <> c44 Then mOldNullHedStr = mOldNullHedStr & c44
                n = zJishKomokuIndexforWrite(ID, mOldNullHedStr, Len(mOldNullHedStr))
                If n > 0 Then RET = zJishoKomokuAddRepDel(gcDel, ID, n, "")
            End If
        End If
        mOldNullHedStr = ""
        Return RET
    End Function
    Private Function KeyWordCheck(ByRef h As String) As Boolean
        Dim a, l As Integer
        Dim s, w, c As String
        l = Len(h)
        If l = 0 Then
            Return False
        ElseIf mJReadWriteMode = True And l > 20 Or mJReadWriteMode = False And l > 50 Then
            Return False
        ElseIf InStr(1, mHedKeyStr, VB.Left(h, 1)) = 0 Then
            Return False
        Else
            w = mHedKeyStr & mHedKeyJpnExt
            s = JpnEngCheck(VB.Left(h, 1))
            For a = 2 To l
                c = Mid(h, a, 1)
                If InStr(1, w, c) = 0 Then Return False
                If JpnEngCheck(c) <> s Then Return False
            Next
        End If
        Return True
    End Function
    Private Function JpnEngCheck(ByRef h As String) As String
        'if h = "" then instr() > 0 ......96-5-14
        If InStr(1, mHedKeyJpn & mHedKeyJpnExt, h) > 0 Then
            Return "J"
        Else
            Return "E"
        End If
    End Function
    Private Function zJishoIndex(ByRef hed As String) As Integer
        Dim a, ID As Integer
        Dim h As String
        ID = 0
        If hed <> "" Then
            h = VB.Left(hed, 1)
            For a = 1 To mJWDmax
                If mJWD(a).hed = h Then
                    ID = a
                    Exit For
                End If
            Next
        End If
        Return ID
    End Function
    Private Function zJishokeyIndexSet(ByRef ID As Integer) As Boolean
        Dim b, a, m As Integer
        Dim k As String
        If ID > 0 Then
            If mJWD(ID).loaded = False Then Return False
            m = Len(mHedKeyStr)
            For a = 1 To m
                k = mJWD(ID).hed & Mid(mHedKeyStr, a, 1)
                mJWD(ID).Key(a) = mJWD(ID).wDX + 1
                For b = 1 To mJWD(ID).wDX
                    If VB.Left(mJWD(ID).wd(b), 2) = k Then
                        mJWD(ID).Key(a) = b
                        Return True
                    End If
                Next
            Next
        End If
        Return False
    End Function
    Private Function zJishoKeyIndexGet(ByRef mode As String, ByRef ID As Integer, ByRef keyword As String) As Integer
        Dim k As String
        Dim stt, p As Integer
        'must be keword = h + c44
        stt = 1
        If Len(keyword) > 2 Then
            k = Mid(keyword, 2, 1)
            p = InStr(1, mHedKeyStr, k)
            If p > 0 Then stt = mJWD(ID).Key(p)
            If stt > mJWD(ID).wDX Then
                If mode = "write" Then stt = 0
            End If
        End If
        Return stt
    End Function
    Private Function zJishKomokuIndexforWrite(ByRef ID As Integer, ByRef keyword As String, ByRef keylen As Integer) As Integer
        Dim a, stt As Integer
        'must be keword = h + c44
        stt = zJishoKeyIndexGet("write", ID, keyword)
        For a = stt To mJWD(ID).wDX
            If VB.Left(mJWD(ID).wd(a), keylen) = keyword Then
                Return a
            End If
        Next
        For a = stt To mJWD(ID).wDX
            If VB.Left(mJWD(ID).wd(a), keylen) > keyword Then
                Return -a
            End If
        Next
        Return 0
    End Function
    Private Function zJishoKomokuAryAddDel(ByRef op As Integer, ByRef ID As Integer) As Boolean
        'Public Const gcReset
        'Public Const gcAdd
        'Public Const gcDel
        Select Case op
            Case gcReset
                With mJWD(ID)
                    .wDX = 0
                    .arymax = 0
                    ReDim .wd(0)
                    .hed = Trim(Mid(mHedKeyStr, ID, 1))
                    .loaded = False
                    .change = False
                    .dosort = False
                    .keymax = 0
                    .Initialize()
                End With
            Case gcAdd
                If mJWD(ID).wDX > mJWD(ID).arymax Then
                    mJWD(ID).arymax = mJWD(ID).arymax + 50
                    ReDim Preserve mJWD(ID).wd(mJWD(ID).arymax)
                End If
            Case gcDel
                If mJWD(ID).wDX <= mJWD(ID).arymax - 50 Then
                    mJWD(ID).arymax = mJWD(ID).arymax - 50
                    ReDim Preserve mJWD(ID).wd(mJWD(ID).arymax)
                End If
        End Select
        Return True
    End Function
    Private Function zJishoKomokuAddRepDel(ByRef op As Integer, ByRef ID As Integer, ByRef n As Integer, ByRef w As String) As Boolean
        'Public Const gcAdd
        'Public Const gcDel
        'Public Const gcRep
        On Error GoTo errop
        Dim a As Integer
        If n < 1 Or n > mJWD(ID).wDX + 1 Then Return False
        mUnDoStr = ""
        mUnDoCur = 0
        mUnDoJWDIndex = 0
        mUnDoTipIndex = 0
        Select Case op
            Case gcAdd
                mJWD(ID).wDX = mJWD(ID).wDX + 1
                Call zJishoKomokuAryAddDel(gcAdd, ID)
                For a = mJWD(ID).wDX - 1 To n Step -1
                    mJWD(ID).wd(a + 1) = mJWD(ID).wd(a)
                Next
                mJWD(ID).wd(n) = w
                mJWD(ID).dosort = True
            Case gcRep
                mUnDoStr = mJWD(ID).wd(n)
                mUnDoJWDIndex = ID
                mUnDoTipIndex = n
                mJWD(ID).wd(n) = w
            Case gcDel
                For a = n To mJWD(ID).wDX - 1
                    mJWD(ID).wd(a) = mJWD(ID).wd(a + 1)
                Next
                mJWD(ID).wDX = mJWD(ID).wDX - 1
                Call zJishoKomokuAryAddDel(gcDel, ID)
        End Select
        If op <> gcRep Then Call zJishokeyIndexSet(ID)
        mJWD(ID).change = True
        Return True
errop:
        Return False
    End Function
    Private Function zJishoFileName(ByRef ID As Integer) As String
        If ID > 0 Then
            Return Ⅹパスセパレータ付加(JishoFileFolder) & cStdJishoName & "-" & mJWD(ID).hed & ".txt"
        End If
        Return ""
    End Function
    Private Function zJishoCheckAndLoad(ByRef hed As String) As Integer
        On Error GoTo errop
        'Dim a As Integer
        Dim ID As Integer
        ID = zJishoIndex(hed)
        If ID = 0 Then Return 0
        If mJWD(ID).loaded = False Then
            Dim f As String = zJishoFileName(ID)
            If f <> "" Then
                If Len(Dir(f, 0)) > 2 Then
                    Cursor.Current = Cursors.WaitCursor
                    mJWD(ID).wDX = 0
                    ReDim mJWD(ID).wd(0)
                    Dim rwAry() As String = {""}
                    Dim m As Integer = ⅩFileTextOpenSave(1, 1, f, rwAry)
                    Dim w As String
                    For a As Integer = 1 To m
                        w = rwAry(a)
                        If VB.Left(w, 1) = hed Then
                            mJWD(ID).wDX = mJWD(ID).wDX + 1
                            If mJWD(ID).wDX > mJWD(ID).arymax Then
                                Call zJishoKomokuAryAddDel(gcAdd, ID)
                            End If
                            mJWD(ID).wd(mJWD(ID).wDX) = w
                        End If
                    Next
                    mJWD(ID).loaded = True
                    Call zJishokeyIndexSet(ID)
                    Cursor.Current = Cursors.Default
                End If
            End If
        End If
        Return ID
errop:
        Reset()
        Cursor.Current = Cursors.Default
        MsgBox(ErrorToString())
        Return 0
    End Function
    Private Function zJishoSave(ByRef ID As Integer, ByRef lst As System.Windows.Forms.ListBox) As String
        On Error GoTo errop
        Dim p, a, l As Integer : Dim h, fb, w As String : Dim bf As String
        Dim f As String = ""
        Dim RET As String = ""
        If ID < 1 Then Return ""
        If mJWD(ID).change = True Then 'DO SAVE
            If mJWD(ID).dosort = True Then
                If mJWD(ID).wDX > 0 Then
                    'qqqqq(mJWD(ID).wd(1))
                    lst.Items.Clear()
                    For a = 1 To mJWD(ID).wDX
                        lst.Items.Add(mJWD(ID).wd(a))
                    Next
                    lst.Refresh()
                    For a = 0 To lst.Items.Count - 1
                        mJWD(ID).wd(a + 1) = aaggリストボックスのテキスト(lst, a) ' lst.GetItemText(lst.Items(a).text) '  VB6.GetItemString(lst, a) 
                    Next
                    lst.Items.Clear()
                End If
                mJWD(ID).dosort = False
            End If
            '---------------------------------------------
            bf = New String(c32, cJishoFileMaxLen + 2000)
            p = 1
            h = "■分類項目 ＝ " & mJWD(ID).hed & c13
            h = h & "■項目数 ＝ " & Format(mJWD(ID).wDX, "00000") & c13
            h = h & "■バイト数 ＝ " & Format(0, "00000") & c13
            h = h & "■最終更新 ＝ " & Format(Now, Format最終更新) & c13
            l = Len(h)
            Mid(bf, p, l) = h
            p = p + l
            '-----------------------------------
            For a = 1 To mJWD(ID).wDX
                w = mJWD(ID).wd(a) & vbCrLf
                l = Len(w)
                Mid(bf, p, l) = w
                p = p + l
                If p > cJishoFileMaxLen Then GoTo Sizeover
            Next
            bf = Trim(bf)
            w = Format(Len(bf), "00000")
            p = InStr(1, bf, "■バイト数 ＝ ")
            If p > 0 And p < 200 Then Mid(bf, p + 8, 5) = w
            '-----------------------------------
            f = zJishoFileName(ID)
            If f <> "" Then
                If Len(Dir(f, 0)) > 3 Then
                    fb = Ⅹパスセパレータ付加(JishoFileFolder) & cHedBackFile & Ⅹフルパス名からファイル名あるいは最後のフォルダ名を得る(f, True)
                    fb = fb & Format(Now, cBackFileAddFormat) & Ⅹファイル拡張子(f, True)
                    FileCopy(f, fb)
                End If
                If ⅩFileTextSave(f, bf) = True Then
                    mJWD(ID).change = False
                    RET = f
                End If
            End If
            bf = ""
        End If
        Return RET
Sizeover:
        w = "辞書ファイルのサイズが" & c13 & Format(cJishoFileMaxLen \ 1000) & "Ｋ文字を超えています" & c13
        w = w & f & c13 & "は保存できません"
        a = MsgBox(w, 48, "辞書ファイルサイズオーバー")
        Return ""
errop:
        Reset()
        MsgBox(ErrorToString())
        Return ""
    End Function
    Private Function zKyeWordNext(ByRef keyword As String) As String
        Dim a As Integer : Dim w, s, kw, ww As String
        s = JpnEngCheck(VB.Left(keyword, 1))
        If Len(keyword) < 2 Then
            Select Case s
                Case "J"
                    w = "ぁ"
                Case Else
                    w = "Ａ"
            End Select
            Return keyword & w
        Else
            kw = VB.Right(keyword, 1)
            Select Case s
                Case "J"
                    w = "ー"
                    a = InStr(1, "あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわをん", kw)
                    If a = 0 Then
                        a = InStr(1, "ぁぃぅぇぉがぎぐげござじずぜぞだぢづでど□□□□□ばびぶべぼ□□□□□ゃゅょ", kw)
                        If a = 0 Then
                            a = InStr(1, "□□□□□□□□□□□□□□□□□っ□□□□□□□ぱぴぷぺぽ", kw)
                        End If
                    End If
                    If a > 0 Then
                        w = Mid("ぃぅぇぉかきくけこさしすせそたちってとなにぬねのはひふへほまみむめもゃゅょらりるれろわをんん", a, 1)
                    End If
                Case Else
                    w = "z"
            End Select
            ww = keyword
            Mid(ww, Len(ww), 1) = w
            Return ww
        End If
    End Function
    Private Sub Jisho_Initialize()
        '-----------------------------
        JishoFileFolder = 絶対パス_PacoCOM辞書_Folder()
        '-----------------------------
        Call JishoFilesChangedClear()
        c13 = vbCrLf
        c32 = " "
        c44 = ","
        '-----------------------------
        Dim s As String
        s = ""
        s = s & "あいうえおかきくけこ"
        s = s & "がぎぐげごさしすせそ"
        s = s & "ざじずぜぞたちつてと"
        s = s & "だぢづでどなにぬねの"
        s = s & "はひふへほばびぶべぼ"
        s = s & "ぱぴぷぺぽまみむめも"
        s = s & "やゆよらりるれろわん"
        mHedKeyJpn = s
        mHedKeyJpnExt = "ーをぁぃぅぇぉゃゅょっ"
        s = ""
        s = s & "ＡＢＣＤＥＦＧＨＩＪ"
        s = s & "ＫＬＭＮＯＰＱＲＳＴ"
        s = s & "ＵＶＷＸＹＺ"
        mHedKeyEng = s
        mHedKeyStr = mHedKeyJpn & mHedKeyEng
        mJWDmax = Len(mHedKeyStr)
        Dim a As Integer
        For a = 1 To mJWDmax
            Call zJishoKomokuAryAddDel(gcReset, a)
        Next
        'Debug.Print "CofJisho--Form_Initialize"
    End Sub
#End Region

#End Region

#Region "辞書の編集　 mJiList / mJiEditText"
    Private Sub mJiList_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles mJiList.MouseDown
        mJiList.Refresh() '2023/11/30 add  ??????????
        gggbol = Ⅹマウスイベント検査2023(gcoMsDown, e)
    End Sub
    Private Sub mJiList_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles mJiList.MouseUp
        If Ⅹマウスイベント検査2023(gcoMsUp, e) Then Call zmJiList_MouseUp(e.Button)
    End Sub
    Private Sub mJiList_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles mJiList.Resize
        If mJiEditText.Visible Then Call zmJiEditText_OnOff(False)
    End Sub
    Private Sub mJiList_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles mJiList.SelectedIndexChanged
        If mJiList.SelectedIndex >= 0 Then
            Call zmJiEditText_OnOff(False)
            mJiListKWD_Click = True
        End If
        'Dim ccc As Control.ControlCollection
        'ccc = mJiList.Controls
        'For a As Integer = 0 To ccc.Count - 1
        '    qqqqq(ccc.Item(a).ToString)
        'Next
    End Sub

    Private Sub mJiEditBtnADD_LocationChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles mJiEditBtnADD.LocationChanged
        ' '' ''2023/12/09 !!!!!! ボタンやテキストが、リストのスクロールで、表示描画がエラーになるので、その対策のコード
        Static mTopIndex As Integer
        If Not mJiEditText.Visible Then Return
        'qqqqq("mJiEditBtnADD_LocationChanged")
        With mJiList
            Dim m As Integer = .ItemHeight * (.SelectedIndex - .TopIndex)
            'qqqqq(CStr(.ItemHeight))
            'qqqqq(CStr(m) & ",  " & CStr(mJiEditText.Top))
            If m <> mJiEditText.Top Then
                If mJiEditText.Visible Then
                    Call zmJiEditText_OnOff(False)
                    mJiList.Refresh()
                    'qqqqq("mJiEditBtnADD_LocationChanged ******")
                    If mTopIndex <> .TopIndex Then
                        mTopIndex = .TopIndex
                        mJiList.Invalidate()
                        'qqqqq("mJiEditBtnADD_LocationChanged **************")
                    End If
                End If
            End If
        End With
    End Sub

    Private Sub zmJiList_MouseUp(ByRef Button As MouseButtons)
        Dim s As String
        Dim n As Integer
        If Button = MouseButtons.Right Then
            If ReadMode Then
                RaiseEvent JishoListClick(vbCrLf, -1)
            End If
            Return
        End If
        If mJiListKWD_Click And Button = MouseButtons.Left Then
            If ReadMode Then
                n = mJiList.SelectedIndex
                s = aaggリストボックスのテキスト(mJiList, n)
                If s <> "" Then
                    ''2023/10/31 中止 ************************************************
                    ''使用したアイテムを、リストの先頭に移す、、、
                    'With mJiList
                    '    .Items.RemoveAt(n) : .Items.Insert(0, s)
                    'End With
                    ''****************************************************************
                    RaiseEvent JishoListClick(s, n)
                End If
            Else
                n = mJiList.SelectedIndex
                If n >= 0 Then
                    Try
                        If mJiEditText.Visible Then
                            Call zmJiEditText_OnOff(False)
                            mJiList.Refresh()
                            'qqqqq("mJiEditText.Visible")
                        End If
                        Dim rcgl As Rectangle = mJiList.GetItemRectangle(n)
                        With mJiEditText
                            .Text = c44 'do event text change
                            .SetBounds(rcgl.Left, rcgl.Top, rcgl.Width, rcgl.Height, BoundsSpecified.All)
                            .Visible = True
                            .BringToFront()
                            s = Trim(aaggリストボックスのテキスト(mJiList, mJiList.SelectedIndex))
                            If s <> "*" Then .Text = s Else .Text = ""
                            mJiEditText.Focus()
                        End With
                        Call zmJiEditText_OnOff(True)
                    Catch ex As Exception
                    End Try
                    'qqqqq("zmJiList_MouseUp_EditShow")
                End If
            End If
        ElseIf CInt(Button) = 100 Then
            If mJiText.Enabled Then Call JishoModeCange(Not ReadMode, False)
        End If
        mJiListKWD_Click = False
        Exit Sub
    End Sub
    Private Function zmJiEditText_OnOff(ByRef mJiEditTextVisible As Boolean) As Boolean
        Dim y, w, h, w3 As Integer
        mJiEditText.Visible = mJiEditTextVisible
        If mJiEditTextVisible Then
            With mJiEditText
                y = .Bottom
                w = .Width \ 3
                h = .Height + 12     ''''????
                w3 = .Width - w - w
                If y + h > mJiList.ClientRectangle.Height Then
                    y = .Top - h
                End If
            End With
            mJiEditBtnADD.SetBounds(0, y, w, h, BoundsSpecified.All)
            mJiEditBtnDEL.SetBounds(w, y, w, h, BoundsSpecified.All)
            mJiEditBtnCAN.SetBounds(w + w, y, w3, h, BoundsSpecified.All)
        Else
            mJiEditText.Top = -100
            mJiEditBtnADD.Top = -100
            mJiEditBtnDEL.Top = -100
            mJiEditBtnCAN.Top = -100
        End If
        mJiEditBtnADD.Visible = mJiEditTextVisible
        mJiEditBtnDEL.Visible = mJiEditTextVisible
        mJiEditBtnCAN.Visible = mJiEditTextVisible
        If Not mJiEditTextVisible Then
            mJiText.Refresh() : mJiText.Focus()
        End If
    End Function
    Private Sub mJiModeChgBtn_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mJiModeChgBtn.Click
        Call zmJiList_MouseUp(100)
    End Sub
    Private Sub mJiEditBtnADD_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mJiEditBtnADD.Click
        Call mJiEditbtns_Click(0)
    End Sub
    Private Sub mJiEditBtnDEL_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mJiEditBtnDEL.Click
        Call mJiEditbtns_Click(1)
    End Sub
    Private Sub mJiEditBtnCAN_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mJiEditBtnCAN.Click
        Call mJiEditbtns_Click(2)
    End Sub
    Private Function mJiEditbtns_Click(ByVal Index As Integer) As Boolean
        On Error GoTo errop
        Dim a As Integer : Dim eAdd, eDel As Boolean : Dim w, h, s As String
        Select Case Index
            Case 0, 1 '追加 / 削除
                ''*********************************************************
                '2024/03/09 　　mJiEditText.ImeMode <> ImeMode.Off　　謎の遅延 ....　は解決した。
                ''*********************************************************
                'Private Sub mJiEditText_TextChanged(....) 　内に
                'If mJiEditText.ImeMode <> Windows.Forms.ImeMode.Off Then
                '    If mJiEditBtnADD.Enabled Then mJiEditBtnADD.Focus()
                'End If
                'を追加した。
                ''*********************************************************
                Call zKbxTipTxtTextCheck(eAdd, eDel)
                If (Index = 0 And eAdd = False) Or (Index = 1 And eDel = False) Then GoTo errop1
                Select Case Index
                    Case 0
                        s = VB.Left(mJiEditText.Text, 100)
                        s = ⅩStrChgOldStrNewStr(s, vbCrLf, "~")
                        s = ⅩStrChgOldStrNewStr(s, ",", "、")
                        mJiList.Items.Insert(mJiList.SelectedIndex, s) 'add
                    Case 1
                        mJiList.Items.RemoveAt(mJiList.SelectedIndex) 'del
                End Select
                h = Trim(mJiText.Text)
                w = h & c44
                For a = 0 To mJiList.Items.Count - 1
                    s = Trim(aaggリストボックスのテキスト(mJiList, a))
                    If s <> "*" Then w = w & aaggリストボックスのテキスト(mJiList, a) & c44
                Next
                If JishoKomokuChange(h, w) = False Then Exit Function
                Call JishokomokuNullOldSet(h, mJiList)
            Case 2 '取消
                'nop
        End Select
        Call zmJiEditText_OnOff(False)
        Return True
errop1:
        Beep()
        Return False
errop:
        Cursor.Current = Cursors.Default
        If Err.Number Then MsgBox("""mJiEditbtns_Click"" でエラー" & vbCrLf & Err.Description)
        Return False
    End Function
    Private Function zKbxTipTxtTextCheck(ByRef eAdd As Boolean, ByRef eDel As Boolean) As Boolean
        Dim s As String
        s = Trim(mJiEditText.Text)
        If s = "" Or s = "*" Or InStr(s, "*") > 0 Or InStr(s, c44) > 0 Then
            eAdd = False
            eDel = False
        Else
            If mJiList.FindStringExact(s) = ListBox.NoMatches Then eAdd = True Else eAdd = False
            If s = aaggリストボックスのテキスト(mJiList, mJiList.SelectedIndex) Then eDel = True Else eDel = False
        End If
        Return True
    End Function
    Private Sub mJiListBig_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles mJiListBig.MouseDown
        gggbol = Ⅹマウスイベント検査2023(gcoMsDown, e)
    End Sub
    Private Sub mJiListBig_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles mJiListBig.MouseUp
        If Ⅹマウスイベント検査2023(gcoMsUp, e) Then
            If e.Button = MouseButtons.Right Then
                RaiseEvent JishoListClick(vbCrLf, -1)  '改行を出力
            End If
        End If
    End Sub
    Private Sub mJiListBigBtn_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mJiListBigBtn.Click
        With mJiListBig
            .Font = mJiList.Font
            .Items.Clear()
            .Items.Add(" ") : .Items.Add(" ") : .Items.Add(" ")
            For a As Integer = 0 To mJiList.Items.Count - 1
                .Items.Add(mJiList.Items(a))
            Next
            .Visible = True
            Call mJiListBig_Resize(Nothing, Nothing)
            RaiseEvent JishoListBIG_ShowHide(True)
        End With
    End Sub
    Private Sub mJiListBig_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles mJiListBig.Resize
        With mJiListBig
            If Not .Visible Then Return
            Dim y As Integer = mJiText.Top
            Dim w As Integer = mJiListBig.Parent.ClientRectangle.Width
            Dim h As Integer = mJiListBig.Parent.ClientRectangle.Height - y
            With mJiListBig
                .SetBounds(0, y, w, h, BoundsSpecified.All)
            End With
            Dim n As Integer = 1 + (.Items.Count + 5) \ (.ClientRectangle.Height \ .ItemHeight)
            'qqqqq(CStr(n))
            Dim fs As Integer = .Font.Size
            .ColumnWidth = Ⅹ数値範囲Int(fs * 6, fs * 20, .ClientRectangle.Width \ n)
            mJiListBigCloseBtn.SetBounds(2 + 0, 2 + y, .ColumnWidth * 0.8, .ItemHeight * 2, BoundsSpecified.All)
            mJiListBig.Visible = True : mJiListBigCloseBtn.Visible = True
            mJiListBig.BringToFront() : mJiListBigCloseBtn.BringToFront()
        End With
    End Sub
    Private Sub mJiListBig_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mJiListBig.Click
        Dim s As String
        Dim n As Integer
        n = mJiListBig.SelectedIndex
        s = aaggリストボックスのテキスト(mJiListBig, n)
        If s <> "" Then
            RaiseEvent JishoListClick(s, n)
        End If
    End Sub
    Private Sub mJiListBigCloseBtn_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mJiListBigCloseBtn.Click
        mJiListBig.Visible = False
        mJiListBigCloseBtn.Visible = False
        RaiseEvent JishoListBIG_ShowHide(False)
    End Sub

    Private Sub mJiEditText_ImeModeChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles mJiEditText.ImeModeChanged
        'qqqqq("mJiEditText_ImeModeChanged")
    End Sub

    Private Sub mJiEditText_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles mJiEditText.TextChanged
        Dim eAdd, eDel As Boolean
        If mJiEditText.Visible Then
            Call zKbxTipTxtTextCheck(eAdd, eDel)
            mJiEditBtnADD.Enabled = eAdd
            mJiEditBtnDEL.Enabled = eDel
        End If
        If mJiEditText.ImeMode <> Windows.Forms.ImeMode.Off Then
            If mJiEditBtnADD.Enabled Then mJiEditBtnADD.Focus()
        End If
    End Sub
#End Region

#Region "それぞれのユーザーアプリのグローバルモジュールで設定が必要"
    '    Friend Function 絶対パス_AppPathCurSubFolder(ByVal rSubFolderName As String) As String
    '        Dim sAppPathyy As String = Ⅹパスセパレータ付加(ⅩAppフォルダ名())
    '        '2023/11/15  アプリの開発環境での設定により、デバッグモードの実行ファイルの位置が変わりうるので、相対パスの設定に注意が必要。
    '        '★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
    '        '★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
    '#If DEBUG Then
    '        Return sAppPathyy & "..\..\" & rSubFolderName
    '#Else
    '            Return sAppPathyy & rSubFolderName
    '#End If
    '        '★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
    '        '★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
    '        '2023/11/15  アプリの開発環境での設定により、デバッグモードの実行ファイルの位置が変わりうるので、相対パスの設定に注意が必要。
    '        ''-----------------------------
    '        'Return sAppPathyy & rSubFolderName
    '        ''-----------------------------
    '    End Function
#End Region


End Class


