Imports System
Imports System.Drawing
Imports System.Windows.Forms
Public Class PaintToolBar
    '¦¹Ãþ§O©w¸qÃö©ó¤u¨ã¦C¥~Æ[¤Î¦æ¬°

    Inherits PaintWithRegistry

    Protected ToolBarCommand As Integer = 7             '¨Ï¥ÎªÌ¤u¨ã¦C©R¥O¿ï¾Ü
    Protected LastCommand As Integer                    '¤W¤@­Ó©R¥O
    Protected pnToolbar As Panel                        '¤u¨ã¦C
    Protected radbtnToolbar(15) As NoFocusRadbtn        '¤u¨ã¦C¥\¯à
    Sub New()
        '¤u¨ã¦C«Øºc¤¸
        Dim tx, coly, sy As Integer
        If bToolbar Then tx = 60 Else tx = 0
        If bColorbar Then coly = 50 Else coly = 0
        If bStatusbar Then sy = 22 Else sy = 0

        pnToolbar = New Panel
        With pnToolbar
            .Parent = Me
            .BorderStyle = BorderStyle.None
            .Location = New Point(0, 0)
            .Size = New Size(60, ClientSize.Height - coly - sy)
        End With

        Dim TotTool As New ToolTip
        Dim strTotTool() As String = {"¿ï¾Ü¥ô·N½d³ò", "¿ï¾Ü", "¾ó¥ÖÀ¿/±m¦â¾ó¥ÖÀ¿", "¶ñ¤J¦â±m", _
                                      "¬D¿ïÃC¦â", "©ñ¤jÃè", "¹]µ§", "¯»¨ê", "¼Qºj", "¤å¦r", _
                                      "ª½½u", "¦±½u", "¯x§Î", "¦hÃä§Î", "¾ò¶ê§Î", "¶ê¨¤¯x§Î"}

        Dim i, cx As Integer
        For i = 0 To 15
            radbtnToolbar(i) = New NoFocusRadbtn
            With radbtnToolbar(i)
                .Name = (i + 1).ToString
                .Parent = pnToolbar
                .Appearance = Appearance.Button
                .Size = New Size(26, 26)
                .Image = New Bitmap(Me.GetType(), "toolbutton" & (i + 1).ToString & ".bmp")
                If (i + 1) Mod 2 <> 0 Then cx = 3 Else cx = 29
                .Location = New Point(cx, (i \ 2) * 26)
            End With
            TotTool.SetToolTip(radbtnToolbar(i), strTotTool(i))
            AddHandler radbtnToolbar(i).MouseEnter, AddressOf ToolbarHelp
            AddHandler radbtnToolbar(i).MouseLeave, AddressOf ToolbarHelpLeave
            AddHandler radbtnToolbar(i).Click, AddressOf ToolbarRadbtnSelect
        Next i
        radbtnToolbar(6).Checked = True
        pnWorkarea.Cursor = New Cursor(Me.GetType(), "Pen.cur")

    End Sub
    Protected Overrides Sub FormSizeChanged(ByVal obj As Object, ByVal ea As EventArgs)
        '©w¸q¦]µøÄ±¤¸¥óÅÜ§ó(¤u¨ã¦C,¦â¶ô°Ï)¤u¨ã¦C®y¼Ð°t¸m
        MyBase.FormSizeChanged(obj, ea)

        Dim tx, cy, sy As Integer
        If bColorbar Then cy = 50 Else cy = 0
        If bStatusbar Then sy = 22 Else sy = 0

        pnToolbar.Size = New Size(60, ClientSize.Height - cy - sy)
    End Sub
    Protected Overridable Sub ToolbarHelp(ByVal obj As Object, ByVal ea As EventArgs)
        '·í·Æ¹«²¾¦Ü¤u¨ã¦C¤¸¥ó¤W®É,Åã¥Ü¸Ó¤¸¥ó¦bª¬ºA¦Cªº¸ê°T.¥Ñ PaintStatusbar ÂÐ¼g
    End Sub
    Protected Overridable Sub ToolbarHelpLeave(ByVal obj As Object, ByVal ea As EventArgs)
        '·í·Æ¹«²¾¥X¤u¨ã¦C¤¸¥ó®É,Åã¥Ü¸Ó¤¸¥ó¦bª¬ºA¦Cªº¸ê°T.¥Ñ PaintStatusbar ÂÐ¼g
    End Sub
    Protected Overridable Sub ToolbarRadbtnSelect(ByVal obj As Object, ByVal ea As EventArgs)
        '©w¸q·í¨Ï¥ÎªÌ¿ï¾Ü¤u¨ã¦C¤¸¥ó®É,©Ò²£¥Íªº¦æ¬°
        Dim radbtnSelect As NoFocusRadbtn = DirectCast(obj, NoFocusRadbtn)

        LastCommand = ToolBarCommand               '¨ú±o¤W¤@­Ó¥\¯à

        ToolBarCommand = CInt(radbtnSelect.Name)   '¨ú±o¨Ï¥ÎªÌ©Ò¿ï¾Üªº¥\¯à
        Dim CursorName As String
        Select Case ToolBarCommand
            Case 1, 2, 10, 11, 12, 13, 14, 15, 16
                CursorName = "Cross.cur"
            Case 3
                CursorName = "Null.cur"
            Case 4
                CursorName = "FillColor.cur"
            Case 5
                CursorName = "Color.cur"
            Case 6
                CursorName = "ZoomSet.cur"
            Case 7
                CursorName = "Pen.cur"
            Case 8
                CursorName = "Brush.cur"
            Case 9
                CursorName = "Spray.cur"
        End Select
        pnWorkarea.Cursor = New Cursor(Me.GetType(), CursorName)
        '³o¨ì¥Ø«e¬°¤î,¶È©w¸q¤F,¹ïÀ³©óÃ¸¹Ï¤u§@°Ïªº¹C¼ÐÅã¥Ü,¥D­nªº±±¨î¬yµ{,¥Ñ OverridesÂÐ¼g
    End Sub
End Class
