3 Replies - 1120 Views - Last Post: 15 December 2012 - 11:23 AM Rate Topic: -----

#1 Olebendz  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 12-December 12

Issue with DrawGraphics()

Posted 15 December 2012 - 05:37 AM

I'm in the process of developing a 2D game engine (Tile-based). Unfortunately I am at a complete stand-still due to the DrawGrphics() not doing what I need. Here is a PrintScreen:

Posted Image

The DrawGraphics() creates the grid system, which works brilliantly - however, if you look at the image, you can see the white box's outside of the grid. I know these white box's have something to do with the:

G.DrawRectangle(Pens.White, mouseX * TileSize, mouseY * TileSize, TileSize, TileSize)

So whenever the cursor goes over the grid, the white box appears, e.g.

Posted Image

However, whenever the cursor leaves the grid, those white box's still appear ://>

Heres the code:

Imports System.Drawing

Public Class Form1
    'VIEWPORT
    Dim ResWidth As Integer = 750
    Dim ResHeight As Integer = 800
    Dim TileSize As Integer = 16

    ' GRAPHICS VARIABLES
    Dim G As Graphics
    Dim BBG As Graphics
    Dim BB As Bitmap
    Dim r As Rectangle

    ' FPS COUNTER
    Dim tSec As Integer = TimeOfDay.Second
    Dim tTicks As Integer = 0
    Dim MaxTicks As Integer = 0

    ' MAP VARIABLES
    Dim Map(150, 150, 10) As Integer
    Dim MapX As Integer = 20
    Dim MapY As Integer = 20

    ' GAME RUNNING ?
    Dim IsRunning As Boolean = True

    ' MOUSE LOCATIONS
    Dim mouseX As Integer
    Dim mouseY As Integer
    Dim mMapX As Integer
    Dim mMapY As Integer

    ' PAINT BRUSH
    Dim PaintBrush As Integer = 0



    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.Show()
        Me.Focus()

        ' INITIALIZE GRAPHICS OBJECTS
        G = Me.CreateGraphics
        BB = New Bitmap(ResWidth, ResHeight)


        StartGameLoop()
    End Sub


    Private Sub Panel2_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Panel2.Paint

    End Sub

    Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click
        End

    End Sub

    Private Sub PictureBox23_MouseHover(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox23.MouseHover

    End Sub

    Private Sub PlayToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PlayToolStripMenuItem.Click

    End Sub

    Private Sub MenuStrip1_ItemClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolStripItemClickedEventArgs)

    End Sub

    Private Sub MenuStrip1_ItemClicked_1(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolStripItemClickedEventArgs) Handles MenuStrip1.ItemClicked

    End Sub

    Private Sub PictureBox26_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox26.Click
        End

    End Sub

    Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
        End
    End Sub


    Private Sub Panel3_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Panel3.Paint

    End Sub
    Private Sub StartGameLoop()
        Do While IsRunning = True
            ' KEEP APP RESPONSIVE
            Application.DoEvents()

            '1.) Check user input
            '2.) Run AI
            '3.) Update Object Data (Object Positions, Status, etc.)
            '4.) Check Triggers and Conditions
            '5.) Draw Graphics
            DrawGraphics()
            '6.) Playing Sound Effects & Music

            ' UPDATE TICK COUNTER
            TickCounter()
        Loop
    End Sub

    Private Sub DrawGraphics()
        'FILL THE BACKBUFFER
        'DRAW TILES
        For X = 1 To 45
            For Y = 6 To 37
                r = New Rectangle(X * TileSize, Y * TileSize, TileSize, TileSize)

                Select Case Map(MapX + X, MapY + Y, 0)
                    Case 0 ' NORMAL
                        G.FillRectangle(Brushes.DarkGray, r)
                    Case 1 ' WHITE
                        G.FillRectangle(Brushes.White, r)
                    Case 2 ' BLACK
                        G.FillRectangle(Brushes.Black, r)
                    Case 3 ' GREY
                        G.FillRectangle(Brushes.Gray, r)
                    Case 4 ' SILVER
                        G.FillRectangle(Brushes.Silver, r)
                    Case 5 'LIGHTGRAY
                        G.FillRectangle(Brushes.LightGray, r)
                    Case 6 'GAINSBORO
                        G.FillRectangle(Brushes.Gainsboro, r)
                    Case 7 'WHITESMOKE
                        G.FillRectangle(Brushes.WhiteSmoke, r)

                    Case 8 ' MAROON
                        G.FillRectangle(Brushes.Maroon, r)
                    Case 9 ' DARKRED
                        G.FillRectangle(Brushes.DarkRed, r)
                    Case 10 ' RED
                        G.FillRectangle(Brushes.Red, r)
                    Case 11 ' BROWN
                        G.FillRectangle(Brushes.Brown, r)
                    Case 12 ' FIREBRICK
                        G.FillRectangle(Brushes.Firebrick, r)
                    Case 13 ' INDIANRED
                        G.FillRectangle(Brushes.IndianRed, r)
                    Case 14 ' SNOW
                        G.FillRectangle(Brushes.Snow, r)

                    Case 15 ' LIGHTCORAL
                        G.FillRectangle(Brushes.LightCoral, r)
                    Case 16 ' ROSYBROWN
                        G.FillRectangle(Brushes.RosyBrown, r)
                    Case 17 ' MISTYROSE
                        G.FillRectangle(Brushes.MistyRose, r)
                    Case 18 ' SALMON
                        G.FillRectangle(Brushes.Salmon, r)
                    Case 19 ' CRIMSON
                        G.FillRectangle(Brushes.Crimson, r)
                    Case 20 ' DARKSALMON
                        G.FillRectangle(Brushes.DarkSalmon, r)
                    Case 21 ' CORAL
                        G.FillRectangle(Brushes.Coral, r)

                    Case 22 ' ORANGERE
                        G.FillRectangle(Brushes.Orange, r)
                    Case 23 ' LIGHTSALMON
                        G.FillRectangle(Brushes.LightSalmon, r)
                    Case 24 ' SIENNA
                        G.FillRectangle(Brushes.Sienna, r)
                    Case 25 ' SEASHELL
                        G.FillRectangle(Brushes.SeaShell, r)
                    Case 26 ' CHOCOLATE
                        G.FillRectangle(Brushes.Chocolate, r)
                    Case 27 ' SADDLEBROWN
                        G.FillRectangle(Brushes.SaddleBrown, r)
                    Case 28 ' SANDYBROWN
                        G.FillRectangle(Brushes.SandyBrown, r)

                    Case 29 ' PEACHPUFF
                        G.FillRectangle(Brushes.PeachPuff, r)
                    Case 30 ' PERU
                        G.FillRectangle(Brushes.Peru, r)
                    Case 31 ' LINEN
                        G.FillRectangle(Brushes.Linen, r)
                    Case 32 ' BISQUE
                        G.FillRectangle(Brushes.Bisque, r)
                    Case 33 ' DARKORANGE
                        G.FillRectangle(Brushes.DarkOrange, r)
                    Case 34 ' BURLYWOOD
                        G.FillRectangle(Brushes.BurlyWood, r)
                    Case 35 ' TAN
                        G.FillRectangle(Brushes.Tan, r)

                    Case 36 ' AntiqueWhite
                        G.FillRectangle(Brushes.AntiqueWhite, r)
                    Case 37 ' NavajoWhite
                        G.FillRectangle(Brushes.NavajoWhite, r)
                    Case 38 ' BlanchedAlmond
                        G.FillRectangle(Brushes.BlanchedAlmond, r)
                    Case 39 ' PapayaWhip
                        G.FillRectangle(Brushes.PapayaWhip, r)
                    Case 40 ' Moccasin
                        G.FillRectangle(Brushes.Moccasin, r)
                    Case 41 ' Orange
                        G.FillRectangle(Brushes.Orange, r)
                    Case 42 ' Wheat
                        G.FillRectangle(Brushes.Wheat, r)

                    Case 43 ' Khaki
                        G.FillRectangle(Brushes.Khaki, r)
                    Case 44 ' FloralWhite
                        G.FillRectangle(Brushes.FloralWhite, r)
                    Case 45 ' DarkGoldenrod
                        G.FillRectangle(Brushes.DarkGoldenrod, r)
                    Case 46 ' Goldenrod
                        G.FillRectangle(Brushes.Goldenrod, r)
                    Case 47 ' Cornsilk
                        G.FillRectangle(Brushes.Cornsilk, r)
                    Case 48 ' Gold
                        G.FillRectangle(Brushes.Gold, r)
                    Case 49 ' Khaki
                        G.FillRectangle(Brushes.Khaki, r)

                    Case 50 ' LemonChiffon
                        G.FillRectangle(Brushes.LemonChiffon, r)
                    Case 51 ' PaleGoldenrod
                        G.FillRectangle(Brushes.PaleGoldenrod, r)
                    Case 52 ' DarkKhaki
                        G.FillRectangle(Brushes.DarkKhaki, r)
                    Case 53 ' Beige
                        G.FillRectangle(Brushes.Beige, r)
                    Case 54 ' LightGoldenrodYellow
                        G.FillRectangle(Brushes.LightGoldenrodYellow, r)
                    Case 55 ' Olive
                        G.FillRectangle(Brushes.Olive, r)
                    Case 56 ' Yellow
                        G.FillRectangle(Brushes.Yellow, r)

                    Case 57 ' LightYellow
                        G.FillRectangle(Brushes.LightYellow, r)
                    Case 58 ' Ivory
                        G.FillRectangle(Brushes.Ivory, r)
                    Case 59 ' OliveDrab
                        G.FillRectangle(Brushes.OliveDrab, r)
                    Case 60 ' YellowGreen
                        G.FillRectangle(Brushes.YellowGreen, r)
                    Case 61 ' DarkOliveGreen
                        G.FillRectangle(Brushes.DarkOliveGreen, r)
                    Case 62 ' GreenYellow
                        G.FillRectangle(Brushes.GreenYellow, r)
                    Case 63 ' Chartreuse
                        G.FillRectangle(Brushes.Chartreuse, r)

                    Case 64 ' 
                        G.FillRectangle(Brushes.LawnGreen, r)
                    Case 65 ' 
                        G.FillRectangle(Brushes.DarkSeaGreen, r)
                    Case 66 ' 
                        G.FillRectangle(Brushes.LightGreen, r)
                    Case 67 ' 
                        G.FillRectangle(Brushes.ForestGreen, r)
                    Case 68 ' 
                        G.FillRectangle(Brushes.LimeGreen, r)
                    Case 69 ' 
                        G.FillRectangle(Brushes.PaleGreen, r)
                    Case 70 ' 
                        G.FillRectangle(Brushes.DarkGreen, r)

                    Case 71 ' 
                        G.FillRectangle(Brushes.Green, r)
                    Case 72 ' 
                        G.FillRectangle(Brushes.Lime, r)
                    Case 73 ' 
                        G.FillRectangle(Brushes.Honeydew, r)
                    Case 74 ' 
                        G.FillRectangle(Brushes.SeaGreen, r)
                    Case 75 ' 
                        G.FillRectangle(Brushes.MediumSeaGreen, r)
                    Case 76 ' 
                        G.FillRectangle(Brushes.SpringGreen, r)
                    Case 77 ' 
                        G.FillRectangle(Brushes.MintCream, r)

                    Case 78 ' 
                        G.FillRectangle(Brushes.MediumSpringGreen, r)
                    Case 79 ' 
                        G.FillRectangle(Brushes.MediumAquamarine, r)
                    Case 80 ' 
                        G.FillRectangle(Brushes.Aquamarine, r)
                    Case 81 ' 
                        G.FillRectangle(Brushes.Turquoise, r)
                    Case 82 ' 
                        G.FillRectangle(Brushes.LightSeaGreen, r)
                    Case 83 ' 
                        G.FillRectangle(Brushes.MediumTurquoise, r)
                    Case 84 ' 
                        G.FillRectangle(Brushes.DarkSlateGray, r)

                    Case 85 ' 
                        G.FillRectangle(Brushes.PaleTurquoise, r)
                    Case 86 ' 
                        G.FillRectangle(Brushes.Teal, r)
                    Case 87 ' 
                        G.FillRectangle(Brushes.DarkCyan, r)
                    Case 88 ' 
                        G.FillRectangle(Brushes.Aqua, r)
                    Case 89 ' 
                        G.FillRectangle(Brushes.Cyan, r)
                    Case 90 ' 
                        G.FillRectangle(Brushes.LightCyan, r)
                    Case 91 ' 
                        G.FillRectangle(Brushes.Azure, r)

                    Case 92 ' 
                        G.FillRectangle(Brushes.DarkTurquoise, r)
                    Case 93 ' 
                        G.FillRectangle(Brushes.CadetBlue, r)
                    Case 94 ' 
                        G.FillRectangle(Brushes.PowderBlue, r)
                    Case 95 ' 
                        G.FillRectangle(Brushes.LightBlue, r)
                    Case 96 ' 
                        G.FillRectangle(Brushes.DeepSkyBlue, r)
                    Case 97 ' 
                        G.FillRectangle(Brushes.SkyBlue, r)
                    Case 98 ' 
                        G.FillRectangle(Brushes.LightSkyBlue, r)

                    Case 99 ' 
                        G.FillRectangle(Brushes.SteelBlue, r)
                    Case 100 ' 
                        G.FillRectangle(Brushes.AliceBlue, r)
                    Case 101 ' 
                        G.FillRectangle(Brushes.DodgerBlue, r)
                    Case 102 ' 
                        G.FillRectangle(Brushes.SlateGray, r)
                    Case 103 ' 
                        G.FillRectangle(Brushes.LightSlateGray, r)
                    Case 104 ' 
                        G.FillRectangle(Brushes.LightSteelBlue, r)
                    Case 105 ' 
                        G.FillRectangle(Brushes.CornflowerBlue, r)

                    Case 106 ' 
                        G.FillRectangle(Brushes.RoyalBlue, r)
                    Case 107 ' 
                        G.FillRectangle(Brushes.MidnightBlue, r)
                    Case 108 ' 
                        G.FillRectangle(Brushes.LavenderBlush, r)
                    Case 109 ' 
                        G.FillRectangle(Brushes.Navy, r)
                    Case 110 ' 
                        G.FillRectangle(Brushes.DarkBlue, r)
                    Case 111 ' 
                        G.FillRectangle(Brushes.MediumBlue, r)
                    Case 112 ' 
                        G.FillRectangle(Brushes.Blue, r)

                    Case 113 ' 
                        G.FillRectangle(Brushes.GhostWhite, r)
                    Case 114 ' 
                        G.FillRectangle(Brushes.SlateBlue, r)
                    Case 115 ' 
                        G.FillRectangle(Brushes.DarkSlateBlue, r)
                    Case 116 ' 
                        G.FillRectangle(Brushes.MediumSlateBlue, r)
                    Case 117 ' 
                        G.FillRectangle(Brushes.MediumPurple, r)
                    Case 118 ' 
                        G.FillRectangle(Brushes.BlueViolet, r)
                    Case 119 ' 
                        G.FillRectangle(Brushes.Indigo, r)

                    Case 120 ' 
                        G.FillRectangle(Brushes.DarkOrchid, r)
                    Case 121 ' 
                        G.FillRectangle(Brushes.DarkViolet, r)
                    Case 122 ' 
                        G.FillRectangle(Brushes.MediumOrchid, r)
                    Case 123 ' 
                        G.FillRectangle(Brushes.Thistle, r)
                    Case 124 ' 
                        G.FillRectangle(Brushes.Plum, r)
                    Case 125 ' 
                        G.FillRectangle(Brushes.Violet, r)
                    Case 126 ' 
                        G.FillRectangle(Brushes.Purple, r)

                    Case 127 ' 
                        G.FillRectangle(Brushes.DarkMagenta, r)
                    Case 128 ' 
                        G.FillRectangle(Brushes.Fuchsia, r)
                    Case 129 ' 
                        G.FillRectangle(Brushes.Magenta, r)
                    Case 130 ' 
                        G.FillRectangle(Brushes.Orchid, r)
                    Case 131 ' 
                        G.FillRectangle(Brushes.MediumVioletRed, r)
                    Case 132 ' 
                        G.FillRectangle(Brushes.DeepPink, r)
                    Case 133 ' 
                        G.FillRectangle(Brushes.HotPink, r)

                End Select

                G.DrawRectangle(Pens.Black, r)
            Next
        Next

        'DRAW FINAL LAYERS

        'GUYS, MENUS,ETC

        G.FillRectangle(Brushes.White, 52 * TileSize, 37 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.Black, 53 * TileSize, 37 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.Gray, 51 * TileSize, 37 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.Silver, 50 * TileSize, 37 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.LightGray, 49 * TileSize, 37 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.Gainsboro, 48 * TileSize, 37 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.WhiteSmoke, 47 * TileSize, 37 * TileSize, TileSize, TileSize)

        G.FillRectangle(Brushes.Maroon, 53 * TileSize, 36 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.DarkRed, 52 * TileSize, 36 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.Red, 51 * TileSize, 36 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.Brown, 50 * TileSize, 36 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.Firebrick, 49 * TileSize, 36 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.IndianRed, 48 * TileSize, 36 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.Snow, 47 * TileSize, 36 * TileSize, TileSize, TileSize)

        G.FillRectangle(Brushes.LightCoral, 53 * TileSize, 35 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.RosyBrown, 52 * TileSize, 35 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.MistyRose, 51 * TileSize, 35 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.Salmon, 50 * TileSize, 35 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.Crimson, 49 * TileSize, 35 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.DarkSalmon, 48 * TileSize, 35 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.Coral, 47 * TileSize, 35 * TileSize, TileSize, TileSize)

        G.FillRectangle(Brushes.OrangeRed, 53 * TileSize, 34 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.LightSalmon, 52 * TileSize, 34 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.Sienna, 51 * TileSize, 34 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.SeaShell, 50 * TileSize, 34 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.Chocolate, 49 * TileSize, 34 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.SaddleBrown, 48 * TileSize, 34 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.SandyBrown, 47 * TileSize, 34 * TileSize, TileSize, TileSize)

        G.FillRectangle(Brushes.PeachPuff, 53 * TileSize, 33 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.Peru, 52 * TileSize, 33 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.Linen, 51 * TileSize, 33 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.Bisque, 50 * TileSize, 33 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.DarkOrange, 49 * TileSize, 33 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.BurlyWood, 48 * TileSize, 33 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.Tan, 47 * TileSize, 33 * TileSize, TileSize, TileSize)

        G.FillRectangle(Brushes.AntiqueWhite, 53 * TileSize, 32 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.NavajoWhite, 52 * TileSize, 32 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.BlanchedAlmond, 51 * TileSize, 32 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.PapayaWhip, 50 * TileSize, 32 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.Moccasin, 49 * TileSize, 32 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.Orange, 48 * TileSize, 32 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.Wheat, 47 * TileSize, 32 * TileSize, TileSize, TileSize)

        G.FillRectangle(Brushes.OldLace, 53 * TileSize, 31 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.FloralWhite, 52 * TileSize, 31 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.DarkGoldenrod, 51 * TileSize, 31 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.Goldenrod, 50 * TileSize, 31 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.Cornsilk, 49 * TileSize, 31 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.Gold, 48 * TileSize, 31 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.Khaki, 47 * TileSize, 31 * TileSize, TileSize, TileSize)

        G.FillRectangle(Brushes.LemonChiffon, 53 * TileSize, 30 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.PaleGoldenrod, 52 * TileSize, 30 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.DarkKhaki, 51 * TileSize, 30 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.Beige, 50 * TileSize, 30 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.LightGoldenrodYellow, 49 * TileSize, 30 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.Olive, 48 * TileSize, 30 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.Yellow, 47 * TileSize, 30 * TileSize, TileSize, TileSize)

        G.FillRectangle(Brushes.LightYellow, 53 * TileSize, 29 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.Ivory, 52 * TileSize, 29 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.OliveDrab, 51 * TileSize, 29 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.YellowGreen, 50 * TileSize, 29 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.DarkOliveGreen, 49 * TileSize, 29 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.GreenYellow, 48 * TileSize, 29 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.Chartreuse, 47 * TileSize, 29 * TileSize, TileSize, TileSize)

        G.FillRectangle(Brushes.LawnGreen, 53 * TileSize, 28 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.DarkSeaGreen, 52 * TileSize, 28 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.LightGreen, 51 * TileSize, 28 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.ForestGreen, 50 * TileSize, 28 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.LimeGreen, 49 * TileSize, 28 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.PaleGreen, 48 * TileSize, 28 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.DarkGreen, 47 * TileSize, 28 * TileSize, TileSize, TileSize)
      
        G.FillRectangle(Brushes.Green, 53 * TileSize, 27 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.Lime, 52 * TileSize, 27 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.Honeydew, 51 * TileSize, 27 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.SeaGreen, 50 * TileSize, 27 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.MediumSeaGreen, 49 * TileSize, 27 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.SpringGreen, 48 * TileSize, 27 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.MintCream, 47 * TileSize, 27 * TileSize, TileSize, TileSize)

        G.FillRectangle(Brushes.MediumSpringGreen, 53 * TileSize, 26 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.MediumAquamarine, 52 * TileSize, 26 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.Aquamarine, 51 * TileSize, 26 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.Turquoise, 50 * TileSize, 26 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.LightSeaGreen, 49 * TileSize, 26 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.MediumTurquoise, 48 * TileSize, 26 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.DarkSlateGray, 47 * TileSize, 26 * TileSize, TileSize, TileSize)
        
        G.FillRectangle(Brushes.PaleTurquoise, 53 * TileSize, 25 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.Teal, 52 * TileSize, 25 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.DarkCyan, 51 * TileSize, 25 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.Aqua, 50 * TileSize, 25 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.Cyan, 49 * TileSize, 25 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.LightCyan, 48 * TileSize, 25 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.Azure, 47 * TileSize, 25 * TileSize, TileSize, TileSize)
        
        G.FillRectangle(Brushes.DarkTurquoise, 53 * TileSize, 24 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.CadetBlue, 52 * TileSize, 24 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.PowderBlue, 51 * TileSize, 24 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.LightBlue, 50 * TileSize, 24 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.DeepSkyBlue, 49 * TileSize, 24 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.SkyBlue, 48 * TileSize, 24 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.LightSkyBlue, 47 * TileSize, 24 * TileSize, TileSize, TileSize)

        G.FillRectangle(Brushes.SteelBlue, 53 * TileSize, 23 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.AliceBlue, 52 * TileSize, 23 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.DodgerBlue, 51 * TileSize, 23 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.SlateGray, 50 * TileSize, 23 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.LightSlateGray, 49 * TileSize, 23 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.LightSteelBlue, 48 * TileSize, 23 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.CornflowerBlue, 47 * TileSize, 23 * TileSize, TileSize, TileSize)
        
        G.FillRectangle(Brushes.RoyalBlue, 53 * TileSize, 22 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.MidnightBlue, 52 * TileSize, 22 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.LavenderBlush, 51 * TileSize, 22 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.Navy, 50 * TileSize, 22 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.DarkBlue, 49 * TileSize, 22 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.MediumBlue, 48 * TileSize, 22 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.Blue, 47 * TileSize, 22 * TileSize, TileSize, TileSize)

        G.FillRectangle(Brushes.GhostWhite, 53 * TileSize, 21 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.SlateBlue, 52 * TileSize, 21 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.DarkSlateBlue, 51 * TileSize, 21 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.MediumSlateBlue, 50 * TileSize, 21 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.MediumPurple, 49 * TileSize, 21 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.BlueViolet, 48 * TileSize, 21 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.Indigo, 47 * TileSize, 21 * TileSize, TileSize, TileSize)

        G.FillRectangle(Brushes.DarkOrchid, 53 * TileSize, 20 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.DarkViolet, 52 * TileSize, 20 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.MediumOrchid, 51 * TileSize, 20 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.Thistle, 50 * TileSize, 20 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.Plum, 49 * TileSize, 20 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.Violet, 48 * TileSize, 20 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.Purple, 47 * TileSize, 20 * TileSize, TileSize, TileSize)

        G.FillRectangle(Brushes.DarkMagenta, 53 * TileSize, 19 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.Fuchsia, 52 * TileSize, 19 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.Magenta, 51 * TileSize, 19 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.Orchid, 50 * TileSize, 19 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.MediumVioletRed, 49 * TileSize, 19 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.DeepPink, 48 * TileSize, 19 * TileSize, TileSize, TileSize)
        G.FillRectangle(Brushes.HotPink, 47 * TileSize, 19 * TileSize, TileSize, TileSize)

      

        G.DrawRectangle(Pens.White, mouseX * TileSize, mouseY * TileSize, TileSize, TileSize)

        G.DrawString("Ticks: " & tTicks & vbCrLf & _
                    "TPS: " & MaxTicks & vbCrLf & _
                    "Mouse X: " & mouseX & vbCrLf & _
                    "Mouse Y: " & mouseY & vbCrLf & _
                    "M MapX: " & mMapX & vbCrLf & _
                    "M MapY: " & mMapY & vbCrLf & _
                    "", Me.Font, Brushes.White, 5, 0)

        ' COPY BACKBUFFER TO GRAPHICS OBJECT
        G = Graphics.FromImage(BB)

        ' DRAW BACKBUFFER TO SCREEN
        BBG = Me.CreateGraphics
        BBG.DrawImage(BB, 0, 0, ResWidth, ResHeight)

        ' FIX OVERDRAW
        G.Clear(Color.Empty)




    End Sub

Private Sub TickCounter()
        If tSec = TimeOfDay.Second And IsRunning = True Then
            tTicks = tTicks + 1
        Else
            MaxTicks = tTicks
            tTicks = 0
            tSec = TimeOfDay.Second
        End If
    End Sub

    Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint

    End Sub


    Private Sub Panel6_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Panel6.Paint

    End Sub

Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove

        mouseX = Math.Floor(e.X / TileSize)
        mouseY = Math.Floor(e.Y / TileSize)

        mMapX = MapX + mouseX
        mMapY = MapY + mouseY
    End Sub

    Private Sub Form1_MouseClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseClick
        'MsgBox("You attacked" & mMapX & mMapY)

        If mouseX = 52 And mouseY = 37 Then
            PaintBrush = 1
        ElseIf mouseX = 53 And mouseY = 37 Then
            PaintBrush = 2
        ElseIf mouseX = 51 And mouseY = 37 Then
            PaintBrush = 3
        ElseIf mouseX = 50 And mouseY = 37 Then
            PaintBrush = 4
        ElseIf mouseX = 49 And mouseY = 37 Then
            PaintBrush = 5
        ElseIf mouseX = 48 And mouseY = 37 Then
            PaintBrush = 6
        ElseIf mouseX = 47 And mouseY = 37 Then
            PaintBrush = 7

        ElseIf mouseX = 53 And mouseY = 36 Then
            PaintBrush = 8
        ElseIf mouseX = 52 And mouseY = 36 Then
            PaintBrush = 9
        ElseIf mouseX = 51 And mouseY = 36 Then
            PaintBrush = 10
        ElseIf mouseX = 50 And mouseY = 36 Then
            PaintBrush = 11
        ElseIf mouseX = 49 And mouseY = 36 Then
            PaintBrush = 12
        ElseIf mouseX = 48 And mouseY = 36 Then
            PaintBrush = 13
        ElseIf mouseX = 47 And mouseY = 36 Then
            PaintBrush = 14

        ElseIf mouseX = 53 And mouseY = 35 Then
            PaintBrush = 15
        ElseIf mouseX = 52 And mouseY = 35 Then
            PaintBrush = 16
        ElseIf mouseX = 51 And mouseY = 35 Then
            PaintBrush = 17
        ElseIf mouseX = 50 And mouseY = 35 Then
            PaintBrush = 18
        ElseIf mouseX = 49 And mouseY = 35 Then
            PaintBrush = 19
        ElseIf mouseX = 48 And mouseY = 35 Then
            PaintBrush = 20
        ElseIf mouseX = 47 And mouseY = 35 Then
            PaintBrush = 21

        ElseIf mouseX = 53 And mouseY = 34 Then
            PaintBrush = 22
        ElseIf mouseX = 52 And mouseY = 34 Then
            PaintBrush = 23
        ElseIf mouseX = 51 And mouseY = 34 Then
            PaintBrush = 24
        ElseIf mouseX = 50 And mouseY = 34 Then
            PaintBrush = 25
        ElseIf mouseX = 49 And mouseY = 34 Then
            PaintBrush = 26
        ElseIf mouseX = 48 And mouseY = 34 Then
            PaintBrush = 27
        ElseIf mouseX = 47 And mouseY = 34 Then
            PaintBrush = 28

        ElseIf mouseX = 53 And mouseY = 33 Then
            PaintBrush = 29
        ElseIf mouseX = 52 And mouseY = 33 Then
            PaintBrush = 30
        ElseIf mouseX = 51 And mouseY = 33 Then
            PaintBrush = 31
        ElseIf mouseX = 50 And mouseY = 33 Then
            PaintBrush = 32
        ElseIf mouseX = 49 And mouseY = 33 Then
            PaintBrush = 33
        ElseIf mouseX = 48 And mouseY = 33 Then
            PaintBrush = 34
        ElseIf mouseX = 47 And mouseY = 33 Then
            PaintBrush = 35

        ElseIf mouseX = 53 And mouseY = 32 Then
            PaintBrush = 36
        ElseIf mouseX = 52 And mouseY = 32 Then
            PaintBrush = 37
        ElseIf mouseX = 51 And mouseY = 32 Then
            PaintBrush = 38
        ElseIf mouseX = 50 And mouseY = 32 Then
            PaintBrush = 39
        ElseIf mouseX = 49 And mouseY = 32 Then
            PaintBrush = 40
        ElseIf mouseX = 48 And mouseY = 32 Then
            PaintBrush = 41
        ElseIf mouseX = 47 And mouseY = 32 Then
            PaintBrush = 42

        ElseIf mouseX = 53 And mouseY = 31 Then
            PaintBrush = 43
        ElseIf mouseX = 52 And mouseY = 31 Then
            PaintBrush = 44
        ElseIf mouseX = 51 And mouseY = 31 Then
            PaintBrush = 45
        ElseIf mouseX = 50 And mouseY = 31 Then
            PaintBrush = 46
        ElseIf mouseX = 49 And mouseY = 31 Then
            PaintBrush = 47
        ElseIf mouseX = 48 And mouseY = 31 Then
            PaintBrush = 48
        ElseIf mouseX = 47 And mouseY = 31 Then
            PaintBrush = 49

        ElseIf mouseX = 53 And mouseY = 30 Then
            PaintBrush = 50
        ElseIf mouseX = 52 And mouseY = 30 Then
            PaintBrush = 51
        ElseIf mouseX = 51 And mouseY = 30 Then
            PaintBrush = 52
        ElseIf mouseX = 50 And mouseY = 30 Then
            PaintBrush = 53
        ElseIf mouseX = 49 And mouseY = 30 Then
            PaintBrush = 54
        ElseIf mouseX = 48 And mouseY = 30 Then
            PaintBrush = 55
        ElseIf mouseX = 47 And mouseY = 30 Then
            PaintBrush = 56

        ElseIf mouseX = 53 And mouseY = 29 Then
            PaintBrush = 57
        ElseIf mouseX = 52 And mouseY = 29 Then
            PaintBrush = 58
        ElseIf mouseX = 51 And mouseY = 29 Then
            PaintBrush = 59
        ElseIf mouseX = 50 And mouseY = 29 Then
            PaintBrush = 60
        ElseIf mouseX = 49 And mouseY = 29 Then
            PaintBrush = 61
        ElseIf mouseX = 48 And mouseY = 29 Then
            PaintBrush = 62
        ElseIf mouseX = 47 And mouseY = 29 Then
            PaintBrush = 63

        ElseIf mouseX = 53 And mouseY = 28 Then
            PaintBrush = 64
        ElseIf mouseX = 52 And mouseY = 28 Then
            PaintBrush = 65
        ElseIf mouseX = 51 And mouseY = 28 Then
            PaintBrush = 66
        ElseIf mouseX = 50 And mouseY = 28 Then
            PaintBrush = 67
        ElseIf mouseX = 49 And mouseY = 28 Then
            PaintBrush = 68
        ElseIf mouseX = 48 And mouseY = 28 Then
            PaintBrush = 69
        ElseIf mouseX = 47 And mouseY = 28 Then
            PaintBrush = 70

        ElseIf mouseX = 53 And mouseY = 27 Then
            PaintBrush = 71
        ElseIf mouseX = 52 And mouseY = 27 Then
            PaintBrush = 72
        ElseIf mouseX = 51 And mouseY = 27 Then
            PaintBrush = 73
        ElseIf mouseX = 50 And mouseY = 27 Then
            PaintBrush = 74
        ElseIf mouseX = 49 And mouseY = 27 Then
            PaintBrush = 75
        ElseIf mouseX = 48 And mouseY = 27 Then
            PaintBrush = 76
        ElseIf mouseX = 47 And mouseY = 27 Then
            PaintBrush = 77

        ElseIf mouseX = 53 And mouseY = 26 Then
            PaintBrush = 78
        ElseIf mouseX = 52 And mouseY = 26 Then
            PaintBrush = 79
        ElseIf mouseX = 51 And mouseY = 26 Then
            PaintBrush = 80
        ElseIf mouseX = 50 And mouseY = 26 Then
            PaintBrush = 81
        ElseIf mouseX = 49 And mouseY = 26 Then
            PaintBrush = 82
        ElseIf mouseX = 48 And mouseY = 26 Then
            PaintBrush = 83
        ElseIf mouseX = 47 And mouseY = 26 Then
            PaintBrush = 84

        ElseIf mouseX = 53 And mouseY = 25 Then
            PaintBrush = 85
        ElseIf mouseX = 52 And mouseY = 25 Then
            PaintBrush = 86
        ElseIf mouseX = 51 And mouseY = 25 Then
            PaintBrush = 87
        ElseIf mouseX = 50 And mouseY = 25 Then
            PaintBrush = 88
        ElseIf mouseX = 49 And mouseY = 25 Then
            PaintBrush = 89
        ElseIf mouseX = 48 And mouseY = 25 Then
            PaintBrush = 90
        ElseIf mouseX = 47 And mouseY = 25 Then
            PaintBrush = 91

        ElseIf mouseX = 53 And mouseY = 24 Then
            PaintBrush = 92
        ElseIf mouseX = 52 And mouseY = 24 Then
            PaintBrush = 93
        ElseIf mouseX = 51 And mouseY = 24 Then
            PaintBrush = 94
        ElseIf mouseX = 50 And mouseY = 24 Then
            PaintBrush = 95
        ElseIf mouseX = 49 And mouseY = 24 Then
            PaintBrush = 96
        ElseIf mouseX = 48 And mouseY = 24 Then
            PaintBrush = 97
        ElseIf mouseX = 47 And mouseY = 24 Then
            PaintBrush = 98

        ElseIf mouseX = 53 And mouseY = 23 Then
            PaintBrush = 99
        ElseIf mouseX = 52 And mouseY = 23 Then
            PaintBrush = 100
        ElseIf mouseX = 51 And mouseY = 23 Then
            PaintBrush = 101
        ElseIf mouseX = 50 And mouseY = 23 Then
            PaintBrush = 102
        ElseIf mouseX = 49 And mouseY = 23 Then
            PaintBrush = 103
        ElseIf mouseX = 48 And mouseY = 23 Then
            PaintBrush = 104
        ElseIf mouseX = 47 And mouseY = 23 Then
            PaintBrush = 105

        ElseIf mouseX = 53 And mouseY = 22 Then
            PaintBrush = 106
        ElseIf mouseX = 52 And mouseY = 22 Then
            PaintBrush = 107
        ElseIf mouseX = 51 And mouseY = 22 Then
            PaintBrush = 108
        ElseIf mouseX = 50 And mouseY = 22 Then
            PaintBrush = 109
        ElseIf mouseX = 49 And mouseY = 22 Then
            PaintBrush = 110
        ElseIf mouseX = 48 And mouseY = 22 Then
            PaintBrush = 111
        ElseIf mouseX = 47 And mouseY = 22 Then
            PaintBrush = 112

        ElseIf mouseX = 53 And mouseY = 21 Then
            PaintBrush = 113
        ElseIf mouseX = 52 And mouseY = 21 Then
            PaintBrush = 114
        ElseIf mouseX = 51 And mouseY = 21 Then
            PaintBrush = 115
        ElseIf mouseX = 50 And mouseY = 21 Then
            PaintBrush = 116
        ElseIf mouseX = 49 And mouseY = 21 Then
            PaintBrush = 117
        ElseIf mouseX = 48 And mouseY = 21 Then
            PaintBrush = 118
        ElseIf mouseX = 47 And mouseY = 21 Then
            PaintBrush = 119

        ElseIf mouseX = 53 And mouseY = 20 Then
            PaintBrush = 120
        ElseIf mouseX = 52 And mouseY = 20 Then
            PaintBrush = 121
        ElseIf mouseX = 51 And mouseY = 20 Then
            PaintBrush = 122
        ElseIf mouseX = 50 And mouseY = 20 Then
            PaintBrush = 123
        ElseIf mouseX = 49 And mouseY = 20 Then
            PaintBrush = 124
        ElseIf mouseX = 48 And mouseY = 20 Then
            PaintBrush = 125
        ElseIf mouseX = 47 And mouseY = 20 Then
            PaintBrush = 126

        ElseIf mouseX = 53 And mouseY = 19 Then
            PaintBrush = 127
        ElseIf mouseX = 52 And mouseY = 19 Then
            PaintBrush = 128
        ElseIf mouseX = 51 And mouseY = 19 Then
            PaintBrush = 129
        ElseIf mouseX = 50 And mouseY = 19 Then
            PaintBrush = 130
        ElseIf mouseX = 49 And mouseY = 19 Then
            PaintBrush = 131
        ElseIf mouseX = 48 And mouseY = 19 Then
            PaintBrush = 132
        ElseIf mouseX = 47 And mouseY = 19 Then
            PaintBrush = 133

        End If

        Select Case PaintBrush
            Case 0

            Case 1 ' WHITE
                Map(mMapX, mMapY, 0) = 1
            Case 2 ' BLACK
                Map(mMapX, mMapY, 0) = 2
            Case 3 ' GRAY
                Map(mMapX, mMapY, 0) = 3
            Case 4 ' SILVER
                Map(mMapX, mMapY, 0) = 4
            Case 5 ' LIGHTGRAY
                Map(mMapX, mMapY, 0) = 5
            Case 6 ' GAINSBORO
                Map(mMapX, mMapY, 0) = 6
            Case 7 ' WHITESMOKE
                Map(mMapX, mMapY, 0) = 7


            Case 8 ' WHITE
                Map(mMapX, mMapY, 0) = 8
            Case 9 ' BLACK
                Map(mMapX, mMapY, 0) = 9
            Case 10 ' GRAY
                Map(mMapX, mMapY, 0) = 10
            Case 11 ' SILVER
                Map(mMapX, mMapY, 0) = 11
            Case 12 ' LIGHTGRAY
                Map(mMapX, mMapY, 0) = 12
            Case 13 ' GAINSBORO
                Map(mMapX, mMapY, 0) = 13
            Case 14 ' WHITESMOKE
                Map(mMapX, mMapY, 0) = 14

            Case 15 ' LIGHTCORAL
                Map(mMapX, mMapY, 0) = 15
            Case 16 ' ROSYBROWN
                Map(mMapX, mMapY, 0) = 16
            Case 17 ' MISTYROSE
                Map(mMapX, mMapY, 0) = 17
            Case 18 ' SALMON
                Map(mMapX, mMapY, 0) = 18
            Case 19 ' CRIMSON
                Map(mMapX, mMapY, 0) = 19
            Case 20 ' DARKSALMON
                Map(mMapX, mMapY, 0) = 20
            Case 21 ' CORAL
                Map(mMapX, mMapY, 0) = 21

            Case 22 ' ORANGERED
                Map(mMapX, mMapY, 0) = 22
            Case 23 ' LIGHTSALMON
                Map(mMapX, mMapY, 0) = 23
            Case 24 ' SIENNA
                Map(mMapX, mMapY, 0) = 24
            Case 25 ' SEASHELL
                Map(mMapX, mMapY, 0) = 25
            Case 26 ' CHOCOLATE
                Map(mMapX, mMapY, 0) = 26
            Case 27 ' SADDLEBROWN
                Map(mMapX, mMapY, 0) = 27
            Case 28 ' SANDYBROWN
                Map(mMapX, mMapY, 0) = 28

            Case 29 ' PEACHPUFF
                Map(mMapX, mMapY, 0) = 29
            Case 30 ' PERU
                Map(mMapX, mMapY, 0) = 30
            Case 31 ' LINEN
                Map(mMapX, mMapY, 0) = 31
            Case 32 ' BISQUE
                Map(mMapX, mMapY, 0) = 32
            Case 33 ' DARKORANGE
                Map(mMapX, mMapY, 0) = 33
            Case 34 ' BURLYWOOD
                Map(mMapX, mMapY, 0) = 34
            Case 35 ' TAN
                Map(mMapX, mMapY, 0) = 35

            Case 36 ' AntiqueWhite
                Map(mMapX, mMapY, 0) = 36
            Case 37 ' NavajoWhite
                Map(mMapX, mMapY, 0) = 37
            Case 38 ' BlanchedAlmond
                Map(mMapX, mMapY, 0) = 38
            Case 39 ' PapayaWhip
                Map(mMapX, mMapY, 0) = 39
            Case 40 ' Moccasin
                Map(mMapX, mMapY, 0) = 40
            Case 41 ' Orange
                Map(mMapX, mMapY, 0) = 41
            Case 42 ' Wheat
                Map(mMapX, mMapY, 0) = 42

            Case 43 ' OldLace
                Map(mMapX, mMapY, 0) = 43
            Case 44 ' FloralWhite
                Map(mMapX, mMapY, 0) = 44
            Case 45 ' DarkGoldenrod
                Map(mMapX, mMapY, 0) = 45
            Case 46 ' Goldenrod
                Map(mMapX, mMapY, 0) = 46
            Case 47 ' Cornsilk
                Map(mMapX, mMapY, 0) = 47
            Case 48 ' Gold
                Map(mMapX, mMapY, 0) = 48
            Case 49 ' Khaki
                Map(mMapX, mMapY, 0) = 49

            Case 50 ' LemonChiffon
                Map(mMapX, mMapY, 0) = 50
            Case 51 ' PaleGoldenRod
                Map(mMapX, mMapY, 0) = 51
            Case 52 ' DarkKhaki
                Map(mMapX, mMapY, 0) = 52
            Case 53 ' Beige
                Map(mMapX, mMapY, 0) = 53
            Case 54 ' LightGoldenrodYellow
                Map(mMapX, mMapY, 0) = 54
            Case 55 ' Olive
                Map(mMapX, mMapY, 0) = 55
            Case 56 ' Yellow
                Map(mMapX, mMapY, 0) = 56

            Case 57 ' LightYellow
                Map(mMapX, mMapY, 0) = 57
            Case 58 ' Ivory
                Map(mMapX, mMapY, 0) = 58
            Case 59 ' OliveDrab
                Map(mMapX, mMapY, 0) = 59
            Case 60 ' YellowGreen
                Map(mMapX, mMapY, 0) = 60
            Case 61 ' DarkOliveGreen
                Map(mMapX, mMapY, 0) = 61
            Case 62 ' GreenYellow
                Map(mMapX, mMapY, 0) = 62
            Case 63 ' YChartreuse
                Map(mMapX, mMapY, 0) = 63

            Case 64 ' 
                Map(mMapX, mMapY, 0) = 64
            Case 65 ' 
                Map(mMapX, mMapY, 0) = 65
            Case 66 ' 
                Map(mMapX, mMapY, 0) = 66
            Case 67 ' 
                Map(mMapX, mMapY, 0) = 67
            Case 68 ' 
                Map(mMapX, mMapY, 0) = 68
            Case 69 ' 
                Map(mMapX, mMapY, 0) = 69
            Case 70 '
                Map(mMapX, mMapY, 0) = 70

            Case 71 ' 
                Map(mMapX, mMapY, 0) = 71
            Case 72 ' 
                Map(mMapX, mMapY, 0) = 72
            Case 73 ' 
                Map(mMapX, mMapY, 0) = 73
            Case 74 ' 
                Map(mMapX, mMapY, 0) = 74
            Case 75 ' 
                Map(mMapX, mMapY, 0) = 75
            Case 76 ' 
                Map(mMapX, mMapY, 0) = 76
            Case 77 '
                Map(mMapX, mMapY, 0) = 77

            Case 78 ' 
                Map(mMapX, mMapY, 0) = 78
            Case 79 ' 
                Map(mMapX, mMapY, 0) = 79
            Case 80 ' 
                Map(mMapX, mMapY, 0) = 80
            Case 81 ' 
                Map(mMapX, mMapY, 0) = 81
            Case 82 ' 
                Map(mMapX, mMapY, 0) = 82
            Case 83 ' 
                Map(mMapX, mMapY, 0) = 83
            Case 84 '
                Map(mMapX, mMapY, 0) = 84

            Case 85 ' 
                Map(mMapX, mMapY, 0) = 85
            Case 86 ' 
                Map(mMapX, mMapY, 0) = 86
            Case 87 ' 
                Map(mMapX, mMapY, 0) = 87
            Case 88 ' 
                Map(mMapX, mMapY, 0) = 88
            Case 89 ' 
                Map(mMapX, mMapY, 0) = 89
            Case 90 ' 
                Map(mMapX, mMapY, 0) = 90
            Case 91 '
                Map(mMapX, mMapY, 0) = 91

            Case 92 ' 
                Map(mMapX, mMapY, 0) = 92
            Case 93 ' 
                Map(mMapX, mMapY, 0) = 93
            Case 94 ' 
                Map(mMapX, mMapY, 0) = 94
            Case 95 ' 
                Map(mMapX, mMapY, 0) = 95
            Case 96 ' 
                Map(mMapX, mMapY, 0) = 96
            Case 97 ' 
                Map(mMapX, mMapY, 0) = 97
            Case 98 '
                Map(mMapX, mMapY, 0) = 98

            Case 99 ' 
                Map(mMapX, mMapY, 0) = 99
            Case 100 ' 
                Map(mMapX, mMapY, 0) = 100
            Case 101 ' 
                Map(mMapX, mMapY, 0) = 101
            Case 102 ' 
                Map(mMapX, mMapY, 0) = 102
            Case 103 ' 
                Map(mMapX, mMapY, 0) = 103
            Case 104 ' 
                Map(mMapX, mMapY, 0) = 104
            Case 105 '
                Map(mMapX, mMapY, 0) = 105

            Case 106 ' 
                Map(mMapX, mMapY, 0) = 106
            Case 107 ' 
                Map(mMapX, mMapY, 0) = 107
            Case 108 ' 
                Map(mMapX, mMapY, 0) = 108
            Case 109 ' 
                Map(mMapX, mMapY, 0) = 109
            Case 110 ' 
                Map(mMapX, mMapY, 0) = 110
            Case 111 ' 
                Map(mMapX, mMapY, 0) = 111
            Case 112 '
                Map(mMapX, mMapY, 0) = 112

            Case 113 ' 
                Map(mMapX, mMapY, 0) = 113
            Case 114 ' 
                Map(mMapX, mMapY, 0) = 114
            Case 115 ' 
                Map(mMapX, mMapY, 0) = 115
            Case 116 ' 
                Map(mMapX, mMapY, 0) = 116
            Case 117 ' 
                Map(mMapX, mMapY, 0) = 117
            Case 118 ' 
                Map(mMapX, mMapY, 0) = 118
            Case 119 '
                Map(mMapX, mMapY, 0) = 119

            Case 120 ' 
                Map(mMapX, mMapY, 0) = 120
            Case 121 ' 
                Map(mMapX, mMapY, 0) = 121
            Case 122 ' 
                Map(mMapX, mMapY, 0) = 122
            Case 123 ' 
                Map(mMapX, mMapY, 0) = 123
            Case 124 ' 
                Map(mMapX, mMapY, 0) = 124
            Case 125 ' 
                Map(mMapX, mMapY, 0) = 125
            Case 126 '
                Map(mMapX, mMapY, 0) = 126

            Case 127 ' 
                Map(mMapX, mMapY, 0) = 127
            Case 128 ' 
                Map(mMapX, mMapY, 0) = 128
            Case 129 ' 
                Map(mMapX, mMapY, 0) = 129
            Case 130 ' 
                Map(mMapX, mMapY, 0) = 130
            Case 131 ' 
                Map(mMapX, mMapY, 0) = 131
            Case 132 ' 
                Map(mMapX, mMapY, 0) = 132
            Case 133 '
                Map(mMapX, mMapY, 0) = 133




        End Select

    End Sub

    Private Sub PictureBox11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox11.Click

    End Sub

    Private Sub PictureBox55_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub

    Private Sub PictureBox27_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox27.Click

    End Sub

    Private Sub PictureBox4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox4.Click

    End Sub

    Private Sub PictureBox4_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles PictureBox4.MouseHover
        PictureBox4.Image = My.Resources.PhoenixDarkInterface_0002s_0019_newprojectButtonGLOW

    End Sub

    Private Sub PictureBox4_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles PictureBox4.MouseLeave
        PictureBox4.Image = My.Resources.PhoenixDarkInterface_0002s_0019_newprojectButton
    End Sub

    Private Sub PictureBox5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox5.Click
    End Sub

    Private Sub PictureBox5_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles PictureBox5.MouseHover
        PictureBox5.Image = My.Resources.PhoenixDarkInterface_0002s_0018_openprojectButtonGlow
    End Sub

    Private Sub PictureBox5_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles PictureBox5.MouseLeave
        PictureBox5.Image = My.Resources.PhoenixDarkInterface_0002s_0018_openprojectButton
    End Sub

    Private Sub PictureBox6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox6.Click

    End Sub

    Private Sub PictureBox6_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles PictureBox6.MouseHover
        PictureBox6.Image = My.Resources.PhoenixDarkInterface_0002s_0017_saveprojectButtonGLOW
    End Sub

    Private Sub PictureBox6_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles PictureBox6.MouseLeave
        PictureBox6.Image = My.Resources.PhoenixDarkInterface_0002s_0017_saveprojectButton
    End Sub

    Private Sub PictureBox10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox10.Click

    End Sub

    Private Sub PictureBox10_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles PictureBox10.MouseHover
        PictureBox10.Image = My.Resources.PhoenixDarkInterface_0002s_0016_cutButtonGLOW

    End Sub

    Private Sub PictureBox10_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles PictureBox10.MouseLeave
        PictureBox10.Image = My.Resources.PhoenixDarkInterface_0002s_0016_cutButton
    End Sub

    Private Sub PictureBox9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox9.Click

    End Sub

    Private Sub PictureBox9_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles PictureBox9.MouseHover
        PictureBox9.Image = My.Resources.PhoenixDarkInterface_0002s_0015_copyButtonGLOW

    End Sub

    Private Sub PictureBox9_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles PictureBox9.MouseLeave
        PictureBox9.Image = My.Resources.PhoenixDarkInterface_0002s_0015_copyButton
    End Sub

    Private Sub PictureBox8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox8.Click

    End Sub

    Private Sub PictureBox8_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles PictureBox8.MouseHover
        PictureBox8.Image = My.Resources.PhoenixDarkInterface_0002s_0014_pasteButtonGLOW

    End Sub

    Private Sub PictureBox8_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles PictureBox8.MouseLeave
        PictureBox8.Image = My.Resources.PhoenixDarkInterface_0002s_0014_pasteButton
    End Sub

    Private Sub PictureBox7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox7.Click

    End Sub

    Private Sub PictureBox7_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles PictureBox7.MouseHover
        PictureBox7.Image = My.Resources.PhoenixDarkInterface_0002s_0013_deleteButtonGLOW

    End Sub

    Private Sub PictureBox7_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles PictureBox7.MouseLeave
        PictureBox7.Image = My.Resources.PhoenixDarkInterface_0002s_0013_deleteButton
    End Sub
End Class





Can someone please tell me where I've gone wrong? Thanks

Is This A Good Question/Topic? 0
  • +

Replies To: Issue with DrawGraphics()

#2 anonymous26  Icon User is offline

  • D.I.C Lover

Reputation: -4
  • View blog
  • Posts: 3,638
  • Joined: 26-November 10

Re: Issue with DrawGraphics()

Posted 15 December 2012 - 07:24 AM

You really, really need to break up this code into functions. It's so long I refuse to read it.

Anyway, back to your point. Your problem is likely caused by the fact that you are not redrawing a cell (or the entire grid) when a cell's color changes.
Was This Post Helpful? 1
  • +
  • -

#3 Olebendz  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 12-December 12

Re: Issue with DrawGraphics()

Posted 15 December 2012 - 08:07 AM

:oops:
If I could express how much I am banging my head for not realizing to refresh the grid - then I would express it.

I've resolved the issue :) thank you!
Was This Post Helpful? 0
  • +
  • -

#4 anonymous26  Icon User is offline

  • D.I.C Lover

Reputation: -4
  • View blog
  • Posts: 3,638
  • Joined: 26-November 10

Re: Issue with DrawGraphics()

Posted 15 December 2012 - 11:23 AM

No problem. :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1