Option Strict Off
Option Explicit On
Imports Microsoft.VisualBasic.PowerPacks
Friend Class DoorDecorationGraphicInfoEditor
	Inherits System.Windows.Forms.Form
	
	'UPGRADE_WARNING: Arrays can't be declared with New. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="CC9D3AE5-6B95-4B43-91C7-28276302A5E8"'
    Private doordecorationgroups(,) As decorationinfo = ADGEDotNetUt.ArrayUt(Of decorationinfo).NewArray2(4, 3)
	Private doordecorationnumbers(12) As Byte
	Public selectedgroup As Short
	Public selectedlocation As Short
	Public selecteddecoration As Integer
	Public selecteddoor As Integer
	'Public selectedsublocation As Integer
	Public subchange As Boolean
	Public subclickchange As Boolean
	Public selectedimage As Short
	Public tracking As Boolean
	Public savedx As Short
	Public savedy As Short
	Public savedw As Short
	Public savedh As Short
	Private doorlocscenter(3, 2) As Short
	
	'UPGRADE_NOTE: graphics was upgraded to graphics_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A9E4979A-37FA-4718-9994-97DD76ED70A7"'
    Public Sub returnCustomPaletteEditor(ByRef window As CustomPaletteEditor)
        Dim i As Short

        For i = 1 To 16
            'UPGRADE_WARNING: Couldn't resolve default property of object graphics.f558. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            graphics.f558.setd2doordecorationpalette(i, window.getd2palette(i))
            'UPGRADE_WARNING: Couldn't resolve default property of object graphics.f558. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            graphics.f558.setd3doordecorationpalette(i, window.getd3palette(i))
        Next
        update_Renamed()
    End Sub
	'UPGRADE_NOTE: graphics was upgraded to graphics_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A9E4979A-37FA-4718-9994-97DD76ED70A7"'
	'UPGRADE_NOTE: mapfile was upgraded to mapfile_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A9E4979A-37FA-4718-9994-97DD76ED70A7"'
    Public Sub init()
        Dim j As Short
        Dim i As Short


        'graphics.resetmodifiedcolorarray
        'CeilingGraphic.Picture = graphics.loadgraphic(77, 0)
        'Floorgraphic.Picture = graphics.loadgraphic(76, 0)

        'graphics.curPalette = graphics.gPALETTE_MAIN
        'graphics.fill Graphic.hdc, 0, 0, Graphic.width, Graphic.height, vbBlack
        'graphics.stretchbmpby Graphic.hdc, 76, 0, 0, 0, 0, 200, 200
        'graphics.stretchbmpby Graphic.hdc, 75, 0, 132, 0, 0, 200, 200
        'Graphic.Refresh

        'grect 71 : d3 x,y coordinates
        'UPGRADE_WARNING: Couldn't resolve default property of object graphics.f558. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
        doorlocscenter(1, 1) = graphics.f558.graphicrect(71).x1
        'UPGRADE_WARNING: Couldn't resolve default property of object graphics.f558. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
        doorlocscenter(1, 2) = graphics.f558.graphicrect(71).y1
        'grect 41 : d2 x,y coordinates
        'UPGRADE_WARNING: Couldn't resolve default property of object graphics.f558. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
        doorlocscenter(2, 1) = graphics.f558.graphicrect(41).x1
        'UPGRADE_WARNING: Couldn't resolve default property of object graphics.f558. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
        doorlocscenter(2, 2) = graphics.f558.graphicrect(41).y1
        'grect 11 : d1 x,y coordinates
        'UPGRADE_WARNING: Couldn't resolve default property of object graphics.f558. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
        doorlocscenter(3, 1) = graphics.f558.graphicrect(11).x1
        'UPGRADE_WARNING: Couldn't resolve default property of object graphics.f558. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
        doorlocscenter(3, 2) = graphics.f558.graphicrect(11).y1


        CGGroupList.Items.Clear()
        CGGroupList.Items.Add("00").SubItems.Add("Group 0")
        CGGroupList.Items.Add("01").SubItems.Add("Group 1")
        CGGroupList.Items.Add("02").SubItems.Add("Group 2")
        CGGroupList.Items.Add("03").SubItems.Add("Group 3")

        CGDoorList.Items.Clear()
        CGDoorList.Items.Add("00").SubItems.Add("Porticullas")
        CGDoorList.Items.Add("01").SubItems.Add("Wooden")
        CGDoorList.Items.Add("02").SubItems.Add("Iron")
        CGDoorList.Items.Add("03").SubItems.Add("Ra")

        CGLocationList.Items.Clear()
        CGLocationList.Items.Add("00").SubItems.Add("D3 Center")
        CGLocationList.Items.Add("01").SubItems.Add("D2 Center")
        CGLocationList.Items.Add("02").SubItems.Add("D1 Center")

        'CGSubLocationList.Clear
        'CGSubLocationList.AddItem
        'CGSubLocationList.List(0, 0) = "00"
        'CGSubLocationList.List(0, 1) = "Far Left"
        'CGSubLocationList.AddItem
        'CGSubLocationList.List(1, 0) = "01"
        'CGSubLocationList.List(1, 1) = "Far Right"
        'CGSubLocationList.AddItem
        'CGSubLocationList.List(2, 0) = "02"
        'CGSubLocationList.List(2, 1) = "Near Right"
        'CGSubLocationList.AddItem
        'CGSubLocationList.List(3, 0) = "03"
        'CGSubLocationList.List(3, 1) = "Near Left"
        'CGSubLocationList.AddItem
        'CGSubLocationList.List(4, 0) = "04"
        'CGSubLocationList.List(4, 1) = "Center"

        For i = 1 To 4
            For j = 1 To 3
                'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                'UPGRADE_WARNING: Couldn't resolve default property of object graphics.f558. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                doordecorationgroups(i, j).x1 = graphics.f558.doordecorationinfo(i, j).x1
                'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                'UPGRADE_WARNING: Couldn't resolve default property of object graphics.f558. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                doordecorationgroups(i, j).x2 = graphics.f558.doordecorationinfo(i, j).x2
                'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                'UPGRADE_WARNING: Couldn't resolve default property of object graphics.f558. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                doordecorationgroups(i, j).y1 = graphics.f558.doordecorationinfo(i, j).y1
                'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                'UPGRADE_WARNING: Couldn't resolve default property of object graphics.f558. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                doordecorationgroups(i, j).y2 = graphics.f558.doordecorationinfo(i, j).y2
                'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                'UPGRADE_WARNING: Couldn't resolve default property of object graphics.f558. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                doordecorationgroups(i, j).Width = graphics.f558.doordecorationinfo(i, j).Width
                'UPGRADE_WARNING: Couldn't resolve default property of object j. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                'UPGRADE_WARNING: Couldn't resolve default property of object graphics.f558. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                doordecorationgroups(i, j).Height = graphics.f558.doordecorationinfo(i, j).Height
            Next
        Next

        For i = 1 To 12
            'UPGRADE_WARNING: Couldn't resolve default property of object graphics.f558. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            doordecorationnumbers(i) = graphics.f558.doordecorationnumber(i)
        Next
        subchange = True
        selectgroup((1))
        selectlocation((1))
        selectdoor((1))
        'selectsublocation (1)
        subchange = False

        CGDecorationList.Items.Clear()
        For i = 1 To 12
            CGDecorationList.Items.Add(zerostr(i - 1, 2)).SubItems.Add(mapfile.getname(302 + i))
        Next
        CGDecorationList.Items(0).Focused = True

        update_Renamed()
    End Sub
	
    Private Sub Cancel_ClickEvent(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Cancel.Click
        Me.Close()
    End Sub
	
    Private Sub CGDecorationList_SelectedIndexChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles CGDecorationList.SelectedIndexChanged
        If CGDecorationList.FocusedItem Is Nothing Then Exit Sub

        If subchange = True Then
            Exit Sub
        End If

        subchange = True
        selecteddecoration = CGDecorationList.FocusedItem.Index + 1
        selectedimage = 304 + CGDecorationList.FocusedItem.Index

        MyUt.CheckSel(CGDecorationList, CGDecorationList.FocusedItem.Index, "EyeOfTime")

        'If selectedlocation = 1 Then 'd3
        '    For i = 1 To 16
        '        graphics.setmodifiedcolor i, graphics.color((graphics.f558.d3doordecorationpalette(i) / 10) + 1)
        '    Next
        '    offset = 2
        'ElseIf selectedlocation = 2 Then 'd2
        '    For i = 1 To 16
        '        graphics.setmodifiedcolor i, graphics.color((graphics.f558.d2doordecorationpalette(i) / 10) + 1)
        '    Next
        '    offset = 4
        'Else 'd1
        '    graphics.resetmodifiedcolorarray
        '    offset = 0
        'End If

        'DoorDecorationGraphicLeft.Picture = graphics.loadgraphic(selectedimage, offset)
        'DoorDecorationGraphicCenter.Picture = graphics.loadgraphic(selectedimage, offset)
        'DoorDecorationGraphicRight.Picture = graphics.loadgraphic(selectedimage, offset)
        'doordecorationGraphic.Width = doordecorationgroups(selectedlocation).Width * 4
        'doordecorationGraphic.Height = doordecorationgroups(selectedlocation).Height * 2
        selectgroup((doordecorationnumbers(CGDecorationList.FocusedItem.Index + 1) + 1))

        update_Renamed()
        subchange = False
    End Sub
	
    Private Sub CGGroupList_SelectedIndexChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles CGGroupList.SelectedIndexChanged
        If CGGroupList.FocusedItem Is Nothing Then Exit Sub
        If CGDecorationList.FocusedItem Is Nothing Then CGDecorationList.Items(0).Focused = True
        If subchange = True Then
            Exit Sub
        End If
        subchange = True
        doordecorationnumbers(CGDecorationList.FocusedItem.Index + 1) = CGGroupList.FocusedItem.Index
        selectgroup((CGGroupList.FocusedItem.Index + 1))
        subchange = False
    End Sub
    Private Sub CGLocationList_SelectedIndexChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles CGLocationList.SelectedIndexChanged
        If CGLocationList.FocusedItem Is Nothing Then Exit Sub
        If subchange = True Then
            Exit Sub
        End If
        subchange = True
        selectlocation((CGLocationList.FocusedItem.Index + 1))
        subchange = False
    End Sub
    Private Sub CGDoorList_SelectedIndexChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles CGDoorList.SelectedIndexChanged
        If CGDoorList.FocusedItem Is Nothing Then Exit Sub
        If subchange = True Then
            Exit Sub
        End If
        subchange = True
        selectdoor((CGDoorList.FocusedItem.Index + 1))
        subchange = False
    End Sub
	
	'Private Sub CGSubLocationList_Click()
	'
	'    If subchange = True Then
	'        Exit Sub
	'    End If
	'    subchange = True
	'    selectsublocation (CGSubLocationList.ListIndex + 1)
	'    subchange = False
	'End Sub
	
	
	
    Private Sub GLocPointer_MouseDownEvent(ByVal eventSender As System.Object, ByVal eventArgs As MouseEventArgs) Handles GLocPointer.MouseDown

        If eventArgs.Button And Windows.Forms.MouseButtons.Left Then
            tracking = True
            savedx = doordecorationgroups(selectedgroup, selectedlocation).x1
            savedy = doordecorationgroups(selectedgroup, selectedlocation).y1
            savedw = doordecorationgroups(selectedgroup, selectedlocation).x2 - doordecorationgroups(selectedgroup, selectedlocation).x1
            savedh = doordecorationgroups(selectedgroup, selectedlocation).y2 - doordecorationgroups(selectedgroup, selectedlocation).y1
        End If

    End Sub
	
	'Private Sub ImageA_MouseDown(doordecoration As Integer, Shift As Integer, X As Single, Y As Single)
	'
	'    If doordecoration = 2 Then
	'        X = X * 2
	'        X = X / 3
	'        Y = Y * 2
	'        Y = Y / 3
	'
	'        If selectedlocation = 2 Or selectedlocation = 5 Or selectedlocation = 8 Or selectedlocation = 10 Then
	'            X = X + 100
	'        End If
	'        If selectedlocation = 3 Or selectedlocation = 6 Or selectedlocation = 9 Or selectedlocation = 11 Then
	'            X = X - 100
	'        End If
	'
	'        If X > 255 Then
	'            X = 255
	'        End If
	'        If X < 0 Then
	'            X = 0
	'        End If
	'        If Y > 255 Then
	'            Y = 255
	'        End If
	'        If Y < 0 Then
	'            Y = 0
	'        End If
	'
	'
	'
	'        doordecorationgroups(selectedgroup, selectedlocation).setloc selectedsublocation, 1, X
	'        doordecorationgroups(selectedgroup, selectedlocation).setloc selectedsublocation, 2, Y
	'
	'        update
	'        'MsgBox "x=" + Str(X) + " y=" + Str(Y)
	'    End If
	'
	'End Sub
	
	
	
    Private Sub GLocPointer_MouseMoveEvent(ByVal eventSender As System.Object, ByVal eventArgs As MouseEventArgs) Handles GLocPointer.MouseMove
        Dim x2 As Single
        Dim y2 As Single
        If tracking = True Then
            subclickchange = True
#If False Then
            x2 = eventArgs.X * 4
            x2 = x2 / 3
            y2 = eventArgs.y * 4
            y2 = y2 / 3
#Else
            x2 = eventArgs.X
            y2 = eventArgs.Y
#End If
            x2 = x2 - 4
            y2 = y2 - 4
            x2 = x2 / 2
            y2 = y2 / 2

            x2 = x2 + savedx
            y2 = y2 + savedy
            If x2 < 0 Then
                x2 = 0
            End If
            If x2 + savedw > 255 Then
                x2 = 255 - savedw
            End If

            If y2 < 0 Then
                y2 = 0
            End If
            If y2 + savedh > 255 Then
                y2 = 255 - savedh
            End If

            'UPGRADE_WARNING: Couldn't resolve default property of object x2. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            doordecorationgroups(selectedgroup, selectedlocation).x1 = x2
            doordecorationgroups(selectedgroup, selectedlocation).y1 = y2
            doordecorationgroups(selectedgroup, selectedlocation).x2 = doordecorationgroups(selectedgroup, selectedlocation).x1 + savedw
            doordecorationgroups(selectedgroup, selectedlocation).y2 = doordecorationgroups(selectedgroup, selectedlocation).y1 + savedh
            'XCoord.Text = Str(x2)
            'YCoord.Text = Str(y2)

            update_Renamed()
            subclickchange = False
        End If

    End Sub
	
	
    Private Sub GLocPointer_MouseUpEvent(ByVal eventSender As System.Object, ByVal eventArgs As MouseEventArgs) Handles GLocPointer.MouseUp
        tracking = False
        'MsgBox "aasdf"
        update_Renamed()
    End Sub
	
	'UPGRADE_NOTE: graphics was upgraded to graphics_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A9E4979A-37FA-4718-9994-97DD76ED70A7"'
    Private Sub Ok_ClickEvent(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Ok.Click
        Dim i As Integer
        Dim j As Short

        For i = 1 To 4
            For j = 1 To 3
                graphics.f558.doordecorationinfo(i, j).x1 = doordecorationgroups(i, j).x1
                graphics.f558.doordecorationinfo(i, j).x2 = doordecorationgroups(i, j).x2
                graphics.f558.doordecorationinfo(i, j).y1 = doordecorationgroups(i, j).y1
                graphics.f558.doordecorationinfo(i, j).y2 = doordecorationgroups(i, j).y2
                graphics.f558.doordecorationinfo(i, j).Width = doordecorationgroups(i, j).Width
                graphics.f558.doordecorationinfo(i, j).Height = doordecorationgroups(i, j).Height
            Next
        Next
        For i = 1 To 12
            'UPGRADE_WARNING: Couldn't resolve default property of object i. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            'UPGRADE_WARNING: Couldn't resolve default property of object graphics.f558. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            graphics.f558.setdoordecorationnumber(i, doordecorationnumbers(i))
        Next
        graphics.f558.update()
        Me.Close()

    End Sub
	Public Sub selectgroup(ByVal num As Short)
		selectedgroup = num
        CGGroupList.Items(num - 1).Focused = True
        MyUt.CheckSel(CGGroupList, num - 1, "Emerald")
		X1Coord.Text = Str(doordecorationgroups(selectedgroup, selectedlocation).x1)
		X2Coord.Text = Str(doordecorationgroups(selectedgroup, selectedlocation).x2)
		Y1Coord.Text = Str(doordecorationgroups(selectedgroup, selectedlocation).y1)
		Y2Coord.Text = Str(doordecorationgroups(selectedgroup, selectedlocation).y2)
		GWidth.Text = Str(doordecorationgroups(selectedgroup, selectedlocation).width)
		GHeight.Text = Str(doordecorationgroups(selectedgroup, selectedlocation).height)
		update_Renamed()
	End Sub
	Public Sub selectdoor(ByVal num As Short)
		selecteddoor = num
        CGDoorList.Items(num - 1).Focused = True
        MyUt.CheckSel(CGDoorList, num - 1, "BlueGem")
		update_Renamed()
	End Sub
	
	Public Sub selectlocation(ByVal num As Short)
		selectedlocation = num
        CGLocationList.Items(num - 1).Focused = True
        MyUt.CheckSel(CGLocationList, num - 1, "Topaz")
		X1Coord.Text = Str(doordecorationgroups(selectedgroup, selectedlocation).x1)
		X2Coord.Text = Str(doordecorationgroups(selectedgroup, selectedlocation).x2)
		Y1Coord.Text = Str(doordecorationgroups(selectedgroup, selectedlocation).y1)
		Y2Coord.Text = Str(doordecorationgroups(selectedgroup, selectedlocation).y2)
		GWidth.Text = Str(doordecorationgroups(selectedgroup, selectedlocation).width)
		GHeight.Text = Str(doordecorationgroups(selectedgroup, selectedlocation).height)

		'If selectedlocation = 1 Then 'd3
		'    For i = 1 To 16
		'        graphics.setmodifiedcolor i, graphics.color((graphics.f558.d3doordecorationpalette(i) / 10) + 1)
		'    Next
		'    offset = 2
		'ElseIf selectedlocation = 2 Then 'd2
		'    For i = 1 To 16
		'        graphics.setmodifiedcolor i, graphics.color((graphics.f558.d2doordecorationpalette(i) / 10) + 1)
		'    Next
		'    offset = 4
		'Else 'd1
		'    graphics.resetmodifiedcolorarray
		'    offset = 0
		'End If
		'
		'DoorDecorationGraphicLeft.Picture = graphics.loadgraphic(selectedimage, offset)
		'DoorDecorationGraphicCenter.Picture = graphics.loadgraphic(selectedimage, offset)
		'DoorDecorationGraphicRight.Picture = graphics.loadgraphic(selectedimage, offset)
		update_Renamed()
	End Sub
	
	'Public Sub selectsublocation(ByVal num As Integer)
	'    selectedsublocation = num
	'    CGSubLocationList.ListIndex = num - 1
	'    update
	'End Sub
	
	'UPGRADE_NOTE: graphics was upgraded to graphics_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A9E4979A-37FA-4718-9994-97DD76ED70A7"'
	'UPGRADE_NOTE: update was upgraded to update_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A9E4979A-37FA-4718-9994-97DD76ED70A7"'
	Public Sub update_Renamed()
        Dim x2, x1, y2, y1 As Short
        Dim sx2, sx1, sy2, sy1 As Short
        Dim i As Short
		
		
		'UPGRADE_WARNING: Couldn't resolve default property of object graphics.curPalette. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
		'UPGRADE_WARNING: Couldn't resolve default property of object graphics.gPALETTE_MAIN. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
        App.graphics.curPalette = App.graphics.gPALETTE_MAIN
        Dim offscreen As Bitmap = New Bitmap(Graphic.ClientSize.Width, Graphic.ClientSize.Height)
        Using cv As Drawing.Graphics = Drawing.Graphics.FromImage(offscreen)
            graphics.fill(cv, 0, 0, Graphic.Width, Graphic.Height, System.Drawing.Color.Black)
            graphics.stretchbmpby(cv, 76, 0, 0, 0, 0, 200, 200)
            graphics.stretchbmpby(cv, 75, 0, 132, 0, 0, 200, 200)
            i = 107 + 3 * (selecteddoor - 1) + selectedlocation
            'draw 107, 108, far back left/right walls
            graphics.drawgrect(cv, 107, -1, 10, 200)
            graphics.drawgrect(cv, 108, -1, 10, 200)
            'if d3, draw 102,103
            If selectedlocation = 1 Then
                graphics.drawgrect(cv, 102, -1, 10, 200)
                graphics.drawgrect(cv, 103, -1, 10, 200)
                'door = 71
                graphics.drawgrect(cv, 71, i, 10, 200)
            End If
            'draw 110, 111, medium left/right walls
            graphics.drawgrect(cv, 110, -1, 10, 200)
            graphics.drawgrect(cv, 111, -1, 10, 200)
            'if d2, draw 100,101
            If selectedlocation = 2 Then
                graphics.drawgrect(cv, 100, -1, 10, 200)
                graphics.drawgrect(cv, 101, -1, 10, 200)
                'top part 95
                graphics.drawgrect(cv, 95, -1, 10, 200)
                'door = 41
                graphics.drawgrect(cv, 41, i, 10, 200)
            End If
            'draw 113, 114, close left/right walls
            graphics.drawgrect(cv, 113, -1, 10, 200)
            graphics.drawgrect(cv, 114, -1, 10, 200)
            'if d1, draw 98, 99
            If selectedlocation = 3 Then
                graphics.drawgrect(cv, 98, -1, 10, 200)
                graphics.drawgrect(cv, 99, -1, 10, 200)
                'top part 92
                graphics.drawgrect(cv, 92, -1, 10, 200)
                'door = 11
                graphics.drawgrect(cv, 11, i, 10, 200)
            End If
            'draw 116, 117, immidiate left/right walls
            graphics.drawgrect(cv, 116, -1, 10, 200)
            graphics.drawgrect(cv, 117, -1, 10, 200)
            'Graphic.Refresh

            ' now set the palette for decorations

            'UPGRADE_WARNING: Couldn't resolve default property of object graphics.gPALETTE_CUSTOM. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            'UPGRADE_WARNING: Couldn't resolve default property of object graphics.gPALETTE_MAIN. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            'UPGRADE_WARNING: Couldn't resolve default property of object graphics.copypalette. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            graphics.copypalette(graphics.gPALETTE_MAIN, graphics.gPALETTE_CUSTOM)

            If selectedlocation = 2 Then
                For i = 0 To 15
                    'UPGRADE_WARNING: Couldn't resolve default property of object graphics.f558. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                    'UPGRADE_WARNING: Couldn't resolve default property of object graphics.gPALETTE_MAIN. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                    'UPGRADE_WARNING: Couldn't resolve default property of object graphics.getpalette. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                    'UPGRADE_WARNING: Couldn't resolve default property of object graphics.gPALETTE_CUSTOM. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                    'UPGRADE_WARNING: Couldn't resolve default property of object graphics.setpalette. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                    graphics.setpalette(graphics.gPALETTE_CUSTOM, i, graphics.getpalette(graphics.gPALETTE_MAIN, graphics.f558.d2doordecorationpalette(i + 1) / 10))
                Next
            End If

            If selectedlocation = 1 Then
                For i = 0 To 15
                    'UPGRADE_WARNING: Couldn't resolve default property of object graphics.f558. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                    'UPGRADE_WARNING: Couldn't resolve default property of object graphics.gPALETTE_MAIN. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                    'UPGRADE_WARNING: Couldn't resolve default property of object graphics.getpalette. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                    'UPGRADE_WARNING: Couldn't resolve default property of object graphics.gPALETTE_CUSTOM. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                    'UPGRADE_WARNING: Couldn't resolve default property of object graphics.setpalette. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                    graphics.setpalette(graphics.gPALETTE_CUSTOM, i, graphics.getpalette(graphics.gPALETTE_MAIN, graphics.f558.d3doordecorationpalette(i + 1) / 10))
                Next
            End If

            'UPGRADE_WARNING: Couldn't resolve default property of object graphics.curPalette. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            'UPGRADE_WARNING: Couldn't resolve default property of object graphics.gPALETTE_CUSTOM. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            graphics.curPalette = graphics.gPALETTE_CUSTOM

            'If selectedlocation = 1 Then 'd3
            '    For i = 1 To 16
            '        graphics.setmodifiedcolor i, graphics.color((graphics.f558.d3doordecorationpalette(i) / 10) + 1)
            '    Next
            '    offset = 2
            'ElseIf selectedlocation = 2 Then 'd2
            '    For i = 1 To 16
            '        graphics.setmodifiedcolor i, graphics.color((graphics.f558.d2doordecorationpalette(i) / 10) + 1)
            '    Next
            '    offset = 4
            'Else 'd1
            '    graphics.resetmodifiedcolorarray
            '    offset = 0
            'End If

            'UPGRADE_WARNING: Couldn't resolve default property of object x1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            x1 = doordecorationgroups(selectedgroup, selectedlocation).x1
            'UPGRADE_WARNING: Couldn't resolve default property of object y1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            y1 = doordecorationgroups(selectedgroup, selectedlocation).y1
            'UPGRADE_WARNING: Couldn't resolve default property of object x2. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            x2 = doordecorationgroups(selectedgroup, selectedlocation).x2
            y2 = doordecorationgroups(selectedgroup, selectedlocation).y2


            'UPGRADE_WARNING: Couldn't resolve default property of object x1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            X1Coord.Text = Str(x1)
            'UPGRADE_WARNING: Couldn't resolve default property of object y1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            Y1Coord.Text = Str(y1)
            'UPGRADE_WARNING: Couldn't resolve default property of object x2. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            X2Coord.Text = Str(x2)
            Y2Coord.Text = Str(y2)

            'If X > 0 Or Y > 0 Or subclickchange = True Then

            'UPGRADE_WARNING: Couldn't resolve default property of object y1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            If y2 < y1 Then
                'UPGRADE_WARNING: Couldn't resolve default property of object y1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                y2 = y1 + 1
            End If
            'UPGRADE_WARNING: Couldn't resolve default property of object x1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            'UPGRADE_WARNING: Couldn't resolve default property of object x2. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            If x2 < x1 Then
                'UPGRADE_WARNING: Couldn't resolve default property of object x1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                'UPGRADE_WARNING: Couldn't resolve default property of object x2. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                x2 = x1 + 1
            End If

            'UPGRADE_WARNING: Couldn't resolve default property of object x1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            'UPGRADE_WARNING: Couldn't resolve default property of object sx1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            sx1 = x1
            'UPGRADE_WARNING: Couldn't resolve default property of object x2. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            'UPGRADE_WARNING: Couldn't resolve default property of object sx2. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            sx2 = x2
            'UPGRADE_WARNING: Couldn't resolve default property of object y1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            'UPGRADE_WARNING: Couldn't resolve default property of object sy1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            sy1 = y1
            sy2 = y2

            'UPGRADE_WARNING: Couldn't resolve default property of object x1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            x1 = x1 * 2 + doorlocscenter(selectedlocation, 1) * 2
            'UPGRADE_WARNING: Couldn't resolve default property of object y1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            y1 = y1 * 2 + doorlocscenter(selectedlocation, 2) * 2
            'UPGRADE_WARNING: Couldn't resolve default property of object x2. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            x2 = x2 * 2 + doorlocscenter(selectedlocation, 1) * 2
            y2 = y2 * 2 + doorlocscenter(selectedlocation, 2) * 2

            'UPGRADE_WARNING: Couldn't resolve default property of object x1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            GSelectBox.Left = x1
            'UPGRADE_WARNING: Couldn't resolve default property of object y1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            GSelectBox.Top = y1
            If subclickchange = False Then
                'UPGRADE_WARNING: Couldn't resolve default property of object x1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                GLocPointer.Left = x1
                'UPGRADE_WARNING: Couldn't resolve default property of object y1. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
                GLocPointer.Top = y1
            End If

            GSelectBox.Visible = True
            GLocPointer.Visible = True
            'Else
            '    HLine.Visible = False
            '    VLine.Visible = False
            '    SelectBox.Visible = False
            '    LocPointer.Visible = False
            'End If
            '164 close, 103 medium, 84 long
            'so at medium, the height is 62% of the normal
            'at long, the height is 50% of the normal
            If Not CGDecorationList.FocusedItem Is Nothing Then


                'draw the decoration
                graphics.stretchtransparentbmp(cv, 302 + selecteddecoration, x1, y1, x2 - x1 + 2, y2 - y1 + 2, 0, 0, 9)


            End If

        End Using
        Graphic.BackgroundImage = offscreen
        Graphic.BackgroundImageLayout = ImageLayout.None
        Graphic.Refresh()
	End Sub
	
	'UPGRADE_NOTE: graphics was upgraded to graphics_Renamed. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A9E4979A-37FA-4718-9994-97DD76ED70A7"'
    Private Sub PaletteInfo_ClickEvent(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles PaletteInfo.Click
        Dim i As Short
        Dim p As CustomPaletteEditor
        p = New CustomPaletteEditor
        For i = 1 To 16
            'UPGRADE_WARNING: Couldn't resolve default property of object graphics.f558. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            p.setd2palette(i, graphics.f558.d2doordecorationpalette(i))
            'UPGRADE_WARNING: Couldn't resolve default property of object graphics.f558. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
            p.setd3palette(i, graphics.f558.d3doordecorationpalette(i))
        Next
        p.returnDoorDecorationGraphicInfoEditor = Me
        p.returnTo = 1
        p.Show()
        p.init()
    End Sub
	
	'UPGRADE_WARNING: Event X1Coord.TextChanged may fire when form is initialized. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="88B12AE1-6DE0-48A0-86F1-60C0686C026A"'
	Private Sub X1Coord_TextChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles X1Coord.TextChanged
		If subchange = True Then
			Exit Sub
		End If
		subchange = True
		doordecorationgroups(selectedgroup, selectedlocation).x1 = App.EFChange8(X1Coord, 0, 255)
		update_Renamed()
		subchange = False
	End Sub
	
	'UPGRADE_WARNING: Event Y1Coord.TextChanged may fire when form is initialized. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="88B12AE1-6DE0-48A0-86F1-60C0686C026A"'
	Private Sub Y1Coord_TextChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Y1Coord.TextChanged
		If subchange = True Then
			Exit Sub
		End If
		subchange = True
		doordecorationgroups(selectedgroup, selectedlocation).y1 = App.EFChange8(Y1Coord, 0, 255)
		update_Renamed()
		subchange = False
	End Sub
	
	
	
	'UPGRADE_WARNING: Event X2Coord.TextChanged may fire when form is initialized. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="88B12AE1-6DE0-48A0-86F1-60C0686C026A"'
	Private Sub X2Coord_TextChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles X2Coord.TextChanged
		If subchange = True Then
			Exit Sub
		End If
		subchange = True
		doordecorationgroups(selectedgroup, selectedlocation).x2 = App.EFChange8(X2Coord, 0, 255)
		update_Renamed()
		subchange = False
	End Sub
	
	'UPGRADE_WARNING: Event Y2Coord.TextChanged may fire when form is initialized. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="88B12AE1-6DE0-48A0-86F1-60C0686C026A"'
	Private Sub Y2Coord_TextChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Y2Coord.TextChanged
		If subchange = True Then
			Exit Sub
		End If
		subchange = True
		doordecorationgroups(selectedgroup, selectedlocation).y2 = App.EFChange8(Y2Coord, 0, 255)
		update_Renamed()
		subchange = False
	End Sub
	
	
	'UPGRADE_WARNING: Event Gheight.TextChanged may fire when form is initialized. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="88B12AE1-6DE0-48A0-86F1-60C0686C026A"'
	Private Sub Gheight_TextChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Gheight.TextChanged
		If subchange = True Then
			Exit Sub
		End If
		subchange = True
		doordecorationgroups(selectedgroup, selectedlocation).height = App.EFChange8(GHeight, 0, 255)
		subchange = False
	End Sub
	'UPGRADE_WARNING: Event Gwidth.TextChanged may fire when form is initialized. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="88B12AE1-6DE0-48A0-86F1-60C0686C026A"'
	Private Sub Gwidth_TextChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Gwidth.TextChanged
		If subchange = True Then
			Exit Sub
		End If
		subchange = True
		doordecorationgroups(selectedgroup, selectedlocation).width = App.EFChange8(GWidth, 0, 255)
		subchange = False
	End Sub

    Private Sub DoorDecorationGraphicInfoEditor_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
        If e.CloseReason = CloseReason.UserClosing Then
            e.Cancel = True
            Hide()
        End If
    End Sub

    Private Sub DoorDecorationGraphicInfoEditor_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        CGDoorList.SmallImageList = App.JewelIL
        CGLocationList.SmallImageList = App.JewelIL
        CGGroupList.SmallImageList = App.JewelIL
        CGDecorationList.SmallImageList = App.JewelIL
    End Sub
End Class