none
Paint Like Program

    Question

  • So what I would like to do is make something that I could use to develop snowfall/rainfall/etc. forecasts for my website. What I need is something that would allow me to change the color of 10x10 box (I don't know what to use for it?) I would need to be able to select more than one of these boxes as it would be time consuming to select each box individually. The color would be depended upon the value which is in the color table. If I could just have someone help me with this I would appreciate it very much. Thank you very much for any help !!!


    • Edited by CarterJH Tuesday, August 27, 2013 9:07 PM
    Thursday, August 22, 2013 3:09 AM

Answers

  • This link is for the zipped project folder. And this link is for a zipped folder of files you may want although all of the drawings in it are resources in the project.


    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.


    Saturday, October 05, 2013 8:39 PM

All replies

  • I have tested the project, the only thing you have done is get an image from a website.

    What you can do to make it quite clear is that use the webbrowser control and local a page from a website.

    It will be quite easy than use the winform controls, cause you will need the data from a website.

    The image should be added to a "table" or "div" flags that make it easy to control the color for each "boxes".

    And how to create the page, you can consider to post the issue in the asp.net forum http://forums.asp.net.

    Have a nice day. :)


    remember make the reply as answer and vote the reply as helpful if it helps.

    Monday, August 26, 2013 2:31 AM
  • I have tested the project, the only thing you have done is get an image from a website.

    What you can do to make it quite clear is that use the webbrowser control and local a page from a website.

    It will be quite easy than use the winform controls, cause you will need the data from a website.

    The image should be added to a "table" or "div" flags that make it easy to control the color for each "boxes".

    And how to create the page, you can consider to post the issue in the asp.net forum http://forums.asp.net.

    Have a nice day. :)


    remember make the reply as answer and vote the reply as helpful if it helps.

    I don't quite understand what you mean?
    Monday, August 26, 2013 1:56 PM
  • Carter,

    I've been working on something for the forum which I hope to put by mid-week which is a Namespace that has a group of classes to access some features of Weather Underground.

    One (or more - haven't decided yet) will let you get weather maps, although from my experimention, they're somewhat limited. Rather than elaborate on something that I'm not yet sure about, would you like for me to notify you here when I finally do post it?

    It may or may not be something you can use, but might be worth a look anyway?


    Please call me Frank :)

    Monday, August 26, 2013 5:10 PM
  • Carter,

    I've been working on something for the forum which I hope to put by mid-week which is a Namespace that has a group of classes to access some features of Weather Underground.

    One (or more - haven't decided yet) will let you get weather maps, although from my experimention, they're somewhat limited. Rather than elaborate on something that I'm not yet sure about, would you like for me to notify you here when I finally do post it?

    It may or may not be something you can use, but might be worth a look anyway?


    Please call me Frank :)

    Yea I would like to see it. It maybe something that I could use.

    Mine I am trying to figure out is that you make your own forecast rather than polling it. I just can't seem to figure out how to do it.

    Monday, August 26, 2013 5:40 PM
  • Yea I would like to see it. It maybe something that I could use.

    Mine I am trying to figure out is that you make your own forecast rather than polling it. I just can't seem to figure out how to do it.

    This is early testing of this part of it, but I have it working out the URL to call then creating a new bitmap from that. That bitmap is then exposed as a read-only property of this particular class.

    As an example (radar):

    They have several options that I'm not exploring now - maybe in the future - but rather than me working out the bounding box (lat/lon pairs), I'm giving it a location and it works out the details from there.

    Right now this is quite preliminary though, but what do you think?


    Please call me Frank :)

    Monday, August 26, 2013 6:17 PM
  • Something that would also be nice if I could figure it out would be if I could get a way that you could draw a box and then grab this cities in the box and do something like a path cast.
    Monday, August 26, 2013 6:30 PM
  • Yea I would like to see it. It maybe something that I could use.

    Mine I am trying to figure out is that you make your own forecast rather than polling it. I just can't seem to figure out how to do it.

    This is early testing of this part of it, but I have it working out the URL to call then creating a new bitmap from that. That bitmap is then exposed as a read-only property of this particular class.

    As an example (radar):

    They have several options that I'm not exploring now - maybe in the future - but rather than me working out the bounding box (lat/lon pairs), I'm giving it a location and it works out the details from there.

    Right now this is quite preliminary though, but what do you think?


    Please call me Frank :)

    Looks good from what I can see..
    Monday, August 26, 2013 6:53 PM
  • I was just toying with what I'm going to call a "zoom level":

    I said "by mid-week" but I think realistically it'll be more like the end of the week, but I'll let you know. :)


    Please call me Frank :)


    Monday, August 26, 2013 7:09 PM
  • Does it display only radar ?? Nice to te the little MCS going through NY
    Monday, August 26, 2013 7:30 PM
  • Does it display only radar ?? Nice to te the little MCS going through NY

    MCS? What's that?

    "Well I don't know what it is, but I bet they have something at the drugstore that'll fix ya right up!"

    Honestly, I don't know what it is but my options are Radar, Satellite, and combination of the two.

    They also can provide animated ones, but I'll likely leave that for later. Right now I'd like to focus on static, single-frame images only.

    I just did this one for satellite:

    The construction of the URL for the combined one is vastly different though - so that'll take some trial and error to work out, but I'm thinking that I'll use an enum and let the user select which of the three they want returned.


    Please call me Frank :)

    Monday, August 26, 2013 7:44 PM
  • Trailing Stratiform Mesoscale Convective System (TS MCS)
    • Edited by CarterJH Monday, August 26, 2013 7:47 PM
    Monday, August 26, 2013 7:47 PM
  • Trailing Stratiform Mesoscale Convective System (TS MCS)

    Yea -- that was going to be my second guess ...

    No, I only have the three options that I enumerated earlier.

    Sorry then, but I'll carry on anyway. I've spent a fair amount of time on the whole of it (over 4000 lines of code in the Namespace right now).

    Hopefully some here will find use from it. ;-)


    Please call me Frank :)

    Monday, August 26, 2013 7:52 PM
  • Does it display only radar ?? Nice to te the little MCS going through NY

    MCS? What's that?

    "Well I don't know what it is, but I bet they have something at the drugstore that'll fix ya right up!"

    Honestly, I don't know what it is but my options are Radar, Satellite, and combination of the two.

    They also can provide animated ones, but I'll likely leave that for later. Right now I'd like to focus on static, single-frame images only.

    I just did this one for satellite:

    The construction of the URL for the combined one is vastly different though - so that'll take some trial and error to work out, but I'm thinking that I'll use an enum and let the user select which of the three they want returned.


    Please call me Frank :)

    I looked at Weather Undergrounds API's but I cant remember all that they offered...of course at that time I was looking for HTML code 
    Monday, August 26, 2013 7:52 PM
  • Holy crap that a lot of code!
    Monday, August 26, 2013 7:59 PM
  • I looked at Weather Undergrounds API's but I cant remember all that they offered...of course at that time I was looking for HTML code 

    I think I told you before that I've always been fascinated with the weather.

    Years ago I used to teach psychrometrics (not to be confused with psychometrics) at a technical college, so you can see the connection (sort of). You've seen my old posts about getting weather information as I remember showing you links to them.

    I too also remember seeing something about Weather Underground, and what I didn't like was their lack of documentation (although I later figured out that they ALL lack actually good documentation) and their severe restrictions on the "free" API. I do understand - heck, something has to pay these guys to do it!

    What opened my eyes back to it again were two posts that I got involved with:

    http://social.msdn.microsoft.com/Forums/vstudio/en-US/b98ad06f-c599-48e3-82df-9724245af99d/visual-basic-wundergroundcom-weather-api-using-xml-need-help

    and

    http://social.msdn.microsoft.com/Forums/vstudio/en-US/d9d0662c-a17d-49e3-b874-17bd4eda25d1/changing-labelitext-on-labels-1-through-20-is-this-possible

    In the latter one, I said something like "...a class would be nice to have...", so I've decided to make one.

    That's where this all started, as the old joke goes. ;-)


    Please call me Frank :)

    Monday, August 26, 2013 7:59 PM
  • Yea...I have never found any that are good useful APIs that are free. Allison House offers there data to developers which they offer a lot of reliable and useful data....its just expensive.
    Monday, August 26, 2013 8:10 PM
  • I've given up on the combined radar/satellte image. It turns out that it's vastly different - the paramaters can't be the same so it can't be an option (of the other ones).

    And with that, I now have a little more than 5000 lines:

    I think I'll let it rest there. ;-)

    This isn't for an end user - it's for developers to use. I'll start the documentation of it tomorrow and even that will take several days to complete, but I have to believe that at the end of it, some here will find use for it.

    There's a pretty good bit of information that it returns. The images here aren't a good example of the data that's pulled in - but in a few days time, I'll show that indeed there's a LOT of stuff it gets! More than I ever got from any of the others (so far at least).

    It's been an interesting journey. :)


    Please call me Frank :)

    Monday, August 26, 2013 8:53 PM
  • Do you have any Idea as to what I could do to make the individual pixels that you could asing a value to them and use it to build a graphical forecast? I've been trying to think of how to but I can't.

    It would be something similar to this:

    Monday, August 26, 2013 9:16 PM
  • Graphics is definitely not my strong suit, although some here (Acamar comes to mind) are VERY good with it.

    Let's see what others here might come back with. :)


    Please call me Frank :)

    Monday, August 26, 2013 9:20 PM
  • I had tried to use a RectangleShape and just change the color of the shape as according too its value but some ran into a few problems.
    Monday, August 26, 2013 9:30 PM
  • I had tried to use a RectangleShape and just change the color of the shape as according too its value but some ran into a few problems.

    I would think that a pixel-by-pixel way would be better (otherwise, what about zoom?).

    I bet others here like Acamar, John Wein and others - I bet they can advise you on it.

    Patience Danielson, patience! ;-)


    Please call me Frank :)

    Monday, August 26, 2013 9:35 PM
  • Yea...that what I was considering next, just have no idea how to do it. Of course the next thing I would need to be converted into a .jpg or .png. An zoom would not be an issue as it is much like paint, only rather than just a blank canvas you have an overlay of counties and color is value dependent .

    It be nice talking with you today Frank! Good luck with what you are working on developing. I could probably never code +5000 lines.

    Monday, August 26, 2013 9:49 PM
  • Yea...that what I was considering next, just have no idea how to do it. Of course the next thing I would need to be converted into a .jpg or .png. An zoom would not be an issue as it is much like paint, only rather than just a blank canvas you have an overlay of counties and color is value dependent .

    It be nice talking with you today Frank! Good luck with what you are working on developing. I could probably never code +5000 lines.

    I'll show you what I have in a few days.

    It might not be anything you can use, but I think you'll find it at least interesting to read through. :)


    Please call me Frank :)

    Monday, August 26, 2013 10:03 PM
  • Yea...that what I was considering next, just have no idea how to do it. Of course the next thing I would need to be converted into a .jpg or .png. An zoom would not be an issue as it is much like paint, only rather than just a blank canvas you have an overlay of counties and color is value dependent .

    It be nice talking with you today Frank! Good luck with what you are working on developing. I could probably never code +5000 lines.

    I'll show you what I have in a few days.

    It might not be anything you can use, but I think you'll find it at least interesting to read through. :)


    Please call me Frank :)

    I will definitely read through it to see how it all works and to see whether (Always confuse that with "weather")  I would be able to apply it to something down the road possibly...? Hey maybe I will be able to use it.
    Monday, August 26, 2013 10:15 PM
  • I made a few modifications to the forum to allow for easily changing elements (lower right) and tool bar bar functions. (From left to right: edit mode, forecast manager, save forecast grid, previous grid, next grid, undo last modification, grid sampler, changes value, select area, deselect all) 

    Could someone please help or explain to me how to get it so you can draw and modify the forecast grids pixel by pixel (Or in a similar way) and them help with some of the functions in the tool bar? Project files are here is you need them: http://fingerlakeswx.weebly.com/vb-project.html

    Thank You!

    When Form launches:

    Selecting and element for modification:

    Tuesday, August 27, 2013 10:36 PM
  • Do you have any Idea as to what I could do to make the individual pixels that you could asing a value to them and use it to build a graphical forecast? I've been trying to think of how to but I can't.

    How is your data related to a pixel position?   I assume that the color to be chosen is based on a value for a location.   To color pixels you need to know how that location relates to a pixel in the image.    If the image is not referenced to some coordinate system (such as Lat/Lon) that is also used to identify the location, then you can't do it.  Getting the relationship of the location to the pixel is the tricky bit - coloring a pixel in an image is easy.

    Tuesday, August 27, 2013 11:27 PM
  • Do you have any Idea as to what I could do to make the individual pixels that you could asing a value to them and use it to build a graphical forecast? I've been trying to think of how to but I can't.

    How is your data related to a pixel position?   I assume that the color to be chosen is based on a value for a location.   To color pixels you need to know how that location relates to a pixel in the image.    If the image is not referenced to some coordinate system (such as Lat/Lon) that is also used to identify the location, then you can't do it.  Getting the relationship of the location to the pixel is the tricky bit - coloring a pixel in an image is easy.

    How do I find the coordinates. An yes the color chossen is based upon the value for the location.
    Wednesday, August 28, 2013 12:26 AM
  • If this helps... the location is 232, 52 and size is 1672, 990
    Wednesday, August 28, 2013 1:20 AM
  • If this helps... the location is 232, 52 and size is 1672, 990

    Is the location in pixels, or some other coordinate system?

    Show a sample of your location/value data.

    Wednesday, August 28, 2013 1:22 AM
  • If this helps... the location is 232, 52 and size is 1672, 990

    Is the location in pixels, or some other coordinate system?

    Show a sample of your location/value data.

    pixels. Location/value data?
    Wednesday, August 28, 2013 1:24 AM
  • Carter the issue with your zipped project is you didn't include the image "C:\Users\Carter Humphreys\SkyDrive\AWIPS\GFESuite\CWA3.PNG" with the project which is supposed to be the image for the spacial editor picturebox.

    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.

    Wednesday, August 28, 2013 1:45 AM
  • Opps meant for that to be website url
    Wednesday, August 28, 2013 1:51 AM
  • Carter the issue with your zipped project is you didn't include the image "C:\Users\Carter Humphreys\SkyDrive\AWIPS\GFESuite\CWA3.PNG" with the project which is supposed to be the image for the spacial editor picturebox.

    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.

    Fixed. Replace with "http://fingerlakeswx.weebly.com/uploads/2/0/8/3/20835140/3099918_orig.png" or use the new file uploded
    Wednesday, August 28, 2013 1:54 AM
  • This code places a 10x10 semitransparent overlay centred at (232,52) in a picturebox.  

    Public Class Form1
    
        Dim Overlay As Bitmap = New Bitmap(10, 10)
    
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            PictureBox1.Image = Image.FromFile("C:\Users\Public\130949.jpg")
    
            Dim br As New SolidBrush(Color.FromArgb(100, 127, 127, 127))
            Dim g As Graphics = Graphics.FromImage(Overlay)
            g.FillRectangle(br, g.ClipBounds)
    
        End Sub
    
        Private Sub PictureBox1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Paint
            e.Graphics.DrawImage(Overlay, New Point(227, 47))
        End Sub
    End Class
    The color is arbitrary because I don't know how you are selecting it based on the value at that location. I have hardcoded the location because I don't know where your information about the value that applies to any particular location is coming from or why you decided that the particular location needed to be colored. 

    Wednesday, August 28, 2013 1:56 AM
  • "So what I would like to do is make something that I could use to develop snowfall/rainfall/etc. forecasts for my website. What I need is something that would allow me to change the color of 10x10 box (I don't know what to use for it?) I would need to be able to select more than one of these boxes as it would be time consuming to select each box individually. The color would be depended upon the value which is in the color table. If I could just have someone help me with this I would appreciate it very much. Thank you very much for any help !!!"

    Your explanation is limited. If I disregard the first sentence which is the main goal of the application then I'm left with changing colors of 10 X 10 boxes that can be selected.

    Well if the box locations are always static and you know the rectangle points for each box then this is a simple task. If you could provide your image you want to use and the locations for the rectangles (start point X, Y and width and height) I have no doubt numerous people could show you how to do that.

    As far as system colors go you can use the color dialog control or something like the following program. However it seems you're very limited in your requirements for a program that develops snowfall/rainfall/etc. forecasts.

     Public Class Form1
    
        Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            Me.CenterToScreen()
    
            Try
                Dim ColorName As System.Type = GetType(System.Drawing.Color)
                Dim ColorPropInfo As System.Reflection.PropertyInfo() = ColorName.GetProperties()
                For Each CPI As System.Reflection.PropertyInfo In ColorPropInfo
                    If CPI.PropertyType.Name = "Color" And CPI.Name <> "Transparent" Then
                        ListBox1.Items.Add(CPI.Name)
                    End If
                Next
            Catch ex As Exception
            End Try
    
            ListBox1.SelectedIndex = 0
    
        End Sub
    
        Private Sub ListBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListBox1.SelectedIndexChanged
            Me.BackColor = Color.FromName(ListBox1.SelectedItem.ToString)
        End Sub
    End Class
    


    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.

    Wednesday, August 28, 2013 2:14 AM
  • Ok so what I got from that is a gray 10x10. Really I only need box that can be colored over the white outlined counties...so starting locations is 222, 269 southeast to the location 850, 792.

     Color is based on the value, so if I use the color table below and then based upon the value selected the color will be computed 

    Wednesday, August 28, 2013 2:17 AM
  • I am logging off for the night, maybe we can figure it out in the morning. Thank you for your guys help today.
    Wednesday, August 28, 2013 2:28 AM
  • Ok so what I got from that is a gray 10x10. Really I only need box that can be colored over the white outlined counties...so starting locations is 222, 269 southeast to the location 850, 792.

     Color is based on the value, so if I use the color table below and then based upon the value selected the color will be computed 

    Well I think it would be simple to set 10X10 boxes on your image and then get the pixel color from your color map with a mouse click and set all of the boxes with that color or select whichever boxes at a time to set with that color. But what does that really do? Also a 10X 10 box in pixels is not very big. Its less than the black square in the image below.


    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.


    Wednesday, August 28, 2013 2:34 AM
  • Ok so what I got from that is a gray 10x10. Really I only need box that can be colored over the white outlined counties...so starting locations is 222, 269 southeast to the location 850, 792.

     Color is based on the value, so if I use the color table below and then based upon the value selected the color will be computed 

    Well I think it would be simple to set 10X10 boxes on your image and then get the pixel color from your color map with a mouse click and set all of the boxes with that color or select whichever boxes at a time to set with that color. But what does that really do? Also a 10X 10 box in pixels is not very big. Its less than the black square in the image below.


    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.



    Exactly what I want. Yes I realize 10x10 is very small but that's the size I wanted it to be. What do you mean "what will that really do?"
    • Edited by CarterJH Wednesday, August 28, 2013 2:47 AM
    Wednesday, August 28, 2013 2:44 AM
  • O.K. I'm going to work on your program and add those capabilities to it using my methods which may not be professional enough. Then I'll post the code here. Then you can make a copy of your project so you don't ruin the original and in the copy you can copy and past my code over the original code and run it. I'll post the image I'm using on the screen in my post. Then you can screen print it and open Paint, copy the image into paint and resize it to the size I am using in your program and load it into the PictureBox.

    I'll be done tomorrow some time probably.


    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.

    Wednesday, August 28, 2013 3:15 AM
  • Here's the Argb values for each color in your color map. You realize that trying to discern some of those colors in a ten pixel square on a basically black background will be next to impossible? I'm going to add an image to this post in a minute or two to show you what I mean.

    Well maybe not as bad as I thought.

    Color map
    
    None = Color A = 255 ... Color R = 201 ... Color G = 201 ... Color B = 201
    < 1 = Color A = 255 ... Color R = 145 ... Color G = 144 ... Color B = 191
    1-2 = Color A = 255 ... Color R = 182 ... Color G = 200 ... Color B = 255
    2-4 = Color A = 255 ... Color R = 91 ... Color G = 81 ... Color B = 255
    4-6 = Color A = 255 ... Color R = 14 ... Color G = 0 ... Color B = 255
    6-8 = Color A = 255 ... Color R = 133 ... Color G = 12 ... Color B = 255
    8-10 = Color A = 255 ... Color R = 207 ... Color G = 3 ... Color B = 255
    10-12 = Color A = 255 ... Color R = 128 ... Color G = 72 ... Color B = 132
    12-14 = Color A = 255 ... Color R = 132 ... Color G = 1 ... Color B = 80
    14-16 = Color A = 255 ... Color R = 159 ... Color G = 124 ... Color B = 255
    16-18 = Color A = 255 ... Color R = 196 ... Color G = 0 ... Color B = 44
    18-20 = Color A = 255 ... Color R = 255 ... Color G = 91 ... Color B = 115
    20-22 = Color A = 255 ... Color R = 224 ... Color G = 35 ... Color B = 17
    22-26 = Color A = 255 ... Color R = 224 ... Color G = 131 ... Color B = 68
    26-30 = Color A = 255 ... Color R = 224 ... Color G = 185 ... Color B = 132
    > 30 = Color A = 255 ... Color R = 127 ... Color G = 79 ... Color B = 2


    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.


    Wednesday, August 28, 2013 3:50 AM
  • Ok so what I got from that is a gray 10x10. Really I only need box that can be colored over the white outlined counties...so starting locations is 222, 269 southeast to the location 850, 792.

    That's the problem with your data.  How do you 'know' that the area of interest is "222, 269 southeast to the location 850, 792" and how do you 'know' what the color value for this area is?  These numbers just seem to be appearing out nothing.  If you want to be able to code your program you have to know what these values are.   Is this data coming from a file, is it being downloaded from somewhere, is it somehow embedded in the image, or what?

    Wednesday, August 28, 2013 4:08 AM
  • Well I'm at this point.

    I'm painting the Color Table in PictureBox called ColorTable right now. When I provide the code tomorrow you can just make an image from the ColorTable PictureBox and save that and quite painting the picture box then load it with the image. That way if you increase the size of the ColorTable PictureBox by maximizing the form or something then the image can be set to stretch. Although you may lose some detail in the drawn strings on the image.

    I have mouse events for the ColorTable PictureBox so if you double click on it you retrieve whatever color you double click on. So you don't want to double click on the string words in white in it to get the color that you will want to change the squares in the different counties to.

    I plan to name the counties with just County1 to County14. You will be able to "move" each counties square wherever you want it displayed in the county.

    There will be a multiselect listbox or something with all the counties names in it. You will be able to select individual or multiple counties and select a color from the ColorTable (double clicking on it) to give your selections their color.


    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.

    Wednesday, August 28, 2013 5:24 AM
  • Do you have any Idea as to what I could do to make the individual pixels that you could asing a value to them and use it to build a graphical forecast? I've been trying to think of how to but I can't.

    It would be something similar to this:

    First you would need a blank image of that map with just the gray areas and black and red lines on it.

    Notice how this maps background has thin Black lines dividing the counties and thicker black lines for something or another. As well as some red color for lines that I suppose represent roads or rivers or something. And the background is some gray color.

    Then there are colors that I suppose are blue, purple and magenta and dark magenta which are the colors used to represent 4-6, 6-8, 8-10 and 10-12 inch snow fall. Notice how those colors overwrite any gray colors but no black colors or red colors or white colors.

    The county names are black with white shadow effect and the snow depths are white so they don't get overwritten either.

    So basically you have the original map and you draw county names and snow fall amounts on it overwriting any color at their location which is no issue. Then for the snowfall colors you overwrite anything that isn't Black, White or Red with your colors.

    So assume that the map and the county names are permanent really. Just an Image.

    You could then use a mouse to get the coordinates of the outer border of all the interconnnected counties you will be working with. Which will then provide you with coordinates you can determine that  you can draw within but not outside of. You could do that by dragging the mouse along the borders and only getting coordinates of any black and red pixels within a certain rectangle from the mouse pointer where you drag the mouse.along the county borders.

    Then when you get done you have the coordinates that contain an area of all those counties which if drawn would represent basically the first image below.

    You could then creat a bitmap the same size as the original map and draw an image with those coordinates kind of like the second image below.

    And in the second image you could draw the red lines and get all pixel locations between the black lines on the left of area 1 and include all the red line pixel locations of area 1. Then on a copy of the actual map with pixel colors of a certain Color Table color for that area you could set all pixels in the area with set pixel to the picked color table color and not draw on black, red or white pixels that are in the locations you want to flood with the color table color. So area 1 would be done. Then for a area 2 you get all pixel locations between the two red lines, including the red lines and from the top black line to the bottom black line. Then flood that area with another color table color represent a different snow fall amount. And so on, and so on.

    Of course you wouldn't be doing this on your original map which would be the gray map with black lines outlining counties and the red lines doing whatever they do. You would use a copy of the original everytime you create a new map with your snow areas on it.


    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.

    Wednesday, August 28, 2013 7:40 AM
  • Do you have any Idea as to what I could do to make the individual pixels that you could asing a value to them and use it to build a graphical forecast? I've been trying to think of how to but I can't.

    It would be something similar to this:

    First you would need a blank image of that map with just the gray areas and black and red lines on it.

    Notice how this maps background has thin Black lines dividing the counties and thicker black lines for something or another. As well as some red color for lines that I suppose represent roads or rivers or something. And the background is some gray color.

    Then there are colors that I suppose are blue, purple and magenta and dark magenta which are the colors used to represent 4-6, 6-8, 8-10 and 10-12 inch snow fall. Notice how those colors overwrite any gray colors but no black colors or red colors or white colors.

    The county names are black with white shadow effect and the snow depths are white so they don't get overwritten either.

    So basically you have the original map and you draw county names and snow fall amounts on it overwriting any color at their location which is no issue. Then for the snowfall colors you overwrite anything that isn't Black, White or Red with your colors.

    So assume that the map and the county names are permanent really. Just an Image.

    You could then use a mouse to get the coordinates of the outer border of all the interconnnected counties you will be working with. Which will then provide you with coordinates you can determine that  you can draw within but not outside of. You could do that by dragging the mouse along the borders and only getting coordinates of any black and red pixels within a certain rectangle from the mouse pointer where you drag the mouse.along the county borders.

    Then when you get done you have the coordinates that contain an area of all those counties which if drawn would represent basically the first image below.

    You could then creat a bitmap the same size as the original map and draw an image with those coordinates kind of like the second image below.

    And in the second image you could draw the red lines and get all pixel locations between the black lines on the left of area 1 and include all the red line pixel locations of area 1. Then on a copy of the actual map with pixel colors of a certain Color Table color for that area you could set all pixels in the area with set pixel to the picked color table color and not draw on black, red or white pixels that are in the locations you want to flood with the color table color. So area 1 would be done. Then for a area 2 you get all pixel locations between the two red lines, including the red lines and from the top black line to the bottom black line. Then flood that area with another color table color represent a different snow fall amount. And so on, and so on.

    Of course you wouldn't be doing this on your original map which would be the gray map with black lines outlining counties and the red lines doing whatever they do. You would use a copy of the original everytime you create a new map with your snow areas on it.


    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.


    That could work for the pencil tool in the tool bar as you could draw the contours and then fill in the space btween contour lines. Of course the image was just an example of what I was trying to do so...it would be these me counties being used before.
    Wednesday, August 28, 2013 10:10 AM
  • Carter,

    I've been working on something for the forum which I hope to put by mid-week which is a Namespace that has a group of classes to access some features of Weather Underground.

    One (or more - haven't decided yet) will let you get weather maps, although from my experimention, they're somewhat limited. Rather than elaborate on something that I'm not yet sure about, would you like for me to notify you here when I finally do post it?

    It may or may not be something you can use, but might be worth a look anyway?


    Please call me Frank :)

    Yea I would like to see it. It maybe something that I could use.

    Mine I am trying to figure out is that you make your own forecast rather than polling it. I just can't seem to figure out how to do it.

    I have it posted here:

    http://social.msdn.microsoft.com/Forums/vstudio/en-US/10c8d7a3-b749-40e9-8253-966d5e8d6c42/weather-underground-some-help-getting-the-information-from-their-api


    Please call me Frank :)

    Wednesday, August 28, 2013 5:18 PM
  • Ok so what I got from that is a gray 10x10. Really I only need box that can be colored over the white outlined counties...so starting locations is 222, 269 southeast to the location 850, 792.

    That's the problem with your data.  How do you 'know' that the area of interest is "222, 269 southeast to the location 850, 792" and how do you 'know' what the color value for this area is?  These numbers just seem to be appearing out nothing.  If you want to be able to code your program you have to know what these values are.   Is this data coming from a file, is it being downloaded from somewhere, is it somehow embedded in the image, or what?

    I got the coordinators by placing something at the edge over the northwestern sector and then again on the southeastern sector. The color value will have to be determined by the the value put into the selected area.

    Wednesday, August 28, 2013 5:26 PM
  • Well it seems to be snowing early in the Finger Lakes region with the exception of Seneca and Steuben apparently which has the actual "None" square in it. Amazing really.

    I'm just about finished. Just need to do the process for removing rectangles from counties in case you didn't want to show one there or wanted to move one to a new location or something.

    It's not real pretty because I didn't add buttons to and use the Toolstrip. Or use a drop down list for the county names. Too lazy I suppose. Anyhow here's the current visual of the product.


    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.




    Wednesday, August 28, 2013 7:17 PM
  • Looks go so far...only thing is that rather than having it one rectangle per county would be better to have the hole map filed but I may be able to figure that part out. But anyway thanks for taking the time to do it you probably put a lot of work into this and you even got all the counties names correct!
    • Edited by CarterJH Wednesday, August 28, 2013 7:58 PM
    Wednesday, August 28, 2013 7:30 PM
  • Looks go so far...only thing is that rather than having it one rectangle per county would be better to have the hole map filed but I may be able to figure that part out. But anyway thanks for taking the time to do it you probably put a lot of work into this and you even got all the counties names correct!

    Well I don't think I'm going to work on it anymore today. I'll be done with it in the morning some time and post the code I used with explanations on how it works and what other controls you need on the form, etc. Personally I don't like it because it's too "clunky". But it puts one 11 X 11 square per county anywhere on the map. Had to go with 11 X 11 because the center point of the mouse click is where the square goes and from that point out in any direction will require an odd number of pixels to make a square.

    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.

    Wednesday, August 28, 2013 10:29 PM
  • ok. Thank You!
    Wednesday, August 28, 2013 11:16 PM
  • Well the layout of the Form is

    On the left are;
    Your ToolStrip.
    The ColorTable PictureBox (See below for information specific to this)
    The SpatialEditor PictureBox  (See below for information specific to this)
    The StatusStrip

    To the right are;
    Button1 (Set rectangle for county, allows user to set a rectangle location. Don't like it because the user can put it anywhere on the map.)
    Label2 (Provides instructions for setting a rectangle)
    Button2 (Cancel set rectangle)
    ListBox1 (Contains the list of counties on the Map)
    Label3 (Unnecessary, provides the color ref in hex of the color picked from the Color Table)
       To the right of ListBox1/Label3 are;
       Button3 (Change rectangle colors, allows the user to pick multiple counties which already contain rectangles and change all the rectangles to one color)
       Button4 (Cancel color change)
       Label4 (Under Button3, provides instructions for changing rectangle colors)
       Button5 (Remove rectangles, allows the user to remove rectangles for counties that contain rectangles. Counties can then have rectangles added again in new locations)
       Button6 (Cancel remove rectangles)
       Label5 (Under Button5. provides user with instructions for removing rectangles from counties)

    Beneath the ListBox are;
       RichTextBox1 (Unneccesary, for testing purposes only. End up with various information in it depending on the users actions)
       Label1 (To the right of the RTB, contains mouse coordinates when Spatial Editor is clicked on during specific mouse down events)

    The form is sized at runtime to 1290, 692.

    The ColorTable PictureBox has its "image" (the Color Table) painted on it. If you don't like anything about the "image" painted on it you can change it appropriately in the paint event. For example if you don't like any of the colors you can change them. But the colors are based on Argb and not system colors right now. As I had to get the Argb colors, of each box containg snowfall amounts, from the Color Table you displayed in one of your posts in this thread. When you pick a color from the Color Table using the mouse you can accidentally click on a white word. This errors the event you are getting ready to use and you are notified to start over. This PictureBox is sized and located on the form by my code at run time.

    The SpatialEditor PictureBox needs to be the exact size of the image that goes in it. As the area of the PictureBox is used to determine information relative to the image and not blank area in the PictureBox (mouse events returning e.X and e.Y coordinates for the mouse pointer in blank areas of a PictureBox would be bad). Which is why the image and PictureBox need to the the same size. My code sizes the PictureBox to 676, 579 and you can use the program Paint to load an image and resize the image using pixels and uncheck "Maintain aspect ratio". Then save the image to a different file or whatever if you don't want to alter the original image. You will need to alter the form load event and maybe the PictureBox properties as I have the form load event setting the image "SpatialEditor.Image = My.Resources.New_Map" and also I have the properties for the PictureBox set to use a file from My.Resources for the PictureBox image.

    To get the image for Spatial Editors PictureBox you can screen print this post and get the image for the Map using Paints select capability and copying the selected item then set Paint to New in the top left tab and don't save changes to untitled then paste on Paint and resize the image to to 676 x 579 pixels before saving it to a file. Note also that when you open Paint it has a white background (the canvas I suppose). This, for some reason, becomes part of the image when the image is saved. To resolve this from occuring when you first open Paint click on the white background. Then click on resize and make it like 50 X 50 pixels. Then exit Paint and when it asks you to save just hit no. Then open Paint again and when you copy an image to it the canvas will grow to support just the images size. So if you select an area of that image, copy it then hit new the canvas should be at 50 X 50 and will grow to the size of the copy when you paste it.

    No other controls are located or sized on the form at run time. Just text or color info are supplied. So you will need to size your controls to display information appropriately.

    So basically make a copy of your projects folder. Open up the copy in Visual Studio. On your project delete all of those labels or whatever they are off of the form as they are not used by my code and may interfere with something or relocate them maybe. Copy and paste my code over all the code in the forms code. It may be best at this point to change the forms and PictureBoxes properties sizes to the sizes I have in my code for them to run at at runtime. Also note that I set anchor properties at runtime for the PictureBoxes to top left also. You may want to change those in the PictureBoxes properties too.

    Obiously there are issues with the program. For example it doesn't save anything when closed. So you are starting out with a blank map when you open the program again (which is what I would do anyhow instead of re-using images already edited). But in a real editor if you already had a bunch of different maps (templates without data on them) then you could store info for the copy of that map last time you "edited" a copy of it in a database somewhere so you would already have like the county names available for the program to use for that map template rather than having all that info hard coded in the program. This would provide you the ability to overlay the new map with all the data from the last time you edited a copy of the map template so you wouldn't have to re-edit the copy totally again. Just change various info on it or something. A database would add a lot of functionality probably but I don't really know much about them or how to use them. I've only used a data table in one program before. I suppose that's a form of a database but not really sure if it saves data after the program closes. Can't remember.

    Recently I did a program where a PictureBox has both a background image and an image on it. The background image is just an image. The image is a transparent image that you can see the background image through. Instead of editing the background image you can edit the transparent image without affecting the background image. Since both images pixel locations match you can edit the image and if whatever you do looks like it will look right on the background image than you can use a function that takes all the transparent images data, except for the transparent pixels and overwrites all of the pixels on the background image with the pixel colors and locations from the transparent image. So if you drew a line on the transparent image you could erase it with an eraser (just swipe the mouse over it with an eraser that sets any pixel locations the eraser touches back to transparent) without affecting the background image but you could see the background image and how the line looks drawn above it on the transparent image. If the line looked good then you could add it to the background image. So you could do all your editing on the transparent image and when you get done, if it all looks good, you could "overlay" the background image with all the data. Check back on this thread in a couple of days or so and I'll post a copy of what I think you should be doing with an image editor maybe. I'll add some functionality to it so it does some things that may be what you want to do. Like the ability to draw an area of snow on the background image maybe.

    The "Set rectangle for county" function I don't like. It actually will set the rectangle anywhere on the map even though the user has to assign it to a county. But without knowing all of the counties pixel area there is no way to cancel the event and not allow the user to set the recangle outside of a county they are choosing to assign the rectangle to.

    Anyhow below is the code and below that an image of the program.

    Option Strict On
    
    Public Class Menu
    
        Dim ListOfLists As New List(Of Object)
        Dim ListOfRemoveRectangles As New List(Of Object)
        Dim RectangleIntegers As New List(Of Integer)
        Dim CayugaCounty As New List(Of Integer)
        Dim ChemungCounty As New List(Of Integer)
        Dim CortlandCounty As New List(Of Integer)
        Dim LivingstonCounty As New List(Of Integer)
        Dim MonroeCounty As New List(Of Integer)
        Dim OnondongaCounty As New List(Of Integer)
        Dim OntarioCounty As New List(Of Integer)
        Dim SchuylerCounty As New List(Of Integer)
        Dim SenecaCounty As New List(Of Integer)
        Dim SteubenCounty As New List(Of Integer)
        Dim TiogaCounty As New List(Of Integer)
        Dim TompkinsCounty As New List(Of Integer)
        Dim WayneCounty As New List(Of Integer)
        Dim YatesCounty As New List(Of Integer)
        Dim ChangeColorIndexes As New List(Of Integer)
    
        Dim ColorTableMousePointColor As Color = Color.Transparent
    
        Private Sub DateTimePicker1_ValueChanged(sender As Object, e As EventArgs) Handles DateTimePicker1.ValueChanged
            DateTimePicker1.Format = DateTimePickerFormat.Custom
            DateTimePicker1.CustomFormat = "HH:mm:ssZ dd-MMM-yy"
            Time.Text = DateTimePicker1.Text
        End Sub
    
        Private Sub Menu_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            DateTimePicker1.Format = DateTimePickerFormat.Custom
            DateTimePicker1.CustomFormat = "HH:mm:ssZ dd-MMM-yy"
            Me.BackColor = Color.PapayaWhip
            Me.Size = New Size(1290, 692)
            Me.MaximumSize = New Size(1290, 692)
            Me.MinimumSize = New Size(1290, 692)
            ColorTable.Anchor = AnchorStyles.Top Or AnchorStyles.Left
            ColorTable.Size = New Size(676, 28)
            ColorTable.Location = New Point(0, 25)
            ColorTable.BackColor = Color.Lime
            SpatialEditor.Anchor = AnchorStyles.Top Or AnchorStyles.Left
            SpatialEditor.Size = New Size(676, 579)
            SpatialEditor.Location = New Point(0, 51)
            SpatialEditor.BackColor = Color.Yellow
            SpatialEditor.Image = My.Resources.New_Map
            ListOfLists.Add(CayugaCounty)
            ListOfLists.Add(ChemungCounty)
            ListOfLists.Add(CortlandCounty)
            ListOfLists.Add(LivingstonCounty)
            ListOfLists.Add(MonroeCounty)
            ListOfLists.Add(OnondongaCounty)
            ListOfLists.Add(OntarioCounty)
            ListOfLists.Add(SchuylerCounty)
            ListOfLists.Add(SenecaCounty)
            ListOfLists.Add(SteubenCounty)
            ListOfLists.Add(TiogaCounty)
            ListOfLists.Add(TompkinsCounty)
            ListOfLists.Add(WayneCounty)
            ListOfLists.Add(YatesCounty)
            ListBox1.Items.Add("Cayuga County")  ' These names have to be in same order as they were added as objects in ListOfLists as their ListBox
            ListBox1.Items.Add("Chemung County")  ' index number is used to reference their index in ListOfLists.
            ListBox1.Items.Add("Cortland County")
            ListBox1.Items.Add("Livingston County")
            ListBox1.Items.Add("Monroe County")
            ListBox1.Items.Add("Onondonga County")
            ListBox1.Items.Add("Ontario County")
            ListBox1.Items.Add("Schuyler County")
            ListBox1.Items.Add("Seneca County")
            ListBox1.Items.Add("Steuben County")
            ListBox1.Items.Add("Tioga County")
            ListBox1.Items.Add("Tompkins County")
            ListBox1.Items.Add("Wayne County")
            ListBox1.Items.Add("Yates County")
            ListBox1.SelectionMode = SelectionMode.One
            Button1.Text = "Select rectangle" & vbCrLf & "for county"
            Button1.BackColor = Color.Aqua
            Button2.Text = "Cancel" & vbCrLf & "set" & vbCrLf & "rectangle"
            Button2.BackColor = Color.OrangeRed
            Button3.Text = "Change" & vbCrLf & "rectangle" & vbCrLf & "colors"
            Button3.BackColor = Color.Lime
            Button4.Text = "Cancel" & vbCrLf & "color" & vbCrLf & "change"
            Button4.BackColor = Color.OrangeRed
            Button5.Text = "Remove" & vbCrLf & "rectangles"
            Button5.BackColor = Color.Lime
            Button6.Text = "Cancel" & vbCrLf & "remove" & vbCrLf & "rectangles"
            Button6.BackColor = Color.OrangeRed
            Label1.Text = "Waiting"
            Label1.BackColor = Color.GhostWhite
            Label2.Text = "Waiting"
            Label2.BackColor = Color.GhostWhite
            Label3.Text = "Waiting"
            Label3.BackColor = Color.GhostWhite
            Label4.Text = "Waiting"
            Label4.BackColor = Color.GhostWhite
            Label5.Text = "Waiting"
            Label5.BackColor = Color.GhostWhite
            Time.Text = DateTimePicker1.Text
            Timer1.Interval = 10
            Timer1.Start()
        End Sub
    
        Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
            DateTimePicker1.Value = Now.AddHours(4)
        End Sub
    
        Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
            Button1.Enabled = False
            Button1.BackColor = Color.Orange
            ListBox1.SelectionMode = SelectionMode.One
            ListBox1.SelectedIndex = -1
            Label2.Text = "1. Click the mouse on a color on the color bar." & vbCrLf & "2. Click on a county on the map where you" & vbCrLf _
                & "desire to add a rectangle. The center of the" & vbCrLf & "rectangle will be the point that you click on." & vbCrLf _
                & "3. Select a single county from the ListBox to" & vbCrLf & "add a rectangle to."
            AddRectangle = True
        End Sub
    
        Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
            AddRectangle = False
            RectangleIntegers.Clear()
            Button1.BackColor = Color.Aqua
            Button1.Enabled = True
            Label2.Text = "Waiting"
        End Sub
    
        Dim ChangeColorsInt As Integer = 0
    
        Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
            ListBox1.SelectedIndex = -1
            ChangeColorIndexes.Clear()
            Button3.BackColor = Color.Orange
            ListBox1.SelectionMode = SelectionMode.MultiSimple
            Label4.Text = "1. Select all the entries in the ListBox" & vbCrLf & "that you want to change colors for." & vbCrLf _
                & "2. Select the color from the Color Bar" & vbCrLf & "That you desire to use."
            ChangeColors = True
            ChangeColorsInt = 1
        End Sub
    
        Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
            RichTextBox1.Text = ""
            Button3.BackColor = Color.Lime
            ListBox1.SelectionMode = SelectionMode.One
            ListBox1.SelectedIndex = -1
            Label4.Text = "Waiting"
            ChangeColors = False
            ChangeColorsInt = 0
        End Sub
    
        Dim RemoveRectanglesInt As Integer = 0
    
        Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
            If RemoveRectanglesInt = 0 Then
                ListBox1.SelectedIndex = -1
                ChangeColorIndexes.Clear()
                Button5.BackColor = Color.Orange
                ListBox1.SelectionMode = SelectionMode.MultiSimple
                Label5.Text = "1. Select all the entries in the ListBox" & vbCrLf & "that you want to remove rectangles from." & vbCrLf _
                    & "2. Select the color from the Color Bar" & vbCrLf & "That you desire to use." & vbCrLf & "3. Press """"Remove rectangles"""" again."
                RemoveRectangles = True
                RemoveRectanglesInt = 1
            Else
                RemoveRectangles = False
                RemoveRectanglesInt = 0
                ListBox1.SelectedIndex = -1
                Button5.BackColor = Color.Lime
                For Each Item In ListOfRemoveRectangles
                    Dim Pass As Boolean = VerifyListStatus(CType(Item, Global.System.Collections.Generic.List(Of Integer)))
                    If Pass = False Then
                        RichTextBox1.Text = ""
                        Button5.BackColor = Color.Lime
                        ListBox1.SelectionMode = SelectionMode.One
                        ListBox1.SelectedIndex = -1
                        Label5.Text = "Waiting"
                        RemoveRectangles = False
                        RemoveRectanglesInt = 0
                        RemoveRectanglesForCounties(CType(Item, Global.System.Collections.Generic.List(Of Integer)))
                    ElseIf Pass = True Then
                        ListOfRemoveRectangles.Clear()
                        RichTextBox1.Text = ""
                        Button5.BackColor = Color.Lime
                        ListBox1.SelectionMode = SelectionMode.One
                        ListBox1.SelectedIndex = -1
                        Label5.Text = "Waiting"
                        RemoveRectangles = False
                        RemoveRectanglesInt = 0
                        MessageBox.Show("Remove rectangles exited due to one" & vbCrLf & "of the chosen counties has no rectangle." & vbCrLf & "Please try again")
                        Exit Sub
                    End If
                Next
            End If
        End Sub
    
        Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
            RichTextBox1.Text = ""
            Button5.BackColor = Color.Lime
            ListBox1.SelectionMode = SelectionMode.One
            ListBox1.SelectedIndex = -1
            Label5.Text = "Waiting"
            RemoveRectangles = False
            RemoveRectanglesInt = 0
        End Sub
    
        Dim AddRectangle As Boolean = False
        Dim ChangeColors As Boolean = False
        Dim RemoveRectangles As Boolean = False
    
        Private Sub ListBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListBox1.SelectedIndexChanged
            If AddRectangle = True Then
                Dim i As Integer = ListBox1.SelectedIndex
                If RectangleIntegers.Count > 0 Then
                    Dim Pass As Boolean = VerifyListStatus(CType(ListOfLists(i), Global.System.Collections.Generic.List(Of Integer)))
                    If Pass = True Then
                        For Each Item In RectangleIntegers
                            AddToLists(CType(ListOfLists(i), Global.System.Collections.Generic.List(Of Integer)), Item)
                        Next
                        RectangleIntegers.Clear()
                        AddRectangleToSpatialEditorImage(CType(ListOfLists(i), Global.System.Collections.Generic.List(Of Integer)), ColorTableMousePointColor)
                    Else
                        AddRectangle = False
                        Button1.BackColor = Color.Aqua
                        Button1.Enabled = True
                        Label2.Text = "Waiting"
                        RectangleIntegers.Clear()
                        MessageBox.Show(ListBox1.SelectedItem.ToString & " already contains a rectangle. Please remove it if you want to" & vbCrLf _
                                        & "add a new rectangle to " & ListBox1.SelectedItem.ToString & ".")
                    End If
                    ListBox1.SelectedIndex = -1
                End If
            End If
            If ChangeColors = True Then
                RichTextBox1.Text = ""
                ChangeColorIndexes.Clear()
                For Each Item In ListBox1.SelectedIndices
                    ChangeColorIndexes.Add(CInt(Item))
                    RichTextBox1.AppendText(Item.ToString & vbCrLf)
                Next
            End If
            If RemoveRectangles = True Then
                ListOfRemoveRectangles.Clear()
                RichTextBox1.Text = ""
                ChangeColorIndexes.Clear()
                If ListBox1.SelectedIndices.Count > 0 Then
                    For Each Item In ListBox1.SelectedIndices
                        ListOfRemoveRectangles.Add(ListOfLists(CInt(Item)))
                        RichTextBox1.AppendText(Item.ToString & vbCrLf)
                    Next
                End If
            End If
        End Sub
    
        Private Sub ColorTable_MouseDown(sender As Object, e As MouseEventArgs) Handles ColorTable.MouseDown
            If AddRectangle = True Then
                Dim MousePointColorImage As New Bitmap(ColorTable.Width, ColorTable.Height)
                ColorTable.DrawToBitmap(MousePointColorImage, ColorTable.DisplayRectangle)
                ColorTableMousePointColor = MousePointColorImage.GetPixel(e.X, e.Y)
                MousePointColorImage.Dispose()
                Label3.Text = ColorTableMousePointColor.Name
                If ColorTableMousePointColor = Color.FromArgb(255, 255, 255, 255) Then
                    AddRectangle = False
                    Button1.Enabled = True
                    Button1.BackColor = Color.Aqua
                    Label2.Text = "Waiting"
                    MessageBox.Show("Rectangle addition cancelled due to" & vbCrLf & "color white chosen from Color Table." & vbCrLf & "Please try again")
                End If
            End If
            If ChangeColors = True Then
                Dim MousePointColorImage As New Bitmap(ColorTable.Width, ColorTable.Height)
                ColorTable.DrawToBitmap(MousePointColorImage, ColorTable.DisplayRectangle)
                ColorTableMousePointColor = MousePointColorImage.GetPixel(e.X, e.Y)
                MousePointColorImage.Dispose()
                Label3.Text = ColorTableMousePointColor.Name
                If ColorTableMousePointColor = Color.FromArgb(255, 255, 255, 255) Then
                    ChangeColors = False
                    ChangeColorsInt = 0
                    Button3.BackColor = Color.Lime
                    Label4.Text = "Waiting"
                    MessageBox.Show("Change rectangle colors cancelled due to" & vbCrLf & "color white chosen from Color Table." & vbCrLf & "Please try again")
                Else
                    For Each Item In ChangeColorIndexes
                        Dim Pass As Boolean = VerifyListStatus(CType(ListOfLists(CInt(Item)), Global.System.Collections.Generic.List(Of Integer)))
                        If Pass = True Then
                            ChangeColors = False
                            ChangeColorsInt = 0
                            Button3.BackColor = Color.Lime
                            Label4.Text = "Waiting"
                            ListBox1.SelectionMode = SelectionMode.One
                            ListBox1.SelectedIndex = -1
                            MessageBox.Show("Change rectangle colors cancelled due to one" & vbCrLf & "of the chosen counties has no rectangle." & vbCrLf & "Please try again")
    
                            Exit Sub
                        End If
                    Next
                    ListBox1.SelectionMode = SelectionMode.One
                    For x = 0 To ChangeColorIndexes.Count - 1
                        ChangeCountyRectangleColors(CType(ListOfLists(ChangeColorIndexes(x)), Global.System.Collections.Generic.List(Of Integer)), ColorTableMousePointColor)
                    Next
                End If
            End If
        End Sub
    
        Private Sub SpatialEditor_MouseDown(sender As Object, e As MouseEventArgs) Handles SpatialEditor.MouseDown
            If AddRectangle = True Then
                RectangleIntegers.Clear()
                Label1.Text = e.X.ToString & " ... " & e.Y.ToString
                If e.X - 5 < 0 Or e.Y - 5 < 0 Or e.X + 11 > SpatialEditor.Right Or e.Y + 11 > SpatialEditor.Bottom Then
                    AddRectangle = False
                    Button1.Enabled = True
                    Button1.BackColor = Color.Aqua
                    Label2.Text = "Waiting"
                    MessageBox.Show("You are attempting to add a rectangle which will" & vbCrLf & "extend past the bounds of the image." & vbCrLf _
                                & "Please try again.")
                    Exit Sub
                Else
                    RectangleIntegers.Add(e.X - 5) ' Top left corner of rectangle ... Note that rectangle can not be 10 square because mouse pointer point
                    RectangleIntegers.Add(e.Y - 5) ' Top left corner of rectangle ... is used as the center of the rectangle.
                    RectangleIntegers.Add(11) '      Width of rectangle
                    RectangleIntegers.Add(11) '      Height of rectangle
                End If
            End If
            For Each Item In RectangleIntegers
                RichTextBox1.AppendText(Item.ToString & vbCrLf)
            Next
                RichTextBox1.AppendText("RectangleIntegers count = " & RectangleIntegers.Count.ToString & vbCrLf)
        End Sub
    
        Dim ColorTableFont As New Font("Cambria", 12, FontStyle.Bold)
        Dim Brush0 As New SolidBrush(Color.White)
        Dim Pen1 As New System.Drawing.Pen(Color.FromArgb(255, 201, 201, 201))
        Dim Brush1 As New SolidBrush(Color.FromArgb(255, 201, 201, 201))
        Dim Pen2 As New System.Drawing.Pen(Color.FromArgb(255, 145, 144, 191))
        Dim Brush2 As New SolidBrush(Color.FromArgb(255, 145, 144, 191))
        Dim Pen3 As New System.Drawing.Pen(Color.FromArgb(255, 182, 200, 255))
        Dim Brush3 As New SolidBrush(Color.FromArgb(255, 182, 200, 255))
        Dim Pen4 As New System.Drawing.Pen(Color.FromArgb(255, 91, 81, 255))
        Dim Brush4 As New SolidBrush(Color.FromArgb(255, 91, 81, 255))
        Dim Pen5 As New System.Drawing.Pen(Color.FromArgb(255, 14, 0, 255))
        Dim Brush5 As New SolidBrush(Color.FromArgb(255, 14, 0, 255))
        Dim Pen6 As New System.Drawing.Pen(Color.FromArgb(255, 133, 12, 255))
        Dim Brush6 As New SolidBrush(Color.FromArgb(255, 133, 12, 255))
        Dim Pen7 As New System.Drawing.Pen(Color.FromArgb(255, 207, 3, 255))
        Dim Brush7 As New SolidBrush(Color.FromArgb(255, 207, 3, 255))
        Dim Pen8 As New System.Drawing.Pen(Color.FromArgb(255, 128, 72, 132))
        Dim Brush8 As New SolidBrush(Color.FromArgb(255, 128, 72, 132))
        Dim Pen9 As New System.Drawing.Pen(Color.FromArgb(255, 132, 1, 80))
        Dim Brush9 As New SolidBrush(Color.FromArgb(255, 132, 1, 80))
        Dim Pen10 As New System.Drawing.Pen(Color.FromArgb(255, 159, 124, 255))
        Dim Brush10 As New SolidBrush(Color.FromArgb(255, 159, 124, 255))
        Dim Pen11 As New System.Drawing.Pen(Color.FromArgb(255, 196, 0, 44))
        Dim Brush11 As New SolidBrush(Color.FromArgb(255, 196, 0, 44))
        Dim Pen12 As New System.Drawing.Pen(Color.FromArgb(255, 255, 91, 115))
        Dim Brush12 As New SolidBrush(Color.FromArgb(255, 255, 91, 115))
        Dim Pen13 As New System.Drawing.Pen(Color.FromArgb(255, 224, 35, 17))
        Dim Brush13 As New SolidBrush(Color.FromArgb(255, 224, 35, 17))
        Dim Pen14 As New System.Drawing.Pen(Color.FromArgb(255, 224, 131, 68))
        Dim Brush14 As New SolidBrush(Color.FromArgb(255, 224, 131, 68))
        Dim Pen15 As New System.Drawing.Pen(Color.FromArgb(255, 224, 185, 132))
        Dim Brush15 As New SolidBrush(Color.FromArgb(255, 224, 185, 132))
        Dim Pen16 As New System.Drawing.Pen(Color.FromArgb(255, 127, 79, 2))
        Dim Brush16 As New SolidBrush(Color.FromArgb(255, 127, 79, 2))
    
        Private Sub ColorTable_Paint(sender As Object, e As PaintEventArgs) Handles ColorTable.Paint
    
            e.Graphics.DrawRectangle(Pen1, 0, 0, 46, 28)
            e.Graphics.FillRectangle(Brush1, 0, 0, 46, 28)
            e.Graphics.DrawString("None", ColorTableFont, Brush0, 0, 0)
    
            e.Graphics.DrawRectangle(Pen2, 47, 0, 36, 28)
            e.Graphics.FillRectangle(Brush2, 47, 0, 36, 28)
            e.Graphics.DrawString("< 1", ColorTableFont, Brush0, 50, 0)
    
            e.Graphics.DrawRectangle(Pen3, 83, 0, 42, 28)
            e.Graphics.FillRectangle(Brush3, 83, 0, 42, 28)
            e.Graphics.DrawString("1-2", ColorTableFont, Brush0, 88, 0)
    
            e.Graphics.DrawRectangle(Pen4, 125, 0, 43, 28)
            e.Graphics.FillRectangle(Brush4, 125, 0, 43, 28)
            e.Graphics.DrawString("2-4", ColorTableFont, Brush0, 134, 0)
    
            e.Graphics.DrawRectangle(Pen5, 168, 0, 42, 28)
            e.Graphics.FillRectangle(Brush5, 168, 0, 42, 28)
            e.Graphics.DrawString("4-6", ColorTableFont, Brush0, 174, 0)
    
            e.Graphics.DrawRectangle(Pen6, 210, 0, 42, 28)
            e.Graphics.FillRectangle(Brush6, 210, 0, 42, 28)
            e.Graphics.DrawString("6-8", ColorTableFont, Brush0, 216, 0)
    
            e.Graphics.DrawRectangle(Pen7, 252, 0, 42, 28)
            e.Graphics.FillRectangle(Brush7, 252, 0, 42, 28)
            e.Graphics.DrawString("8-10", ColorTableFont, Brush0, 253, 0)
    
            e.Graphics.DrawRectangle(Pen8, 294, 0, 43, 28)
            e.Graphics.FillRectangle(Brush8, 294, 0, 43, 28)
            e.Graphics.DrawString("10-12", ColorTableFont, Brush0, 291, 0)
    
            e.Graphics.DrawRectangle(Pen9, 337, 0, 42, 28)
            e.Graphics.FillRectangle(Brush9, 337, 0, 42, 28)
            e.Graphics.DrawString("12-14", ColorTableFont, Brush0, 333, 0)
    
            e.Graphics.DrawRectangle(Pen10, 379, 0, 42, 28)
            e.Graphics.FillRectangle(Brush10, 379, 0, 42, 28)
            e.Graphics.DrawString("14-16", ColorTableFont, Brush0, 376, 0)
    
            e.Graphics.DrawRectangle(Pen11, 421, 0, 42, 28)
            e.Graphics.FillRectangle(Brush11, 421, 0, 42, 28)
            e.Graphics.DrawString("16-18", ColorTableFont, Brush0, 418, 0)
    
            e.Graphics.DrawRectangle(Pen12, 463, 0, 43, 28)
            e.Graphics.FillRectangle(Brush12, 463, 0, 43, 28)
            e.Graphics.DrawString("18-20", ColorTableFont, Brush0, 460, 0)
    
            e.Graphics.DrawRectangle(Pen13, 506, 0, 42, 28)
            e.Graphics.FillRectangle(Brush13, 506, 0, 42, 28)
            e.Graphics.DrawString("20-22", ColorTableFont, Brush0, 503, 0)
    
            e.Graphics.DrawRectangle(Pen14, 548, 0, 42, 28)
            e.Graphics.FillRectangle(Brush14, 548, 0, 42, 28)
            e.Graphics.DrawString("22-26", ColorTableFont, Brush0, 546, 0)
    
            e.Graphics.DrawRectangle(Pen15, 590, 0, 42, 28)
            e.Graphics.FillRectangle(Brush15, 590, 0, 42, 28)
            e.Graphics.DrawString("26-30", ColorTableFont, Brush0, 588, 0)
    
            e.Graphics.DrawRectangle(Pen16, 632, 0, 43, 28)
            e.Graphics.FillRectangle(Brush16, 632, 0, 43, 28)
            e.Graphics.DrawString("> 30", ColorTableFont, Brush0, 635, 0)
    
        End Sub
    
        Private Function AddToLists(ByRef ListName As List(Of Integer), ByRef Numbers As Integer) As List(Of Integer)
            ListName.Add(Numbers)
            Button1.BackColor = Color.Aqua
            Button1.Enabled = True
            AddRectangle = False
            Label2.Text = "Waiting"
            Return Nothing
        End Function
    
        Private Function VerifyListStatus(ByRef ListName As List(Of Integer)) As Boolean
            RichTextBox1.Text = ""
            Dim Test As Boolean
            If ListName.Count > 0 Then
                RichTextBox1.AppendText(ListName.Count.ToString & vbCrLf)
                Test = False
            Else
                Test = True
            End If
            Return Test
        End Function
    
        Private Function AddRectangleToSpatialEditorImage(ByRef ListName As List(Of Integer), ByRef Rainbow As Color) As List(Of Integer)
            Dim g As Graphics = SpatialEditor.CreateGraphics
            Dim NewPen As New Pen(Rainbow, 1)
            Dim NewBrush As New SolidBrush(Rainbow)
            Dim NewImage As Image = SpatialEditor.Image
            g = Graphics.FromImage(NewImage)
            g.DrawRectangle(NewPen, ListName(0), ListName(1), ListName(2), ListName(3))
            g.FillRectangle(NewBrush, ListName(0), ListName(1), ListName(2), ListName(3))
            SpatialEditor.Image = NewImage
            Return Nothing
        End Function
    
        Private Function ChangeCountyRectangleColors(ByRef ListName As List(Of Integer), ByRef Rainbow As Color) As List(Of Integer)
            Dim g As Graphics = SpatialEditor.CreateGraphics
            Dim NewPen As New Pen(Rainbow, 1)
            Dim NewBrush As New SolidBrush(Rainbow)
            Dim NewImage As Image = SpatialEditor.Image
            g = Graphics.FromImage(NewImage)
            g.DrawRectangle(NewPen, ListName(0), ListName(1), ListName(2), ListName(3))
            g.FillRectangle(NewBrush, ListName(0), ListName(1), ListName(2), ListName(3))
            SpatialEditor.Image = NewImage
            ChangeColors = False
            ChangeColorsInt = 0
            Button3.BackColor = Color.Lime
            Label4.Text = "Waiting"
            ListBox1.SelectedIndex = -1
            Return Nothing
        End Function
    
        Private Function RemoveRectanglesForCounties(ByRef ListName As List(Of Integer)) As List(Of Integer)
            Dim g As Graphics = SpatialEditor.CreateGraphics
            Dim NewPen As New Pen(Color.FromArgb(255, 102, 102, 102), 1)
            Dim NewBrush As New SolidBrush(Color.FromArgb(255, 102, 102, 102))
            Dim NewImage As Image = SpatialEditor.Image
            g = Graphics.FromImage(NewImage)
            g.DrawRectangle(NewPen, ListName(0), ListName(1), ListName(2), ListName(3))
            g.FillRectangle(NewBrush, ListName(0), ListName(1), ListName(2), ListName(3))
            SpatialEditor.Image = NewImage
            ListName.Clear()
            Return Nothing
        End Function
    
    End Class

     

    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.

    Thursday, August 29, 2013 3:08 PM
  • Do you have the project file you could send me?
    Thursday, August 29, 2013 3:30 PM
  • Do you have the project file you could send me?

    You can download it here from my Sky Drive.

    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.

    Thursday, August 29, 2013 4:28 PM
  • Ok so mot of this works well. Would it recognize the color if you changed the color table? I see why you were confused by the 10x10 requirement I got to have it where you can fill all the counties. Do you think that would be an easy fix?
    Thursday, August 29, 2013 4:50 PM
  • Ok so mot of this works well. Would it recognize the color if you changed the color table? I see why you were confused by the 10x10 requirement I got to have it where you can fill all the counties. Do you think that would be an easy fix?

    "Ok so most of this works well. Would it recognize the color if you changed the color table?"

    It would recognize the color if you changed the color table. Just don't use white as a color (except for the words in the color table) since the program rejects white (the word color used in the color table) if the user accidentally clicks on a word in the color table instead of a color located in the color table. Although the program could be altered to find the next non-white color in the color table to use instead of rejecting the users request.

    "I see why you were confused by the 10x10 requirement I got to have it where you can fill all the counties. Do you think that would be an easy fix?"

    To fill a county specifically you have to determine all the pixel locations in the county.

    On the map in the app that would be simpler to do since each county is outlined by black pixels.

    On the map you originally provided each county was surrounded by pixels of different colors so I changed the entire map to only have a gray shade of Argb 255, 189, 189, 189 (I think) with the counties all surrounded only by black (Argb 255, 0, 0, 0). Although at the pixel level there may actually be incomplete lines surrounding counties which would lead to a program not finding a closed area until it reaches the border of the image if searching pixel by pixel within a county for all non-black pixels to represent a county.

    So there would be prerequisites on a map in the first place. Specifically that the counties be surrounded by a specific color and not variations of colors. And then any colors within the county you don't want to overwrite, like white for the words, would have to be known also. Since the county names on the map with the app are only white and not a variation of colors that would be easy.

    Although why do you want to overlay an entire county with a color? I thought from the previous Image you posted that you wanted to draw lines and between the lines represents an area, extending north to south, where snow is at a certain level (like in the image below). It's imperative to know exactly what you are wanting to do in order to provide an accurate capability in a program. Although both county filling and line drawing to fill north to south is possible too. In case you wanted each county to have a different color for some reason. Plus without a template map to work with when designing the code, that will always be the same color template for any other maps you use (i.e. rivers are always blue, roads are always anything but whatever the border colors are, names are anything but whatever border colors are, etc) it would be difficult to design code to distinguish map features.

    I'm not a meteorologist so I have no idea of what design capability comes into mind. Lets say the north south idea was implemented so between two lines a specific color was shown covering different areas within different counties north to south with snowfall at a particular level in just those areas (as other areas of the same county may have a different snowfall level). Now for the area between those lines (all in light blue for example) what if a small percentage of it has rain or sleet also. Well you may want to draw two horizontal lines on that area to place white dispersed rain drops and sleet in which do not extend through the whole blue area just a segment of it between the two horizontal lines you drew. And maybe another area in the same blue area has lightning and sleet so you want to draw two more horizontal lines on that blue area to represent a small area of the blue area and draw dispersed lightning bolts and sleet within that small area.

    You see this could get complex real quick. So what is your goal?


    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.





    Thursday, August 29, 2013 6:36 PM
  • Ok so mot of this works well. Would it recognize the color if you changed the color table? I see why you were confused by the 10x10 requirement I got to have it where you can fill all the counties. Do you think that would be an easy fix?

    "Ok so most of this works well. Would it recognize the color if you changed the color table?"

    It would recognize the color if you changed the color table. Just don't use white as a color (except for the words in the color table) since the program rejects white (the word color used in the color table) if the user accidentally clicks on a word in the color table instead of a color located in the color table. Although the program could be altered to find the next non-white color in the color table to use instead of rejecting the users request.

    "I see why you were confused by the 10x10 requirement I got to have it where you can fill all the counties. Do you think that would be an easy fix?"

    To fill a county specifically you have to determine all the pixel locations in the county.

    On the map in the app that would be simpler to do since each county is outlined by black pixels.

    On the map you originally provided each county was surrounded by pixels of different colors so I changed the entire map to only have a gray shade of Argb 255, 189, 189, 189 (I think) with the counties all surrounded only by black (Argb 255, 0, 0, 0). Although at the pixel level there may actually be incomplete lines surrounding counties which would lead to a program not finding a closed area until it reaches the border of the image if searching pixel by pixel within a county for all non-black pixels to represent a county.

    So there would be prerequisites on a map in the first place. Specifically that the counties be surrounded by a specific color and not variations of colors. And then any colors within the county you don't want to overwrite, like white for the words, would have to be known also. Since the county names on the map with the app are only white and not a variation of colors that would be easy.

    Although why do you want to overlay an entire county with a color? I thought from the previous Image you posted that you wanted to draw lines and between the lines represents an area, extending north to south, where snow is at a certain level (like in the image below). It's imperative to know exactly what you are wanting to do in order to provide an accurate capability in a program. Although both county filling and line drawing to fill north to south is possible too. In case you wanted each county to have a different color for some reason. Plus without a template map to work with when designing the code, that will always be the same color template for any other maps you use (i.e. rivers are always blue, roads are always anything but whatever the border colors are, names are anything but whatever border colors are, etc) it would be difficult to design code to distinguish map features.

    I'm not a meteorologist so I have no idea of what design capability comes into mind. Lets say the north south idea was implemented so between two lines a specific color was shown covering different areas within different counties north to south with snowfall at a particular level in just those areas (as other areas of the same county may have a different snowfall level). Now for the area between those lines (all in light blue for example) what if a small percentage of it has rain or sleet also. Well you may want to draw two horizontal lines on that area to place white dispersed rain drops and sleet in which do not extend through the whole blue area just a segment of it between the two horizontal lines you drew. And maybe another area in the same blue area has lightning and sleet so you want to draw two more horizontal lines on that blue area to represent a small area of the blue area and draw dispersed lightning bolts and sleet within that small area.

    You see this could get complex real quick. So what is your goal?


    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.





    Basically it needs to work as a grid, which is where the 10x10 came into play. My goal is this:

    You run the program, select an element (Example is weather condition (wx)), blank map or previous forecast grid. 

    Next you apply forecast to the grid to get something that would look like this:

    Thursday, August 29, 2013 7:18 PM
  • Another thing is with the tool in the tool strip called "Sample Tool" look like this  would allow you to go any where on the grid and sample the data (shown below)


    Thursday, August 29, 2013 7:29 PM
  • "You run the program, select an element (Example is weather condition (wx)), blank map or previous forecast grid."

    And where does this blank map come from? I would assume that a previous "forecast grid" would be a blank map that you previously altered with your program. And you consider the grid to be only the counties shown on the map whether it has a forecast overlaying those counties or not.

    "Next you apply forecast to the grid to get something that would look like this"

    Where do you get forecast and what is forecast? A bunch of pixel locations with different colors assigned to them? Is there a link to forecast on the internet so I can see what it is?

    Does the color table have to be altered because a new forecast uses different colors to denote specific events than the last forecast used so the words and colors in one color table no longer represent what a new forecast downloaded represents? Or what a new downloaded event represents?

    What are maxT, minT, T, Td, PoP, TSTM, FZRA, SLT, QPF, SnowAmt, TcaAccum, Sky, Wind, Windgust information? Why is (LAT) used? What does SFC Fcst and (F) mean? And does the color table have to change because one of these is processed?

    What if you picked all of these events (WX, maxT, minT, T, Td, PoP, TSTM, FZRA, SLT, QPF, SnowAmt, TcaAccum, Sky, Wind, Windgust)? Do you have then have to scroll through events to change the color table to represent each event depending on which event you want to sample data for?

    How would you tell the events apart?

    What does data sampling mean?

    Also why do you want to display the map in all black with borders that are poorly defined? Is that the way the map is downloaded or is that map your own creation? If the map is downloadable what is the link to it?

    What if you wanted to add stuff after all the events were chosen and loaded on the map like county names or whatever?

    Does the map ever change with regard to the counties listed on the map you currently show in your post? Or is the idea that any black map of any areas in the world can be used and the poorly defined borders will be in them also?

     The map you show not only has counties border lines in it but other lines that appear a yellowish color. One of them extends to up under the color table. Why are those lines in the map?


    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.


    Thursday, August 29, 2013 8:28 PM
  • Carter,

    Can you please give us an example of the source data that you use to determine the color of a particular pixel?  Acamar asked for this a while ago...

    I believe that the actual solution is very simple, we just need to understand the source data format so that we can design a routine to automatically draw the colored regions.

    Please post a few sample lines from your source data.


    Reed Kimble - "When you do things right, people won't be sure you've done anything at all"

    Thursday, August 29, 2013 8:45 PM
  • "You run the program, select an element (Example is weather condition (wx)), blank map or previous forecast grid."

    And where does this blank map come from? I would assume that a previous "forecast grid" would be a blank map that you previously altered with your program. And you consider the grid to be only the counties shown on the map whether it has a forecast overlaying those counties or not.

    The blank map is the overlay of counties. Yes a previous grid would be one of the previous forecast generated. The grid is 10x10 forecast boxes.

    ---

    "Next you apply forecast to the grid to get something that would look like this"

    Where do you get forecast and what is forecast? A bunch of pixel locations with different colors assigned to them? Is there a link to forecast on the internet so I can see what it is?

    That is actually a typo should have said "next you apply the forecast", meaning this is when you assign values to the grid.

    Does the color table have to be altered because a new forecast uses different colors to denote specific events than the last forecast used so the words and colors in one color table no longer represent what a new forecast downloaded represents? Or what a new downloaded event represents?

    Each element requires a different table because each one uses a specific value range. And nothing is downloaded from anywhere this is the forecast being generated by me.

    What are maxT, minT, T, Td, PoP, TSTM, FZRA, SLT, QPF, SnowAmt, TcaAccum, Sky, Wind, Windgust information? Why is (LAT) used? What does SFC Fcst and (F) mean? And does the color table have to change because one of these is processed?

    maxT = Maximum temperature

    minT = minimum temperature

    T = temperature

    Td = dewpoint

    PoP = Probability of Precipitation

    TSTM = Probability of Thunderstorm

    FZRA = Probability of Freezing Rain

    SLT = Probability of Sleet

    QPF = Quantitative Precipitation Forecast

    SnowAmt = Snowfall accumulation

    IceAccum = Ice Accumulation

    Wx = Predominant Weather

    Sky = % of Sky cover

    Wind = Sustained wind speed & Direction

    WindGust = Wind gust and direction

    "Lat" is irrelevant

    SFC Fcst = Surface forecast (As apposed to 850 mb, 500 mb, etc.)

    F =  degrees Fahrenheit

    Yes the color table is changed depending on which one is selected. (Except the temperature ones which will use the same ones)

    What if you picked all of these events (WX, maxT, minT, T, Td, PoP, TSTM, FZRA, SLT, QPF, SnowAmt, TcaAccum, Sky, Wind, Windgust)? Do you have then have to scroll through events to change the color table to represent each event depending on which event you want to sample data for?

    You should not be able to select more than one element. 

    How would you tell the events apart?

    The sample tool would have to know which element is selected.

    What does data sampling mean?

    To view the the value of the point plotted.

    Also why do you want to display the map in all black with borders that are poorly defined? Is that the way the map is downloaded or is that map your own creation? If the map is downloadable what is the link to it?

    That is the way the map was made.

    What if you wanted to add stuff after all the events were chosen and loaded on the map like county names or whatever?

    You could select map labels from the tool bar. (Not created yet)

    Does the map ever change with regard to the counties listed on the map you currently show in your post? Or is the idea that any black map of any areas in the world can be used and the poorly defined borders will be in them also?

    Counties in the background will not change. 

      The map you show not only has counties border lines in it but other lines that appear a yellowish color. One of them extends to up under the color table. Why are those lines in the map?

    State boundary of PA to the south, NJ to southeast, OH to southwest, Country boundary of  Canada to the north.


    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.


    Any more questions?
    Thursday, August 29, 2013 9:06 PM
  • Carter,

    Can you please give us an example of the source data that you use to determine the color of a particular pixel?  Acamar asked for this a while ago...

    I believe that the actual solution is very simple, we just need to understand the source data format so that we can design a routine to automatically draw the colored regions.

    Please post a few sample lines from your source data.


    Reed Kimble - "When you do things right, people won't be sure you've done anything at all"

    If I understand you correctly, you are asking where the data that determines the color of the pixel comes from? Mr. Monkey Boy had it where a color is selected from the color table without the need for data being polled from any where. 
    Thursday, August 29, 2013 9:13 PM
  • ...

    Where do you get forecast and what is forecast? A bunch of pixel locations with different colors assigned to them? Is there a link to forecast on the internet so I can see what it is?

    That is actually a typo should have said "next you apply the forecast", meaning this is when you assign values to the grid.

    Any more questions?

    Yes, the one above that did not get answered...

    My best guess right now is that you have some kind of file or data table that has something like:

    X    Y    Inch
    0    0    8
    1    0    8
    2    0    8
    3    0    10

    So there is a "grid" defined over the map area and each 10px-by-10px "cell" of the grid is linked to a particular snowfall amount.

    If that is correct than the remaining question is where the county borders come from, but perhaps that is the part you plan to draw by hand using the mouse to trace an existing "blank" map image.


    Reed Kimble - "When you do things right, people won't be sure you've done anything at all"

    Thursday, August 29, 2013 9:15 PM
  • ...

    Where do you get forecast and what is forecast? A bunch of pixel locations with different colors assigned to them? Is there a link to forecast on the internet so I can see what it is?

    That is actually a typo should have said "next you apply the forecast", meaning this is when you assign values to the grid.

    Any more questions?

    Yes, the one above that did not get answered...

    My best guess right now is that you have some kind of file or data table that has something like:

    X    Y    Inch
    0    0    8
    1    0    8
    2    0    8
    3    0    10

    So there is a "grid" defined over the map area and each 10px-by-10px "cell" of the grid is linked to a particular snowfall amount.

    If that is correct than the remaining question is where the county borders come from, but perhaps that is the part you plan to draw by hand using the mouse to trace an existing "blank" map image.


    Reed Kimble - "When you do things right, people won't be sure you've done anything at all"

    I did answer your question above your post. 

    I don't have any data table or file anywhere. What I need is a grid to be on top of the counties. The county borders are already placed into the form. So a blank map would just be the conties with no elements selected.

    Thursday, August 29, 2013 9:23 PM
  • "You run the program, select an element (Example is weather condition (wx)), blank map or previous forecast grid."

    And where does this blank map come from? I would assume that a previous "forecast grid" would be a blank map that you previously altered with your program. And you consider the grid to be only the counties shown on the map whether it has a forecast overlaying those counties or not.

    The blank map is the overlay of counties. Yes a previous grid would be one of the previous forecast generated. The grid is 10x10 forecast boxes.

    ---

    "Next you apply forecast to the grid to get something that would look like this"

    Where do you get forecast and what is forecast? A bunch of pixel locations with different colors assigned to them? Is there a link to forecast on the internet so I can see what it is?

    That is actually a typo should have said "next you apply the forecast", meaning this is when you assign values to the grid.

    Does the color table have to be altered because a new forecast uses different colors to denote specific events than the last forecast used so the words and colors in one color table no longer represent what a new forecast downloaded represents? Or what a new downloaded event represents?

    Each element requires a different table because each one uses a specific value range. And nothing is downloaded from anywhere this is the forecast being generated by me.

    What are maxT, minT, T, Td, PoP, TSTM, FZRA, SLT, QPF, SnowAmt, TcaAccum, Sky, Wind, Windgust information? Why is (LAT) used? What does SFC Fcst and (F) mean? And does the color table have to change because one of these is processed?

    maxT = Maximum temperature

    minT = minimum temperature

    T = temperature

    Td = dewpoint

    PoP = Probability of Precipitation

    TSTM = Probability of Thunderstorm

    FZRA = Probability of Freezing Rain

    SLT = Probability of Sleet

    QPF = Quantitative Precipitation Forecast

    SnowAmt = Snowfall accumulation

    IceAccum = Ice Accumulation

    Wx = Predominant Weather

    Sky = % of Sky cover

    Wind = Sustained wind speed & Direction

    WindGust = Wind gust and direction

    "Lat" is irrelevant

    SFC Fcst = Surface forecast (As apposed to 850 mb, 500 mb, etc.)

    F =  degrees Fahrenheit

    Yes the color table is changed depending on which one is selected. (Except the temperature ones which will use the same ones)

    What if you picked all of these events (WX, maxT, minT, T, Td, PoP, TSTM, FZRA, SLT, QPF, SnowAmt, TcaAccum, Sky, Wind, Windgust)? Do you have then have to scroll through events to change the color table to represent each event depending on which event you want to sample data for?

    You should not be able to select more than one element. 

    How would you tell the events apart?

    The sample tool would have to know which element is selected.

    What does data sampling mean?

    To view the the value of the point plotted.

    Also why do you want to display the map in all black with borders that are poorly defined? Is that the way the map is downloaded or is that map your own creation? If the map is downloadable what is the link to it?

    That is the way the map was made.

    What if you wanted to add stuff after all the events were chosen and loaded on the map like county names or whatever?

    You could select map labels from the tool bar. (Not created yet)

    Does the map ever change with regard to the counties listed on the map you currently show in your post? Or is the idea that any black map of any areas in the world can be used and the poorly defined borders will be in them also?

    Counties in the background will not change. 

      The map you show not only has counties border lines in it but other lines that appear a yellowish color. One of them extends to up under the color table. Why are those lines in the map?

    State boundary of PA to the south, NJ to southeast, OH to southwest, Country boundary of  Canada to the north.


    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.


    Any more questions?

    Why of course there's more questions.

    "The blank map is the overlay of counties. Yes a previous grid would be one of the previous forecast generated. The grid is 10x10 forecast boxes"

    Where can I get a copy of the blank map? I would like a copy so I can define county borders in a different color than PA's or NJ's or OH's or Canadas. And does the map have to be black for some reason? It's not a very good color to use IMO. Although the colors stand out on it greatly it's not really attractive IMO.

    Also I believe there is a way to create a color difuser which could be adjustable to write forecast color pixels every so many of the pixels on the map for a nicer effect. For example if the entire map were white with black borders for the counties you would get a semi transparent effect of the forecast overlay on the counties and the counties borders and county colors would show through.

    Also why does their have to be something called a grid made of 10 X 10 forecast boxes? If you used 10 X 10 boxes to place on the map for one areas colors the look would be chunky because a 10 X 10 square would really stick out when extending to the right or left. You wouldn't have a smooth transition between one boundary layer for snow depth as an example to the next boundary layer for a different snow depth for example if using the SnowAmt. You also wouldn't get a smooth transition between a box on a curved border area because the top left corner of the box may be on a curve, for example, and the left side of the box can't touch the left border. So there would be no placed to put forecast data between the box and the border as another box would not fit in that area because it's too narrow to hold a 10 X 10 box.

    "That is actually a typo should have said "next you apply the  forecast", meaning this is when you assign values to the grid"

    Where do you get these values from to assign them to the grid? Is there some location on the net that contains this information for a map of the size you are using? Are you just freehanding values onto the map from looking at another map to make it appear as the other map for the given "element" you have selected?

    "Each element requires a different table because each one uses a specific value range. And nothing is downloaded from anywhere this is the forecast being generated by me"

    So since you are generating the forecast where do you get the data for grid square locations?

    "To view the the value of the point plotted"

    Well if you knew that an area was plotted with specific information relative to a given element. like this area is 80 degrees and this other area is 81 degrees, it would be pretty simple that when the mouse is placed on the 80 degree area to know that all the pixels in that area are 80 degree pixels. So I'm just guessing that a sample collected from that area would need to read 80 when using the temperature element.

    "That is the way the map was made"

    So is changing it an option to make it more appealing?

    "Counties in the background will not change"

    I need to know if the template map will ever change at all. And I don't mean after you place a forecast on it. That is obvious. And what is the intent of the map after all of this is done? Is it now going to be made into an image to be relocated and used somewhere else for display with a specific forecast shown on it?


    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.

    Thursday, August 29, 2013 10:58 PM
  • "The blank map is the overlay of counties. Yes a previous grid would be one of the previous forecast generated. The grid is 10x10 forecast boxes"

    Where can I get a copy of the blank map? I would like a copy so I can define county borders in a different color than PA's or NJ's or OH's or Canadas. And does the map have to be black for some reason? It's not a very good color to use IMO. Although the colors stand out on it greatly it's not really attractive IMO.

    I'm not really worried about it being attractive, I would rather things stand out better.

    Also I believe there is a way to create a color difuser which could be adjustable to write forecast color pixels every so many of the pixels on the map for a nicer effect. For example if the entire map were white with black borders for the counties you would get a semi transparent effect of the forecast overlay on the counties and the counties borders and county colors would show through.

    That could possibly work. I however would like to keep the map black w/ white county borders

    Also why does their have to be something called a grid made of 10 X 10 forecast boxes? If you used 10 X 10 boxes to place on the map for one areas colors the look would be chunky because a 10 X 10 square would really stick out when extending to the right or left. You wouldn't have a smooth transition between one boundary layer for snow depth as an example to the next boundary layer for a different snow depth for example if using the SnowAmt. You also wouldn't get a smooth transition between a box on a curved border area because the top left corner of the box may be on a curve, for example, and the left side of the box can't touch the left border. So there would be no placed to put forecast data between the box and the border as another box would not fit in that area because it's too narrow to hold a 10 X 10 box.

    I don't mind the grid look. I can always smooth it out later on if needed. I don't like smoothed data anyway.

    "That is actually a typo should have said "next you apply the  forecast", meaning this is when you assign values to the grid"

    Where do you get these values from to assign them to the grid? Is there some location on the net that contains this information for a map of the size you are using? Are you just freehanding values onto the map from looking at another map to make it appear as the other map for the given "element" you have selected?

    A guess it would have to know what element is selected and then convert the color to a value. Not one, it would be the combination of many different forecast models to put together a forecast that best fits the situation.

    "Each element requires a different table because each one uses a specific value range. And nothing is downloaded from anywhere this is the forecast being generated by me"

    So since you are generating the forecast where do you get the data for grid square locations?

    Going with the above answer, the forecast model(s) that best fit the environment. 

    "To view the the value of the point plotted"

    Well if you knew that an area was plotted with specific information relative to a given element. like this area is 80 degrees and this other area is 81 degrees, it would be pretty simple that when the mouse is placed on the 80 degree area to know that all the pixels in that area are 80 degree pixels. So I'm just guessing that a sample collected from that area would need to read 80 when using the temperature element.

    Yes, if the color indicated 45% (Using PoP) than the sample to would need to read 45% for that pixel

    "That is the way the map was made"

    So is changing it an option to make it more appealing?

    As I said, I could change the color but I'm not worried about how attractive it is.

    "Counties in the background will not change"

    I need to know if the template map will ever change at all. And I don't mean after you place a forecast on it. That is obvious. And what is the intent of the map after all of this is done? Is it now going to be made into an image to be relocated and used somewhere else for display with a specific forecast shown on it?

    No the map will not change, I have not plans to be changing my forecast area. The forecast will need to be saved two ways. 1. For the program to recall the previous hours (or future); 2. To the computer in a .jpg or .png format.


    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.

    If you have anymore question I will try to answer as many as I can to get this so it works properly. 
    • Edited by CarterJH Thursday, August 29, 2013 11:28 PM thins --> things
    Thursday, August 29, 2013 11:22 PM
  • I have all the color tables and what elements they are used for are here: If they are needed

    http://fingerlakeswx.weebly.com/color-tables.html

    Thursday, August 29, 2013 11:39 PM
  • I have all the color tables and what elements they are used for are here: If they are needed

    http://fingerlakeswx.weebly.com/color-tables.html


    Well I need the map first. I can't use the map I have because it's not the same map as you have. And unless I use the map you have I can't attempt to do anything with it. And the map you have I need at the size you are going to use it at on your system. Although I can adjust it's size if necessary I need to keep it at the same scale dimension wise.

    Also you never provided how you enter values into the grid squares or where you get the values from to enter into grid squares. This is like the most important part of trying to do the app. As I said before are you just free handing it from another picture? I need to know how you plan to do this. I can't just guess as to how to enter values or why they should be entered in a certain fashion. And I can't imagine that you want to go grid square by grid square marking them with the mouse or something in order to color them. Also your grid will be a square larger than all of the counties so that all of the counties fit within a single square. I didn't take that into account before. But then to assign a grid square its value you would have to know what grid square numbers (i.e grid line 23, grid square 34 or something) that square is anyhow. I think it would be simpler to draw freehand pencil lines on the map and fill to whichever side of the line you want to fill to. Like in the first map above this post that has a yellow area, green area, light green area and red area. First you draw a line freehand that encloses the red area. Then the green area just reqires the line for the right side of it and fill anything black to the left of it that isn't red. And the light green area same thing. Then for the yellow area your line extends into the light green area so you tell it to overwrite any pixels within its boundaries or something. And fill grid squares all the way up so a 10 X 10 grid square may only get 64 of its pixels filled if it extends into an outer border that touches the blank map.

    So the forecast model that best fits the environment means what exactly? Is the forecast model a picture and you're jus transcribing the information of the picture onto your map by hand so it looks the same? Or does the forecast model have data with it to use to enter into grid square?


    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.



    Friday, August 30, 2013 12:47 AM
  • I had thought I gave you the map...dimensions are 1004x840


    Regards, ---------------------------------------------------------------------- Carter Humphreys

    Friday, August 30, 2013 1:15 AM
  • If I understand you correctly, you are asking where the data that determines the color of the pixel comes from? Mr. Monkey Boy had it where a color is selected from the color table without the need for data being polled from any where. 

    Ok, never mind the colors... How do you know the snow fall value for any given spot on the map?   Where is the data that relates a specific spot on the map to a specific snowfall level?

    Reed Kimble - "When you do things right, people won't be sure you've done anything at all"

    Friday, August 30, 2013 1:20 AM
  • Thanks. Although you still haven't mentioned how to provide values to the 10 X 10 squares in the grid.

    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.

    Friday, August 30, 2013 1:27 AM
  • I have all the color tables and what elements they are used for are here: If they are needed

    http://fingerlakeswx.weebly.com/color-tables.html


    Well I need the map first. I can't use the map I have because it's not the same map as you have. And unless I use the map you have I can't attempt to do anything with it. And the map you have I need at the size you are going to use it at on your system. Although I can adjust it's size if necessary I need to keep it at the same scale dimension wise.

    Also you never provided how you enter values into the grid squares or where you get the values from to enter into grid squares. This is like the most important part of trying to do the app. As I said before are you just free handing it from another picture? I need to know how you plan to do this. I can't just guess as to how to enter values or why they should be entered in a certain fashion. And I can't imagine that you want to go grid square by grid square marking them with the mouse or something in order to color them. Also your grid will be a square larger than all of the counties so that all of the counties fit within a single square. I didn't take that into account before. But then to assign a grid square its value you would have to know what grid square numbers (i.e grid line 23, grid square 34 or something) that square is anyhow. I think it would be simpler to draw freehand pencil lines on the map and fill to whichever side of the line you want to fill to. Like in the first map above this post that has a yellow area, green area, light green area and red area. First you draw a line freehand that encloses the red area. Then the green area just reqires the line for the right side of it and fill anything black to the left of it that isn't red. And the light green area same thing. Then for the yellow area your line extends into the light green area so you tell it to overwrite any pixels within its boundaries or something. And fill grid squares all the way up so a 10 X 10 grid square may only get 64 of its pixels filled if it extends into an outer border that touches the blank map.

    The values come from how you had it before selecting the color from the color table. I guess that the contour and then just fill between contour will be the best way for this to work unless you could select more than one cell in the grid at a time?

    So the forecast model that best fits the environment means what exactly?

    I would look at these four models (RAP, 10k NAM, GFS, ARW-E) and then decide which one has the best grip/handle on the temperature in this case at 11 PM EDT (03 UTC) So looking at current temperature  of 71 deg F and a dewpoint of 68 deg F shows that the temperatures will not drop that far off tonight so the GFS is out putting it at 50-60 deg F, NAM & ARW-E is also a little cool in the mid-60s, RAP has best handle putting temp @ 11 pm in the upper 60s.

    Is the forecast model a picture and you're jus transcribing the information of the picture onto your map by hand so it looks the same? Or does the forecast model have data with it to use to enter into grid square?

    Mostly it would be transcribing everything from the models to the image. 


    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.





    Regards, ---------------------------------------------------------------------- Carter Humphreys

    Friday, August 30, 2013 1:33 AM
  • If I understand you correctly, you are asking where the data that determines the color of the pixel comes from? Mr. Monkey Boy had it where a color is selected from the color table without the need for data being polled from any where. 


    Ok, never mind the colors... How do you know the snow fall value for any given spot on the map?   Where is the data that relates a specific spot on the map to a specific snowfall level?

    Reed Kimble - "When you do things right, people won't be sure you've done anything at all"

    With the example in the picture above the RGB value of the dark green area is 0 206 0 which some how would be converted to +RA (Heavy Rain)

    Regards, ---------------------------------------------------------------------- Carter Humphreys

    Friday, August 30, 2013 1:40 AM
  • If I understand you correctly, you are asking where the data that determines the color of the pixel comes from? Mr. Monkey Boy had it where a color is selected from the color table without the need for data being polled from any where. 


    Ok, never mind the colors... How do you know the snow fall value for any given spot on the map?   Where is the data that relates a specific spot on the map to a specific snowfall level?

    Reed Kimble - "When you do things right, people won't be sure you've done anything at all"

    With the example in the picture above the RGB value of the dark green area is 0 206 0 which some how would be converted to +RA (Heavy Rain)

    Regards, ---------------------------------------------------------------------- Carter Humphreys

    "The values come from how you had it before selecting the color from the color table. I guess that the contour and then just fill between contour will be the best way for this to work unless you could select more than one cell in the grid at a time?"

    Whoops, guess I missed that one.

    You could select grid squares by running the mouse over them. But I think it would be easier to draw a line freehand and let the program figure out what grid squares to color according to the line you draw.


    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.

    Friday, August 30, 2013 3:12 AM
  • Ok let's try that then. Thank you!!

    Regards, ---------------------------------------------------------------------Carter Humphreys

    Friday, August 30, 2013 3:29 AM
  • Ok let's try that then. Thank you!!

    Regards, ---------------------------------------------------------------------Carter Humphreys

    I redid the map to clean it up and verify no borders leached into another area. So here's the map I'll be working with. Hope it meets your expectations. I could thin up the states borders a bit but that's how they came out after setting all not black pixels to a new color. Then changing the color of all the non-state border lines to the yellowish color.


    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.


    Friday, August 30, 2013 4:06 AM
  • Ok let's try that then. Thank you!!


    Regards, ---------------------------------------------------------------------Carter Humphreys

    I redid the map to clean it up and verify no borders leached into another area. So here's the map I'll be working with. Hope it meets your expectations. I could thin up the states borders a bit but that's how they came out after setting all not black pixels to a new color. Then changing the color of all the non-state border lines to the yellowish color.


    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.


    No that line weight will work.

    Regards, ---------------------------------------------------------------------Carter Humphreys

    Friday, August 30, 2013 12:56 PM
  • Here is a simple example of how to define a "grid map" object that contains a grid of "cells" where each cell has an associated "data point" containing color and numeric information. This example just lets the user select a color to paint with, but your actual program would allow the user to construct a list of defined "data points" (a combination of a number or number range and a color) and then the user would select an entry from this list to paint with.

    The painting is performed on an invisible grid of 10x10 cells which overlays the form image.  Use the Load button in the sample to load an existing image (your "blank" map of counties) into the form.

    I believe all of the major components of what you are looking for are in this sample, you just need to expand upon it to make your actual program.  You would probably define a list of "GridMap" objects with an entry for each type of weather map you've defined.  There are also places where you can add code to improve efficiency (only repaint if something actually changed).

    If you wanted to save the composite image you could easily modify the SaveToJpeg method to draw the form's background image along with all of the GridMaps you define.

    Hopefully you or Mr Monkeyboy can get something useful out of this:

    Public Class Form1
        Private _MainMenu As New MenuStrip
        Private _Grid As New GridMap
        Private _IsMouseDown As Boolean
        Private _CurrentColor As Color = Color.Green
        Private _Mode As InputMode = InputMode.Sample
        Private _SelectionDelta As Point
    
        Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
            _MainMenu.Items.Add("Load", Nothing, AddressOf LoadMenu_Click)
            _MainMenu.Items.Add("Color", Nothing, AddressOf ColorMenu_Click)
            _MainMenu.Items.Add("Sample", Nothing, AddressOf SampleMenu_Click)
            _MainMenu.Items.Add("Paint", Nothing, AddressOf PaintMenu_Click)
            _MainMenu.Items.Add("Fill", Nothing, AddressOf FillMenu_Click)
            MainMenuStrip = _MainMenu
            Controls.Add(_MainMenu)
    
            Me.DoubleBuffered = True
            Me.ClientSize = New Size(1024, 768)
            Me.FormBorderStyle = Windows.Forms.FormBorderStyle.FixedSingle
            Me.MaximizeBox = False
            Me.BackgroundImageLayout = ImageLayout.None
    
            _Grid.Resize(Me)
        End Sub
    
        Private Sub Form1_MouseDown(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown
            Select Case _Mode
                Case InputMode.Paint
                    _IsMouseDown = True
                    SetCellColor(e)
                Case InputMode.Fill
                    _IsMouseDown = True
                    _SelectionDelta = e.Location
            End Select
        End Sub
    
        Private Sub Form1_MouseMove(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove
            If _Mode = InputMode.Paint AndAlso _IsMouseDown Then
                SetCellColor(e)
            ElseIf _Mode = InputMode.Fill Then
                Invalidate()
            End If
        End Sub
    
        Private Sub Form1_MouseUp(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseUp
            If _Mode = InputMode.Sample Then
                MessageBox.Show("Sampled color is " & _Grid(_Grid.IndexFromPosition(e.Location)).Color.ToString)
            Else
                If _Mode = InputMode.Fill Then
                    Dim bounds As Rectangle = GetSelectionBounds()
                    For y As Integer = bounds.Y To bounds.Y + bounds.Height - _Grid.CellSize.Height Step _Grid.CellSize.Height
                        For x As Integer = bounds.X To bounds.X + bounds.Width - _Grid.CellSize.Width Step _Grid.CellSize.Width
                            Dim idx As Point = _Grid.IndexFromPosition(x, y)
                            _Grid(idx) = DataPoint.AssignColor(_Grid(idx), _CurrentColor)
                        Next
                    Next
                End If
                _IsMouseDown = False
            End If
        End Sub
    
        Private Sub Form1_Paint(sender As Object, e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
            _Grid.DrawMap(e.Graphics)
            If _Mode = InputMode.Fill AndAlso _IsMouseDown Then
                Dim bounds As Rectangle = GetSelectionBounds()
                Using p As New Pen(SystemColors.Highlight)
                    e.Graphics.DrawRectangle(p, bounds)
                End Using
            End If
        End Sub
    
        Private Sub LoadMenu_Click(sender As Object, e As System.EventArgs)
            Using dlg As New OpenFileDialog With {.Filter = "Image Files|*.bmp;*.png;*.jpg", .FileName = String.Empty}
                If dlg.ShowDialog = Windows.Forms.DialogResult.OK Then
                    Me.BackgroundImage = Bitmap.FromFile(dlg.FileName)
                End If
            End Using
        End Sub
    
        Private Sub ColorMenu_Click(sender As Object, e As System.EventArgs)
            Using dlg As New ColorDialog With {.Color = _CurrentColor}
                If dlg.ShowDialog = Windows.Forms.DialogResult.OK Then
                    _CurrentColor = dlg.Color
                End If
            End Using
        End Sub
    
        Private Sub SampleMenu_Click(sender As Object, e As System.EventArgs)
            _Mode = InputMode.Sample
            Cursor = Cursors.Arrow
        End Sub
    
        Private Sub PaintMenu_Click(sender As Object, e As System.EventArgs)
            _Mode = InputMode.Paint
            Cursor = Cursors.Hand
        End Sub
    
        Private Sub FillMenu_Click(sender As Object, e As System.EventArgs)
            _Mode = InputMode.Fill
            Cursor = Cursors.Cross
        End Sub
    
        Private Sub SetCellColor(e As MouseEventArgs)
            Dim idx As Point = _Grid.IndexFromPosition(e.Location)
            If e.Button = Windows.Forms.MouseButtons.Left Then
                _Grid(idx) = DataPoint.AssignColor(_Grid(idx), _CurrentColor)
            ElseIf e.Button = Windows.Forms.MouseButtons.Right Then
                _Grid(idx) = DataPoint.AssignColor(_Grid(idx), Color.Empty)
            End If
            Invalidate()
        End Sub
    
        Private Function GetSelectionBounds() As Rectangle
            Dim current As Point = Me.PointToClient(MousePosition)
            Dim x1, x2, y1, y2 As Integer
            If _SelectionDelta.X < current.X Then
                x1 = _SelectionDelta.X
                x2 = current.X
            Else
                x1 = current.X
                x2 = _SelectionDelta.X
            End If
            If _SelectionDelta.Y < current.Y Then
                y1 = _SelectionDelta.Y
                y2 = current.Y
            Else
                y1 = current.Y
                y2 = _SelectionDelta.Y
            End If
            Return Rectangle.FromLTRB(x1, y1, x2, y2)
        End Function
    End Class
    
    Public Class GridMap
        Private _CellSize As New Size(10, 10)
        Public ReadOnly Property CellSize As Size
            Get
                Return _CellSize
            End Get
        End Property
    
        Private _Width As Integer
        Public ReadOnly Property Width As Integer
            Get
                Return _Width
            End Get
        End Property
    
        Private _Height As Integer
        Public ReadOnly Property Height As Integer
            Get
                Return _Height
            End Get
        End Property
    
        Private _Cells(,) As DataPoint
        Default Public Property Cell(x As Integer, y As Integer) As DataPoint
            Get
                Return _Cells(x, y)
            End Get
            Set(value As DataPoint)
                _Cells(x, y) = value
            End Set
        End Property
    
        Default Public Property Cell(index As Point) As DataPoint
            Get
                Return _Cells(index.X, index.Y)
            End Get
            Set(value As DataPoint)
                _Cells(index.X, index.Y) = value
            End Set
        End Property
    
        Public Sub DrawCell(x As Integer, y As Integer, gfx As Graphics)
            Using brsh As New SolidBrush(_Cells(x, y).Color)
                gfx.FillRectangle(brsh, x * _CellSize.Width, y * _CellSize.Height, _CellSize.Width, _CellSize.Height)
            End Using
        End Sub
    
        Public Sub DrawMap(gfx As Graphics)
            For y As Integer = 0 To _Height - 1
                For x As Integer = 0 To _Width - 1
                    DrawCell(x, y, gfx)
                Next
            Next
        End Sub
    
        Public Function IndexFromPosition(position As Point) As Point
            Return IndexFromPosition(position.X, position.Y)
        End Function
    
        Public Function IndexFromPosition(x As Integer, y As Integer) As Point
            Dim result As New Point
            result.X = Math.Max(Math.Min(CInt(Math.Floor(x / _CellSize.Width)), _Width), 0)
            result.Y = Math.Max(Math.Min(CInt(Math.Floor(y / _CellSize.Height)), _Height), 0)
            Return result
        End Function
    
        Public Sub Resize(container As Control)
            _Width = CInt(Math.Floor(container.ClientSize.Width / _CellSize.Width))
            _Height = CInt(Math.Floor(container.ClientSize.Height / _CellSize.Height))
    
            If _Width > 0 AndAlso _Height > 0 Then
                ReDim Preserve _Cells(_Width, _Height)
            Else
                ReDim _Cells(0, 0)
            End If
        End Sub
    
        Public Sub SaveToJpeg(filename As String)
            Dim tmp As New Bitmap(_Width, _Height)
            Dim gfx As Graphics = Graphics.FromImage(tmp)
            DrawMap(gfx)
            gfx.Dispose()
            tmp.Save(filename, System.Drawing.Imaging.ImageFormat.Jpeg)
            tmp.Dispose()
        End Sub
    End Class
    
    Public Structure DataPoint
        Public LowValue As Integer
        Public HighValue As Integer
        Public Color As Color
    
        Shared Function AssignColor(target As DataPoint, value As Color) As DataPoint
            Return New DataPoint With {.HighValue = target.HighValue, .LowValue = target.LowValue, .Color = value}
        End Function
    End Structure
    
    Public Enum InputMode
        Sample
        Paint
        Fill
    End Enum
    


    Reed Kimble - "When you do things right, people won't be sure you've done anything at all"

    Friday, August 30, 2013 10:17 PM
  • No that line weight will work.


    Regards, ---------------------------------------------------------------------Carter Humphreys

    Okay. I'll fix it up and get back to you.


    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.

    Friday, August 30, 2013 11:32 PM
  • Here is a simple example of how to define a "grid map" object that contains a grid of "cells" where each cell has an associated "data point" containing color and numeric information. This example just lets the user select a color to paint with, but your actual program would allow the user to construct a list of defined "data points" (a combination of a number or number range and a color) and then the user would select an entry from this list to paint with.

    The painting is performed on an invisible grid of 10x10 cells which overlays the form image.  Use the Load button in the sample to load an existing image (your "blank" map of counties) into the form.

    I believe all of the major components of what you are looking for are in this sample, you just need to expand upon it to make your actual program.  You would probably define a list of "GridMap" objects with an entry for each type of weather map you've defined.  There are also places where you can add code to improve efficiency (only repaint if something actually changed).

    If you wanted to save the composite image you could easily modify the SaveToJpeg method to draw the form's background image along with all of the GridMaps you define.

    Hopefully you or Mr Monkeyboy can get something useful out of this:

    Public Class Form1
        Private _MainMenu As New MenuStrip
        Private _Grid As New GridMap
        Private _IsMouseDown As Boolean
        Private _CurrentColor As Color = Color.Green
        Private _Mode As InputMode = InputMode.Sample
        Private _SelectionDelta As Point
    
        Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
            _MainMenu.Items.Add("Load", Nothing, AddressOf LoadMenu_Click)
            _MainMenu.Items.Add("Color", Nothing, AddressOf ColorMenu_Click)
            _MainMenu.Items.Add("Sample", Nothing, AddressOf SampleMenu_Click)
            _MainMenu.Items.Add("Paint", Nothing, AddressOf PaintMenu_Click)
            _MainMenu.Items.Add("Fill", Nothing, AddressOf FillMenu_Click)
            MainMenuStrip = _MainMenu
            Controls.Add(_MainMenu)
    
            Me.DoubleBuffered = True
            Me.ClientSize = New Size(1024, 768)
            Me.FormBorderStyle = Windows.Forms.FormBorderStyle.FixedSingle
            Me.MaximizeBox = False
            Me.BackgroundImageLayout = ImageLayout.None
    
            _Grid.Resize(Me)
        End Sub
    
        Private Sub Form1_MouseDown(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown
            Select Case _Mode
                Case InputMode.Paint
                    _IsMouseDown = True
                    SetCellColor(e)
                Case InputMode.Fill
                    _IsMouseDown = True
                    _SelectionDelta = e.Location
            End Select
        End Sub
    
        Private Sub Form1_MouseMove(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove
            If _Mode = InputMode.Paint AndAlso _IsMouseDown Then
                SetCellColor(e)
            ElseIf _Mode = InputMode.Fill Then
                Invalidate()
            End If
        End Sub
    
        Private Sub Form1_MouseUp(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseUp
            If _Mode = InputMode.Sample Then
                MessageBox.Show("Sampled color is " & _Grid(_Grid.IndexFromPosition(e.Location)).Color.ToString)
            Else
                If _Mode = InputMode.Fill Then
                    Dim bounds As Rectangle = GetSelectionBounds()
                    For y As Integer = bounds.Y To bounds.Y + bounds.Height - _Grid.CellSize.Height Step _Grid.CellSize.Height
                        For x As Integer = bounds.X To bounds.X + bounds.Width - _Grid.CellSize.Width Step _Grid.CellSize.Width
                            Dim idx As Point = _Grid.IndexFromPosition(x, y)
                            _Grid(idx) = DataPoint.AssignColor(_Grid(idx), _CurrentColor)
                        Next
                    Next
                End If
                _IsMouseDown = False
            End If
        End Sub
    
        Private Sub Form1_Paint(sender As Object, e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
            _Grid.DrawMap(e.Graphics)
            If _Mode = InputMode.Fill AndAlso _IsMouseDown Then
                Dim bounds As Rectangle = GetSelectionBounds()
                Using p As New Pen(SystemColors.Highlight)
                    e.Graphics.DrawRectangle(p, bounds)
                End Using
            End If
        End Sub
    
        Private Sub LoadMenu_Click(sender As Object, e As System.EventArgs)
            Using dlg As New OpenFileDialog With {.Filter = "Image Files|*.bmp;*.png;*.jpg", .FileName = String.Empty}
                If dlg.ShowDialog = Windows.Forms.DialogResult.OK Then
                    Me.BackgroundImage = Bitmap.FromFile(dlg.FileName)
                End If
            End Using
        End Sub
    
        Private Sub ColorMenu_Click(sender As Object, e As System.EventArgs)
            Using dlg As New ColorDialog With {.Color = _CurrentColor}
                If dlg.ShowDialog = Windows.Forms.DialogResult.OK Then
                    _CurrentColor = dlg.Color
                End If
            End Using
        End Sub
    
        Private Sub SampleMenu_Click(sender As Object, e As System.EventArgs)
            _Mode = InputMode.Sample
            Cursor = Cursors.Arrow
        End Sub
    
        Private Sub PaintMenu_Click(sender As Object, e As System.EventArgs)
            _Mode = InputMode.Paint
            Cursor = Cursors.Hand
        End Sub
    
        Private Sub FillMenu_Click(sender As Object, e As System.EventArgs)
            _Mode = InputMode.Fill
            Cursor = Cursors.Cross
        End Sub
    
        Private Sub SetCellColor(e As MouseEventArgs)
            Dim idx As Point = _Grid.IndexFromPosition(e.Location)
            If e.Button = Windows.Forms.MouseButtons.Left Then
                _Grid(idx) = DataPoint.AssignColor(_Grid(idx), _CurrentColor)
            ElseIf e.Button = Windows.Forms.MouseButtons.Right Then
                _Grid(idx) = DataPoint.AssignColor(_Grid(idx), Color.Empty)
            End If
            Invalidate()
        End Sub
    
        Private Function GetSelectionBounds() As Rectangle
            Dim current As Point = Me.PointToClient(MousePosition)
            Dim x1, x2, y1, y2 As Integer
            If _SelectionDelta.X < current.X Then
                x1 = _SelectionDelta.X
                x2 = current.X
            Else
                x1 = current.X
                x2 = _SelectionDelta.X
            End If
            If _SelectionDelta.Y < current.Y Then
                y1 = _SelectionDelta.Y
                y2 = current.Y
            Else
                y1 = current.Y
                y2 = _SelectionDelta.Y
            End If
            Return Rectangle.FromLTRB(x1, y1, x2, y2)
        End Function
    End Class
    
    Public Class GridMap
        Private _CellSize As New Size(10, 10)
        Public ReadOnly Property CellSize As Size
            Get
                Return _CellSize
            End Get
        End Property
    
        Private _Width As Integer
        Public ReadOnly Property Width As Integer
            Get
                Return _Width
            End Get
        End Property
    
        Private _Height As Integer
        Public ReadOnly Property Height As Integer
            Get
                Return _Height
            End Get
        End Property
    
        Private _Cells(,) As DataPoint
        Default Public Property Cell(x As Integer, y As Integer) As DataPoint
            Get
                Return _Cells(x, y)
            End Get
            Set(value As DataPoint)
                _Cells(x, y) = value
            End Set
        End Property
    
        Default Public Property Cell(index As Point) As DataPoint
            Get
                Return _Cells(index.X, index.Y)
            End Get
            Set(value As DataPoint)
                _Cells(index.X, index.Y) = value
            End Set
        End Property
    
        Public Sub DrawCell(x As Integer, y As Integer, gfx As Graphics)
            Using brsh As New SolidBrush(_Cells(x, y).Color)
                gfx.FillRectangle(brsh, x * _CellSize.Width, y * _CellSize.Height, _CellSize.Width, _CellSize.Height)
            End Using
        End Sub
    
        Public Sub DrawMap(gfx As Graphics)
            For y As Integer = 0 To _Height - 1
                For x As Integer = 0 To _Width - 1
                    DrawCell(x, y, gfx)
                Next
            Next
        End Sub
    
        Public Function IndexFromPosition(position As Point) As Point
            Return IndexFromPosition(position.X, position.Y)
        End Function
    
        Public Function IndexFromPosition(x As Integer, y As Integer) As Point
            Dim result As New Point
            result.X = Math.Max(Math.Min(CInt(Math.Floor(x / _CellSize.Width)), _Width), 0)
            result.Y = Math.Max(Math.Min(CInt(Math.Floor(y / _CellSize.Height)), _Height), 0)
            Return result
        End Function
    
        Public Sub Resize(container As Control)
            _Width = CInt(Math.Floor(container.ClientSize.Width / _CellSize.Width))
            _Height = CInt(Math.Floor(container.ClientSize.Height / _CellSize.Height))
    
            If _Width > 0 AndAlso _Height > 0 Then
                ReDim Preserve _Cells(_Width, _Height)
            Else
                ReDim _Cells(0, 0)
            End If
        End Sub
    
        Public Sub SaveToJpeg(filename As String)
            Dim tmp As New Bitmap(_Width, _Height)
            Dim gfx As Graphics = Graphics.FromImage(tmp)
            DrawMap(gfx)
            gfx.Dispose()
            tmp.Save(filename, System.Drawing.Imaging.ImageFormat.Jpeg)
            tmp.Dispose()
        End Sub
    End Class
    
    Public Structure DataPoint
        Public LowValue As Integer
        Public HighValue As Integer
        Public Color As Color
    
        Shared Function AssignColor(target As DataPoint, value As Color) As DataPoint
            Return New DataPoint With {.HighValue = target.HighValue, .LowValue = target.LowValue, .Color = value}
        End Function
    End Structure
    
    Public Enum InputMode
        Sample
        Paint
        Fill
    End Enum


    Reed Kimble - "When you do things right, people won't be sure you've done anything at all"

    How could this me modified to allow the user to rather than use the menu to select the color just from the color table by clicking on a portion of it? Sort of like an eyedropper? Another thing can this be limited to a certain area rather than the entire form? Last question, I lose my county borders, how could that be fixed? So far this works very well.  Thank you!

    Regards, ---------------------------------------------------------------------Carter Humphreys


    • Edited by CarterJH Saturday, August 31, 2013 1:07 AM
    Saturday, August 31, 2013 12:57 AM
  • This is the final map I'm going to work with.


    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.

    Saturday, August 31, 2013 1:58 AM
  • This is what it looks like in the program


    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.

    Saturday, August 31, 2013 2:02 AM
  • I fixed Onandaga county because it was messed up compared to the original image.

    Anyhow right now I'm working on drawing tools. So far I have a line drawing tool for straight lines. Also an assitant that draws a horizontal and vertical line over the PictureBox so as you move the mouse these follow the point of the cursor and cross at the point of the cursor. Also you can choose to leave the center point open so you can see it (each line reaches the center point but is either -6 or +6 pixels backed off from it). And I have a variety of cursors to use too.

    The straight lines point and name info are being stored so they can be deleted by selecting a line with the mouse and pressing either a delete button or the right mouse button or by deleting them altogether. Not sure on that yet. Have to do the same for free hand drawing and curved lines too. As well as work on the fill routines, Color Tables and those forecast things that will, I suppose, bring up a new map and a particular Color Table.

    Anyhow nothing you do will effect the map until you decide to combine what you've done with the map. What I'm doing is setting the map as SpatialEditor (PictureBox) background image or image (really doesn't matter). Then I have an opaque panel the same size as SpatialEditor, created at runtime, that  sits over SpatialEditor which is transparent but they call it opaque because transparent panels don't show the controls beneath them and this does. The panel is used for the drawing assistant to draw its horizontal and vertical line on that follow the mouse around if you use it. SpatialEditor is where the rest of the graphics are performed using various painting functions. So if you make any mistakes you don't have to start all over because the map has been destroyed from drawing on its image.

    I'm doing this stuff on a test program. Here's what it looks like so far but you can't see the cursors because screen shots don't allow it. And when I used code that would allow it the entire form became transparent due to using some code that makes only the panel transparent. The cursors are shown in another image below also.


    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.

    Saturday, August 31, 2013 9:14 AM
  • I fixed Onandaga county because it was messed up compared to the original image.

    Anyhow right now I'm working on drawing tools. So far I have a line drawing tool for straight lines. Also an assitant that draws a horizontal and vertical line over the PictureBox so as you move the mouse these follow the point of the cursor and cross at the point of the cursor. Also you can choose to leave the center point open so you can see it (each line reaches the center point but is either -6 or +6 pixels backed off from it). And I have a variety of cursors to use too.

    The straight lines point and name info are being stored so they can be deleted by selecting a line with the mouse and pressing either a delete button or the right mouse button or by deleting them altogether. Not sure on that yet. Have to do the same for free hand drawing and curved lines too. As well as work on the fill routines, Color Tables and those forecast things that will, I suppose, bring up a new map and a particular Color Table.

    Anyhow nothing you do will effect the map until you decide to combine what you've done with the map. What I'm doing is setting the map as SpatialEditor (PictureBox) background image or image (really doesn't matter). Then I have an opaque panel the same size as SpatialEditor, created at runtime, that  sits over SpatialEditor which is transparent but they call it opaque because transparent panels don't show the controls beneath them and this does. The panel is used for the drawing assistant to draw its horizontal and vertical line on that follow the mouse around if you use it. SpatialEditor is where the rest of the graphics are performed using various painting functions. So if you make any mistakes you don't have to start all over because the map has been destroyed from drawing on its image.

    I'm doing this stuff on a test program. Here's what it looks like so far but you can't see the cursors because screen shots don't allow it. And when I used code that would allow it the entire form became transparent due to using some code that makes only the panel transparent. The cursors are shown in another image below also.


    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.

    Yea I noticed Onondaga looked a little more like a box rather than the original county line, along Oneida lake.

    Regards, ---------------------------------------------------------------------Carter Humphreys

    Saturday, August 31, 2013 2:10 PM
  • I'm still working on it but it will be at least a week before I have a prototype of anything possibly.

    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.

    Tuesday, September 03, 2013 5:52 AM
  • I'm still working on it but it will be at least a week before I have a prototype of anything possibly.

    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.

    ok, take your time. Thank you for taking time to work on it!

    Regards, ---------------------------------------------------------------------Carter Humphreys

    Tuesday, September 03, 2013 1:39 PM
  •    Well this is what I have now. It's not that great and you have to freehand draw the areas of interest.  You can draw lines also although I don't know why you may want to. I haven't worked on the color tables yet so I'm just choosing a color to use from a color dialog. And I haven't added the elements yet so different color tables appear.

       Anyhow you can choose which cursor to use and what color you want the cursor. And you can choose the cursor assist lines which are a single horizontal and vertical line which follow the cursor. You can also choose to open the crossing of those lines so they leave an open space where they would normally meet and you can use a cursor that has an open center. Then when you are drawing you can see the point of the drawn line in the center of the open centered cursor.

        I am not using a grid because the grid would have to be the size of the entire drawing. And the only grid squares you would use would be within the counties so it would be very difficult to determine which grid squares went where in order to choose which ones to use.

        I plan to add the ability to draw strings in case you desire to add words or numbers or whatever to areas of the map. And I plan to disallow drawn areas to replace county line gray colored pixels so the counties borders show through.

        The top two images below show a non-completed version of the program which will allow you to draw lines and do free hand drawn areas. You can remove them in order of last drawn at will and add them back at will in that order before you draw again. However if you remove any drawn items and start drawing again they are removed forever. After you are done and the map looks fine then the drawn items can be copied and the map can be copied and the drawn items overlay the map in a final image which is at the bottom.

        Is this kind of what you're looking for?


    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.


    Sunday, September 08, 2013 5:01 AM
  • Here's another example. You can see if the counties gray borders showed through and the colors were associated to a color table it wouldn't look half bad.


    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.



    Sunday, September 08, 2013 5:11 AM
  • Yea it looks good so far! Thank you! So the county borders will show through right?

    Regards, ---------------------------------------------------------------------Carter Humphreys

    Tuesday, September 10, 2013 1:50 AM
  • Yea it looks good so far! Thank you! So the county borders will show through right?

    Regards, ---------------------------------------------------------------------Carter Humphreys


    That's my plan for now. But it will be awhile before I can get to that point. So I'll get back to you when I can.

    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.

    Tuesday, September 10, 2013 9:58 PM
  • Okay.

    Regards, ---------------------------------------------------------------------Carter Humphreys

    Wednesday, September 11, 2013 12:38 AM
  • How is it coming?

    Regards, Carter Humphreys

    Thursday, September 19, 2013 7:43 PM
  • How is it coming?

    Regards, Carter Humphreys

    Well I got this part done so far. You can free hand draw then add the borders back into the drawing. My drawing isn't the best but this is an image of what it looks like so far. So I'm going to work on using a color table to choose colors and then I'll upload the project to my skydrive for you.


    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.

    Saturday, September 21, 2013 10:14 PM
  • How is it coming?


    Regards, Carter Humphreys

    Well I got this part done so far. You can free hand draw then add the borders back into the drawing. My drawing isn't the best but this is an image of what it looks like so far. So I'm going to work on using a color table to choose colors and then I'll upload the project to my skydrive for you.


    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.

    Ok. Thank you! When do you think it will be done?

    Regards, Carter Humphreys

    Saturday, September 21, 2013 10:37 PM
  • How is it coming?


    Regards, Carter Humphreys

    Well I got this part done so far. You can free hand draw then add the borders back into the drawing. My drawing isn't the best but this is an image of what it looks like so far. So I'm going to work on using a color table to choose colors and then I'll upload the project to my skydrive for you.


    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.

    Ok. Thank you! When do you think it will be done?

    Regards, Carter Humphreys


    Well maybe next week hopefully. I'm working on it right now.

    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.

    Saturday, September 21, 2013 11:00 PM
  • How is it coming?


    Regards, Carter Humphreys

    Well I got this part done so far. You can free hand draw then add the borders back into the drawing. My drawing isn't the best but this is an image of what it looks like so far. So I'm going to work on using a color table to choose colors and then I'll upload the project to my skydrive for you.


    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.

    Ok. Thank you! When do you think it will be done?

    Regards, Carter Humphreys


    Well maybe next week hopefully. I'm working on it right now.

    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.

    When do you think it will be ready? (Not to rush you)

    Regards, Carter Humphreys

    Sunday, September 29, 2013 8:26 PM
  • Going to be at least a week Carter. Sorry about that but I have other business I'm taking care of right now. I'll get back to you as soon as I can.

    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.

    Monday, September 30, 2013 12:21 AM
  • Going to be at least a week Carter. Sorry about that but I have other business I'm taking care of right now. I'll get back to you as soon as I can.

    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.

    Dot worry about it, you get stuff you need to get done first.

    Regards, Carter Humphreys

    Monday, September 30, 2013 12:32 AM
  • The only thing I have left to do is provide the ability to add text to the drawing.

    Below are two images. The first is the county map with drawings overlaying it. The second is the county map with drawings overlaying it, the color table for those drawings at the top of the image and the label that defines the color table being used drawn just below the color table (figured that may be what you really want anyhow).


    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.

    Saturday, October 05, 2013 5:26 PM
  • Below is an image of what the app looks like. And an image of just the drawings with the borders drawn into it. I plan to also add the ability to save the drawings with the borders drawn in, the color table used for the drawings and the label/text for the color table.


    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.

    Saturday, October 05, 2013 5:29 PM
  • Below is an image of what the app looks like. And an image of just the drawings with the borders drawn into it. I plan to also add the ability to save the drawings with the borders drawn in, the color table used for the drawings and the label/text for the color table.


    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.

    How will this be saving? First it will need to be saved as a editable draft within the program and then finally, for the element that were selected/modified, will be saved and published via FTP upload.

    Somehow the user will need to be able to navigate between element grid periods. I had the idea of using buttons to navigate between time period. Image below:

    Forecast period for all the other elements:


    Regards, Carter Humphreys

    Saturday, October 05, 2013 6:23 PM
  • Here's the drawing only image with borders drawn in it, the color table being used and the label for the color table being used.


    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.

    Saturday, October 05, 2013 6:54 PM

  • Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.

    Saturday, October 05, 2013 8:22 PM

  • Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.

    Good work John!

    I know you worked hard on it - so congratuations. :)


    Please call me Frank :)

    Saturday, October 05, 2013 8:37 PM
  • This link is for the zipped project folder. And this link is for a zipped folder of files you may want although all of the drawings in it are resources in the project.


    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.


    Saturday, October 05, 2013 8:39 PM
  • This link is for the zipped project folder. And this link is for a zipped folder of files you may want although all of the drawings in it are resources in the project.


    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.


    Yea!!!!!!!! Thank you so much for the work you have done for the past month or 2 on this project. You put a lot of work into and I greatly appreciate you getting it done! Thank you!

    Regards, Carter Humphreys

    Saturday, October 05, 2013 8:46 PM
  • This is a link to a word pad rtf file of instructions.

    It's your program now so I suppose you can do what you want with it. I don't know what an editable draft means but you can save the transparent image with just the drawings on it and make a load function to load it back over the the Map anytime I suppose.


    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.

    Saturday, October 05, 2013 10:00 PM

  • Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.

    Good work John!

    I know you worked hard on it - so congratuations. :)


    Please call me Frank :)

    Thanks Frank I appreciate it. :)

    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.

    Saturday, October 05, 2013 10:02 PM
  • Here's the code if anyone is interested.

    Option Strict On
    
    Imports System.Drawing.Drawing2D
    
    Public Class Form1
    
        Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            Me.Text = "Weather Map Editor"
            Me.AutoScroll = True
            Me.Size = New Size(1036, Screen.PrimaryScreen.WorkingArea.Height)
            Me.CenterToScreen()
            DateTimePicker1.Format = DateTimePickerFormat.Custom
            DateTimePicker1.CustomFormat = "HH:mm:ssZ dd-MMM-yy"
    
            Dim PictureBox1 As New OpaquePictureBox
            PictureBox1.Name = "PictureBox1"
            PictureBox1.Left = SpatialEditor.Left
            PictureBox1.Top = SpatialEditor.Top
            PictureBox1.Size = New Size(SpatialEditor.Width, SpatialEditor.Height)
            AddHandler PictureBox1.MouseDown, AddressOf PictureBox1_MouseDown
            AddHandler PictureBox1.MouseUp, AddressOf PictureBox1_MouseUp
            AddHandler PictureBox1.MouseMove, AddressOf PictureBox1_MouseMove
            AddHandler PictureBox1.MouseEnter, AddressOf PictureBox1_MouseEnter
            AddHandler PictureBox1.MouseLeave, AddressOf PictureBox1_MouseLeave
            Me.Controls.Add(PictureBox1)
            PictureBox1.BringToFront()
    
            Dim SEI As New Bitmap(SpatialEditor.Width, SpatialEditor.Height)
            SEI.MakeTransparent()
            SpatialEditor.Image = SEI
    
            SaveFileDialog1.Filter = "Png file (*.png)|*.png"
            Timer1.Interval = 1000
            Timer1.Start()
        End Sub
    
        Private Sub LoadProjectMap(sender As Object, e As EventArgs) Handles LoadMap.Click
            SpatialEditor.BackgroundImage = My.Resources.Project_map
        End Sub
    
        Private Sub SaveOuterImage_Click(sender As Object, e As EventArgs) Handles SaveOuterImage.Click
            SaveFileDialog1.ShowDialog()
            Try
                SpatialEditor.Image.Save(SaveFileDialog1.FileName, System.Drawing.Imaging.ImageFormat.Png)
            Catch ex As Exception
                MessageBox.Show(ex.Message)
            End Try
        End Sub
    
        Private Sub SaveBlankMap_Click(sender As Object, e As EventArgs) Handles SaveBlankMap.Click
            SaveFileDialog1.ShowDialog()
            Try
                SpatialEditor.BackgroundImage.Save(SaveFileDialog1.FileName, System.Drawing.Imaging.ImageFormat.Png)
            Catch ex As Exception
                MessageBox.Show(ex.Message)
            End Try
        End Sub
    
        Private Sub OverlayDrawingOnMapAndSaveImage_Click(sender As Object, e As EventArgs) Handles OverlayDrawingOnMapAndSaveImage.Click
            Dim SpatialEditorImage As New Bitmap(SpatialEditor.Image)
            Dim SpatialEditorBackGroundImage As New Bitmap(SpatialEditor.BackgroundImage)
            Dim gr As Graphics = Graphics.FromImage(SpatialEditorBackGroundImage)
            gr.DrawImage(SpatialEditorImage, (SpatialEditorBackGroundImage.Width - SpatialEditorImage.Width) \ 2, SpatialEditorBackGroundImage.Height - SpatialEditorImage.Height)
            SaveFileDialog1.ShowDialog()
            SpatialEditorBackGroundImage.Save(SaveFileDialog1.FileName, System.Drawing.Imaging.ImageFormat.Png)
        End Sub
    
        Private Sub OverlayDrawingOnMapAndAddColorTableThenSaveImage_Click(sender As Object, e As EventArgs) Handles OverlayDrawingOnMapAndAddColorTableThenSaveImage.Click
            Dim Lbl1 As New Bitmap(Label1.Width, Label1.Height)
            Label1.DrawToBitmap(Lbl1, Label1.ClientRectangle)
            Dim ColorTableImage As New Bitmap(ColorTable.Image)
            Dim SpatialEditorImage As New Bitmap(SpatialEditor.Image)
            Dim SpatialEditorBackGroundImage As New Bitmap(SpatialEditor.BackgroundImage)
            Dim gr1 As Graphics = Graphics.FromImage(SpatialEditorBackGroundImage)
            gr1.DrawImage(SpatialEditorImage, (SpatialEditorBackGroundImage.Width - SpatialEditorImage.Width) \ 2, SpatialEditorBackGroundImage.Height - SpatialEditorImage.Height)
            Dim gr2 As Graphics = Graphics.FromImage(SpatialEditorBackGroundImage)
            gr2.DrawImage(ColorTableImage, 0, 0)
            Dim gr3 As Graphics = Graphics.FromImage(SpatialEditorBackGroundImage)
            gr3.DrawImage(Lbl1, (CInt(Math.Round(ColorTable.Width / 2) - Math.Round(Label1.Width / 2))), 39)
            SaveFileDialog1.ShowDialog()
            SpatialEditorBackGroundImage.Save(SaveFileDialog1.FileName, System.Drawing.Imaging.ImageFormat.Png)
        End Sub
    
        Private Sub SaveOuterImageAndAddColorTableAndLabel_Click(sender As Object, e As EventArgs) Handles SaveOuterImageAndAddColorTableAndLabel.Click
            Dim Lbl1 As New Bitmap(Label1.Width, Label1.Height)
            Label1.DrawToBitmap(Lbl1, Label1.ClientRectangle)
            Dim ColorTableImage As New Bitmap(ColorTable.Image)
            Dim SpatialEditorImage As New Bitmap(SpatialEditor.Image)
            Dim gr1 As Graphics = Graphics.FromImage(SpatialEditorImage)
            gr1.DrawImage(ColorTableImage, 0, 0)
            Dim gr2 As Graphics = Graphics.FromImage(SpatialEditorImage)
            gr2.DrawImage(Lbl1, (CInt(Math.Round(ColorTable.Width / 2) - Math.Round(Label1.Width / 2))), 39)
            SaveFileDialog1.ShowDialog()
            SpatialEditorImage.Save(SaveFileDialog1.FileName, System.Drawing.Imaging.ImageFormat.Png)
        End Sub
    
        Private Sub ExitForm_Click(sender As Object, e As EventArgs) Handles ExitForm.Click
            Me.Close()
        End Sub
    
        Private Sub DateTimePicker1_ValueChanged(sender As Object, e As EventArgs) Handles DateTimePicker1.ValueChanged
            Time.Text = DateTimePicker1.Text
        End Sub
    
        Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
            DateTimePicker1.Value = Now.AddHours(4)
        End Sub
    
        Private Sub TurnLinesOn_Click(sender As Object, e As EventArgs) Handles TurnLinesOn.Click
            If DOSE = False Then
                DOSE = True
                TurnLinesOn.BackColor = Color.OrangeRed
                TurnLinesOn.Text = "Lines are on"
            Else
                DOSE = False
                TurnLinesOn.BackColor = Color.Lime
                TurnLinesOn.Text = "Lines are off"
                LeaveLineCrossingEmpty = 0
                SpatialEditor.Refresh()
            End If
        End Sub
    
        Private Sub TurnLinesCenterOn_Click(sender As Object, e As EventArgs) Handles TurnLinesCenterOn.Click
            If DOSE = True Then
                If LeaveLineCrossingEmpty = 0 Then
                    LeaveLineCrossingEmpty = 1
                    TurnLinesCenterOn.BackColor = Color.OrangeRed
                    TurnLinesCenterOn.Text = "Lines center off"
                Else
                    LeaveLineCrossingEmpty = 0
                    TurnLinesCenterOn.BackColor = Color.Lime
                    TurnLinesCenterOn.Text = "Turn lines center off"
                End If
            End If
        End Sub
    
        Private Sub DrawStraightLines_Click(sender As Object, e As EventArgs) Handles DrawStraightLines.Click
            If StraightLines = False Then
                StraightLines = True
                DrawStraightLines.BackColor = Color.OrangeRed
                DrawStraightLines.Text = "Straight line drawing in progress"
                DrawFreehandLines.Enabled = False
                AddText.Enabled = False
            Else
                StraightLines = False
                DrawStraightLines.BackColor = Color.Lime
                DrawStraightLines.Text = "Draw Straight Lines"
                DrawFreehandLines.Enabled = True
                AddText.Enabled = True
            End If
        End Sub
    
        Private Sub DrawFreehandLines_Click(sender As Object, e As EventArgs) Handles DrawFreehandLines.Click
            If FreeHandLinesStart = False Then
                FreeHandLinesStart = True
                DrawFreehandLines.BackColor = Color.OrangeRed
                DrawFreehandLines.Text = "Free hand line drawing in progress"
                DrawStraightLines.Enabled = False
                AddText.Enabled = False
            Else
                FreeHandLinesStart = False
                DrawFreehandLines.BackColor = Color.Lime
                DrawFreehandLines.Text = "Draw Freehand Lines"
                DrawStraightLines.Enabled = True
                AddText.Enabled = True
            End If
        End Sub
    
        Dim FillFreeHandLinesBoolean As Boolean = False
    
        Private Sub FillFreehandLines_Click(sender As Object, e As EventArgs) Handles FillFreehandLines.Click
            If FillFreeHandLinesBoolean = False Then
                FillFreeHandLinesBoolean = True
                FillFreehandLines.Text = "Fill freehand lines is on"
                FillFreehandLines.BackColor = Color.OrangeRed
            Else
                FillFreeHandLinesBoolean = False
                FillFreehandLines.Text = "Fill Freehand Lines"
                FillFreehandLines.BackColor = Color.Lime
            End If
        End Sub
    
        Dim TextDrawing As Boolean = False
        Dim TextDrawingFont As Font
        Dim TextDrawingColor As Color
    
        Private Sub AddText_Click(sender As Object, e As EventArgs) Handles AddText.Click
            If TextDrawing = False Then
                If TextBox1.Text <> "" Then
                    TextDrawing = True
                    AddText.Text = "Adding text is in progress."
                    AddText.BackColor = Color.OrangeRed
                    Try
                        FontDialog1.ShowDialog()
                        TextDrawingFont = FontDialog1.Font
                        ColorDialog1.ShowDialog()
                        TextDrawingColor = ColorDialog1.Color
                    Catch ex As Exception
                    End Try
                    Dim tooltip7 As New ToolTip
                    tooltip7.IsBalloon = True
                    tooltip7.ToolTipIcon = ToolTipIcon.Info
                    tooltip7.ToolTipTitle = "Adding Text"
                    tooltip7.Show("Place the cursor on the picturebox at the location where" & vbCrLf & "you desire the top left corner of the text to begin.", _
                                 TextBox1, New Point(CInt(TextBox1.Width / 2 - 20), -80), 3000)
                Else
                    MessageBox.Show("You must first add text to the text box.")
                    Exit Sub
                End If
            Else
                TextDrawing = False
                AddText.Text = "Add Text"
                AddText.BackColor = Color.Lime
            End If
        End Sub
    
        Dim DrawnInformation As New List(Of Image)
        Dim DrawnInformationInt As Integer = 0
        Dim RemovingDrawnItems As Boolean = False
    
        Private Sub RemoveLastDrawnItem_Click(sender As Object, e As EventArgs) Handles RemoveLastDrawnItem.Click
            If DrawnInformationInt > 0 Then
                SpatialEditor.Image = DrawnInformation(DrawnInformationInt - 1)
                DrawnInformationInt -= 1
                UndoDrawnInformationInt = DrawnInformationInt
                RemovingDrawnItems = True
            Else
                Dim OriginalImage As New Bitmap(SpatialEditor.Width, SpatialEditor.Height)
                OriginalImage.MakeTransparent()
                SpatialEditor.Image = OriginalImage
                DrawnInformationInt -= 1
                UndoDrawnInformationInt = DrawnInformationInt
                MessageBox.Show("There are no more drawn items to remove")
            End If
        End Sub
    
        Dim UndoDrawnInformationInt As Integer = 0
    
        Private Sub UndoRemove_Click(sender As Object, e As EventArgs) Handles UndoRemove.Click
            If UndoDrawnInformationInt < DrawnInformation.Count - 1 Then
                SpatialEditor.Image = DrawnInformation(UndoDrawnInformationInt + 1)
                UndoDrawnInformationInt += 1
                DrawnInformationInt = UndoDrawnInformationInt
            Else
                RemovingDrawnItems = False
                MessageBox.Show("The last drawn item has been re-added")
            End If
        End Sub
    
        Dim Panel1Image As Integer = 1
    
        Private Sub Crosshair1_Click(sender As Object, e As EventArgs) Handles Crosshair1.Click
            Panel1.BackgroundImage = My.Resources.CrossHair1
            Panel1Image = 1
        End Sub
    
        Private Sub Crosshair2_Click(sender As Object, e As EventArgs) Handles Crosshair2.Click
            Panel1.BackgroundImage = My.Resources.CrossHair2
            Panel1Image = 2
        End Sub
    
        Private Sub Crosshair3_Click(sender As Object, e As EventArgs) Handles Crosshair3.Click
            Panel1.BackgroundImage = My.Resources.Crosshair3
            Panel1Image = 3
        End Sub
    
        Private Sub Crosshair4_Click(sender As Object, e As EventArgs) Handles Crosshair4.Click
            Panel1.BackgroundImage = My.Resources.CrossHair4
            Panel1Image = 4
        End Sub
    
        Private Sub PenCursor_Click(sender As Object, e As EventArgs) Handles PenCursor.Click
            Panel1.BackgroundImage = My.Resources.Pen
            Panel1Image = 5
        End Sub
    
        Private Sub Pencil_Click(sender As Object, e As EventArgs) Handles Pencil.Click
            Panel1.BackgroundImage = My.Resources.Pencil
            Panel1Image = 6
        End Sub
    
        Private Sub Precision_Click(sender As Object, e As EventArgs) Handles Precision.Click
            Panel1.BackgroundImage = My.Resources.Precision
            Panel1Image = 7
        End Sub
    
        Dim CursorColor As Color = Color.Black
    
        Private Sub Panel1_Click(sender As Object, e As EventArgs) Handles Panel1.Click
            If Panel1Image = 6 Then
                MessageBox.Show("You can not change the pencils colors because" & vbCrLf & "it has multiple colors.")
            Else
                Dim Bmp As New Bitmap(Panel1.BackgroundImage)
                Dim CursorColors As New ColorDialog
                CursorColors.FullOpen = True
                If CursorColors.ShowDialog = Windows.Forms.DialogResult.OK Then
                    CursorColor = CursorColors.Color
                End If
                For x As Integer = 0 To Panel1.BackgroundImage.Width - 1
                    For y As Integer = 0 To Panel1.BackgroundImage.Height - 1
                        If Bmp.GetPixel(x, y).Equals(Color.FromArgb(0, 0, 0, 0)) Then
                        Else
                            Bmp.SetPixel(x, y, CursorColor)
                        End If
                    Next y
                Next x
                Panel1.BackgroundImage = Bmp
            End If
        End Sub
    
        Private Sub Panel1_MouseHover(sender As Object, e As EventArgs) Handles Panel1.MouseHover
            Dim tooltip1 As New ToolTip
            tooltip1.IsBalloon = True
            tooltip1.ToolTipIcon = ToolTipIcon.Info
            tooltip1.ToolTipTitle = "Cursors"
            tooltip1.Show("Click here to choose cursor color.", _
                         Panel1, New Point(CInt(Panel1.Width / 2 - 20), 30), 3000)
        End Sub
    
        Private Sub NumericUpDown1_ValueChanged(sender As Object, e As EventArgs) Handles NumericUpDown1.ValueChanged
            CursorLinesWidth = CInt(NumericUpDown1.Value)
        End Sub
    
        Private Sub NumericUpDown1_MouseHover(sender As Object, e As EventArgs) Handles NumericUpDown1.MouseHover
            Dim tooltip2 As New ToolTip
            tooltip2.IsBalloon = True
            tooltip2.ToolTipIcon = ToolTipIcon.Info
            tooltip2.ToolTipTitle = "Cursor Line Width"
            tooltip2.Show("Click here to choose cursor line width.", _
                         NumericUpDown1, New Point(CInt(NumericUpDown1.Width / 2 - 20), 30), 3000)
        End Sub
    
        Private Sub Panel2_Click(sender As Object, e As EventArgs) Handles Panel2.Click
            Dim Bmp As New Bitmap(Panel2.BackgroundImage)
            Dim CursorColors As New ColorDialog
            CursorColors.FullOpen = True
            If CursorColors.ShowDialog = Windows.Forms.DialogResult.OK Then
                CursorLinesColor = CursorColors.Color
                For x As Integer = 0 To Panel2.BackgroundImage.Width - 1
                    For y As Integer = 0 To Panel2.BackgroundImage.Height - 1
                        If Bmp.GetPixel(x, y).Equals(Color.FromArgb(0, 0, 0, 0)) Then
                        Else
                            Bmp.SetPixel(x, y, CursorLinesColor)
                        End If
                    Next y
                Next x
            End If
            Panel2.BackgroundImage = Bmp
        End Sub
    
        Private Sub Panel2_MouseHover(sender As Object, e As EventArgs) Handles Panel2.MouseHover
            Dim tooltip3 As New ToolTip
            tooltip3.IsBalloon = True
            tooltip3.ToolTipIcon = ToolTipIcon.Info
            tooltip3.ToolTipTitle = "Cursor Lines Color"
            tooltip3.Show("Click here to choose cursor lines color.", _
                         Panel2, New Point(CInt(Panel2.Width / 2 - 20), 30), 3000)
        End Sub
    
        Dim PickLinesColor As Boolean = False
    
        Private Sub Panel3_Click(sender As Object, e As EventArgs) Handles Panel3.Click
            tooltip5.RemoveAll()
            Dim tooltip4 As New ToolTip
            PickLinesColor = True
            tooltip4.IsBalloon = True
            tooltip4.ToolTipIcon = ToolTipIcon.Info
            tooltip4.ToolTipTitle = "Drawing Line Color"
            tooltip4.Show("Click on color table to choose line color.", _
                         Panel3, New Point(CInt(Panel3.Width / 2 - 20), 30), 3000)
        End Sub
    
        Dim tooltip5 As New ToolTip
    
        Private Sub Panel3_MouseHover(sender As Object, e As EventArgs) Handles Panel3.MouseHover
            tooltip5.IsBalloon = True
            tooltip5.ToolTipIcon = ToolTipIcon.Info
            tooltip5.ToolTipTitle = "Drawing Line Color"
            tooltip5.Show("Click here to choose drawing line color from color table.", _
                         Panel3, New Point(CInt(Panel3.Width / 2 - 20), 30), 3000)
        End Sub
    
        Dim LinesWidth As Integer = 1
    
        Private Sub NumericUpDown2_ValueChanged(sender As Object, e As EventArgs) Handles NumericUpDown2.ValueChanged
            LinesWidth = CInt(NumericUpDown2.Value)
        End Sub
    
        Private Sub NumericUpDown2_MouseHover(sender As Object, e As EventArgs) Handles NumericUpDown2.MouseHover
            Dim tooltip6 As New ToolTip
            tooltip6.IsBalloon = True
            tooltip6.ToolTipIcon = ToolTipIcon.Info
            tooltip6.ToolTipTitle = "Drawing Line Width"
            tooltip6.Show("Click here to choose drawing line width.", _
                         NumericUpDown2, New Point(CInt(NumericUpDown2.Width / 2 - 20), 30), 3000)
        End Sub
    
        Dim LinesColor As Color = Color.Black
    
        Private Sub ColorTable_MouseDown(sender As Object, e As MouseEventArgs) Handles ColorTable.MouseDown
            Dim Bmp1 As New Bitmap(Panel3.BackgroundImage)
            Dim Bmp2 As New Bitmap(ColorTable.Image)
            If PickLinesColor = True Then
                LinesColor = Bmp2.GetPixel(e.X, e.Y)
                For x As Integer = 0 To Panel3.BackgroundImage.Width - 1
                    For y As Integer = 0 To Panel3.BackgroundImage.Height - 1
                        If Bmp1.GetPixel(x, y).Equals(Color.FromArgb(0, 0, 0, 0)) Then
                        Else
                            Bmp1.SetPixel(x, y, LinesColor)
                        End If
                    Next y
                Next x
            End If
            Panel3.BackgroundImage = Bmp1
            PickLinesColor = False
        End Sub
    
        Dim PixelLocationsXGray As New List(Of Integer)
        Dim PixelLocationsYGray As New List(Of Integer)
        Dim PixelLocationsXYellow As New List(Of Integer)
        Dim PixelLocationsYYellow As New List(Of Integer)
    
        Private Sub RedrawBorders_Click(sender As Object, e As EventArgs) Handles RedrawBorders.Click
            PixelLocationsXGray.Clear()
            PixelLocationsYGray.Clear()
            PixelLocationsXYellow.Clear()
            PixelLocationsYYellow.Clear()
            Dim Bmp As Bitmap
            Bmp = CType(SpatialEditor.BackgroundImage(), Bitmap)
            For x = 0 To SpatialEditor.Width - 1
                For y = 0 To SpatialEditor.Height - 1
                    If Bmp.GetPixel(x, y).Name.ToString = "ffc8c8c8" Then
                        PixelLocationsXGray.Add(x)
                        PixelLocationsYGray.Add(y)
                    End If
                Next
            Next
            For x = 0 To SpatialEditor.Width - 1
                For y = 0 To SpatialEditor.Height - 1
                    If Bmp.GetPixel(x, y).Name.ToString = "ffd1d100" Then
                        PixelLocationsXYellow.Add(x)
                        PixelLocationsYYellow.Add(y)
                    End If
                Next
            Next
            Dim SEBmp As Bitmap
            SEBmp = CType(SpatialEditor.Image, Bitmap)
            For x = 0 To PixelLocationsXGray.Count - 1
                SEBmp.SetPixel(PixelLocationsXGray(x), PixelLocationsYGray(x), Color.FromArgb(255, 200, 200, 200))
            Next
            For x = 0 To PixelLocationsXYellow.Count - 1
                SEBmp.SetPixel(PixelLocationsXYellow(x), PixelLocationsYYellow(x), Color.FromArgb(255, 209, 209, 0))
            Next
            SpatialEditor.Image = SEBmp
        End Sub
    
        Private Sub IceAccumulation_Click(sender As Object, e As EventArgs) Handles IceAccumulation.Click
            ColorTable.Image = My.Resources.Ice_Accumulation__IceAccum_
            Label1.Text = "Ice Accumulation (IceAccum)"
            Label1.Location = New Point(160, 30)
        End Sub
    
        Private Sub PredominateWeather_Click(sender As Object, e As EventArgs) Handles PredominateWeather.Click
            ColorTable.Image = My.Resources.Predominate_Weather__Wx_
            Label1.Text = "Predominate Weather (Wx)"
            Label1.Location = New Point(160, 30)
        End Sub
    
        Private Sub ProbabilityofPrecipitation_Click(sender As Object, e As EventArgs) Handles ProbabilityofPrecipitation.Click
            ColorTable.Image = My.Resources.Probability_of_Precipitation__PoP__TSTM__FZRA__SLT__SN_
            Label1.Text = "Probability of Precipitation (PoP, TSTM, FZRA, SLT, SN)"
            Label1.Location = New Point(160, 30)
        End Sub
    
        Private Sub Rainfall_Click(sender As Object, e As EventArgs) Handles Rainfall.Click
            ColorTable.Image = My.Resources.Rainfall__QPF_
            Label1.Text = "Rainfall (QPF)"
            Label1.Location = New Point(160, 30)
        End Sub
    
        Private Sub SkyCover_Click(sender As Object, e As EventArgs) Handles SkyCover.Click
            ColorTable.Image = My.Resources.Sky_Cover__Sky_
            Label1.Text = "Sky Cover (Sky)"
            Label1.Location = New Point(160, 30)
        End Sub
    
        Private Sub Snowfall_Click(sender As Object, e As EventArgs) Handles Snowfall.Click
            ColorTable.Image = My.Resources.Snowfall__SnowAmt_
            Label1.Text = "Snowfall (SnowAmt)"
            Label1.Location = New Point(160, 30)
        End Sub
    
        Private Sub Temperature_Click(sender As Object, e As EventArgs) Handles Temperature.Click
            ColorTable.Image = My.Resources.Temperature__maxT__minT__T__Td_
            Label1.Text = "Temperature (maxT, minT, T, Td)"
            Label1.Location = New Point(160, 30)
        End Sub
    
        Private Sub Wind_Click(sender As Object, e As EventArgs) Handles Wind.Click
            ColorTable.Image = My.Resources.Wind__Wind__WindGust_
            Label1.Text = "Wind (Wind, WindGust)"
            Label1.Location = New Point(160, 30)
        End Sub
    
        Dim MouseButtonLeft As Boolean = False
    
        Private Sub PictureBox1_MouseDown(sender As Object, e As MouseEventArgs)
            If MouseButtons = Windows.Forms.MouseButtons.Left Then
                MouseButtonLeft = True
                If StraightLines = True Then
                    DrawingStraightLineStartX = e.X
                    DrawingStraightLineStartY = e.Y
                    StraightLineXinfo = e.X
                    StraightLineYinfo = e.Y
                    KeepDrawingLineTemp()
                ElseIf FreeHandLinesStart = True Then
                    DrawFreehandLinesOnSpatialEditor(e.X, e.Y, True, Nothing, Nothing, Nothing)
                ElseIf TextDrawing = True Then
                    AddTextToDrawing(TextDrawingFont, TextDrawingColor, TextBox1.Text, e.X, e.Y, True)
                End If
            End If
        End Sub
    
        Private Sub PictureBox1_MouseMove(sender As Object, e As MouseEventArgs)
            If DOSE = True Then
                PictureBox1CursorLocationLines(e.X, e.Y, True)
            End If
            If StraightLines = True AndAlso MouseButtonLeft = True AndAlso DOSE = True Then
                StraightLineXinfo = e.X
                StraightLineYinfo = e.Y
                KeepDrawingLineTemp()
            ElseIf StraightLines = True And MouseButtonLeft = True And DOSE = False Then
                StraightLineXinfo = e.X
                StraightLineYinfo = e.Y
                SpatialEditor.Refresh()
                KeepDrawingLineTemp()
            ElseIf FreeHandLinesStart = True And MouseButtonLeft = True AndAlso DOSE = True Then
                DrawFreehandLinesOnSpatialEditor(e.X, e.Y, Nothing, True, Nothing, Nothing)
            ElseIf FreeHandLinesStart = True And MouseButtonLeft = True And DOSE = False Then
                DrawFreehandLinesOnSpatialEditor(e.X, e.Y, Nothing, True, Nothing, Nothing)
            End If
        End Sub
    
        Private Sub PictureBox1_MouseUp(sender As Object, e As MouseEventArgs)
            MouseButtonLeft = False
            If StraightLines = True Then
                DrawStraightLinesOnSpatialEditor(e.X, e.Y, True, RemovingDrawnItems)
                SpatialEditor.Refresh()
            ElseIf FreeHandLinesStart = True Then
                DrawFreehandLinesOnSpatialEditor(e.X, e.Y, Nothing, Nothing, True, RemovingDrawnItems)
                SpatialEditor.Refresh()
            End If
        End Sub
    
        Private Sub PictureBox1_MouseEnter(sender As Object, e As EventArgs)
            If DOSE = True Or StraightLines = True Or FreeHandLinesStart = True Then
                Dim BMP As New Bitmap(Panel1.BackgroundImage)
                Me.Cursor = New Cursor(BMP.GetHicon)
            End If
        End Sub
    
        Private Sub PictureBox1_MouseLeave(sender As Object, e As EventArgs)
            If DOSE = True Or StraightLines = True Or FreeHandLinesStart = True Then
                Cursor = Cursors.Arrow
            End If
        End Sub
    
        Dim DOSE As Boolean = False
        Dim LeaveLineCrossingEmpty As Integer = 0 ' Sets SpatialEditorCursorLocationLines leave 12 pixel width height and width empty at mouse cursor center point.
        Dim CursorLinesColor As Color = Color.Black
        Dim CursorLinesWidth As Integer = 1
    
        Private Function PictureBox1CursorLocationLines(ByRef Xref As Integer, ByRef Yref As Integer, ByVal Okay As Boolean) As Integer
            If Okay = True Then
                SpatialEditor.Refresh()
                Dim Ctrl As Control
                For Each Ctrl In Me.Controls
                    If Ctrl.Name = "PictureBox1" Then
                        Dim Brush As New SolidBrush(CursorLinesColor)
                        Dim Pen1 As New Pen(Brush, CursorLinesWidth)
                        Dim g As Graphics = Ctrl.CreateGraphics()
                        If LeaveLineCrossingEmpty = 1 Then
                            g.DrawLine(Pen1, 0, Yref, Xref - 6, Yref) ' Draws horizontal line from 0 (left side of SpatialEditor) to -6 pixels left side of mouse center
                            g.DrawLine(Pen1, Xref + 6, Yref, Ctrl.Width, Yref) ' Draws horizontal line from +6 pixels on right side of mouse center to SpatialEditors right side
                            g.DrawLine(Pen1, Xref, 0, Xref, Yref - 6) ' Draws vertical line
                            g.DrawLine(Pen1, Xref, Yref + 6, Xref, Ctrl.Height) ' Draws vertical line
                        Else
                            g.DrawLine(Pen1, 0, Yref, Ctrl.Width, Yref) ' Draws horizontal line
                            g.DrawLine(Pen1, Xref, 0, Xref, Ctrl.Height) ' Draws vertical line
                        End If
                        Brush.Dispose()
                        Pen1.Dispose()
                        g.Dispose()
                    End If
                Next
            End If
            Return Nothing
        End Function
    
        Dim StraightLines As Boolean = False
        Dim DrawingStraightLineStartX As Integer = 0
        Dim DrawingStraightLineStartY As Integer = 0
        Dim StraightLineXinfo As Integer = 0
        Dim StraightLineYinfo As Integer = 0
    
        Private Function DrawStraightLinesOnSpatialEditor(ByRef Xref As Integer, ByRef Yref As Integer, ByVal Okay As Boolean, ByVal Remove As Boolean) As Boolean
            If Remove = True Then
                RemovingDrawnItems = False
                If DrawnInformationInt = -1 Then
                    DrawnInformation.Clear()
                ElseIf DrawnInformationInt > -1 Then
                    Do Until DrawnInformation.Count - 1 = DrawnInformationInt
                        DrawnInformation.RemoveAt(DrawnInformation.Count - 1)
                    Loop
                End If
            End If
            If Okay = True Then
                Dim SpatialEditorImage As Bitmap = New Bitmap(CType(SpatialEditor.Image, Bitmap))
                Dim Pen1 As New Pen(LinesColor, LinesWidth)
                Dim g As Graphics = SpatialEditor.CreateGraphics()
                g = Graphics.FromImage(SpatialEditorImage)
                g.DrawLine(Pen1, DrawingStraightLineStartX, DrawingStraightLineStartY, Xref, Yref)
                Pen1.Dispose()
                g.Dispose()
                SpatialEditor.Image = SpatialEditorImage
                DrawnInformation.Add(SpatialEditor.Image)
                DrawnInformationInt = DrawnInformation.Count - 1
                UndoDrawnInformationInt = DrawnInformationInt
            End If
            Return Nothing
        End Function
    
        Private Sub KeepDrawingLineTemp()
            Dim Pen1 As New Pen(LinesColor, 1)
            Dim g As Graphics = SpatialEditor.CreateGraphics()
            g.DrawLine(Pen1, DrawingStraightLineStartX, DrawingStraightLineStartY, StraightLineXinfo, StraightLineYinfo)
            Pen1.Dispose()
            g.Dispose()
        End Sub
    
        Dim FreeHandLinesCoords As New List(Of Point)
        Dim FreeHandLinesStart As Boolean = False
        Dim FreeHandLinesFinish As Boolean = False
        Dim DrawingFreeHandLinesStartX As Integer = 0
        Dim DrawingFreeHandLinesStartY As Integer = 0
        Dim FreeHandLinesXinfo As Integer = 0
        Dim FreeHandLinesYinfo As Integer = 0
    
        Private Function DrawFreehandLinesOnSpatialEditor(ByRef Xref As Integer, ByRef Yref As Integer, ByVal Start As Boolean, ByVal Moving As Boolean, ByVal Finish As Boolean, ByVal Remove As Boolean) As Boolean
            If Remove = True Then
                RemovingDrawnItems = False
                If DrawnInformationInt = -1 Then
                    DrawnInformation.Clear()
                ElseIf DrawnInformationInt > -1 Then
                    Do Until DrawnInformation.Count - 1 = DrawnInformationInt
                        DrawnInformation.RemoveAt(DrawnInformation.Count - 1)
                    Loop
                End If
            End If
            If Start = True Then
                FreeHandLinesCoords.Clear()
                Dim PTStart As New Point(Xref, Yref)
                FreeHandLinesCoords.Add(PTStart)
            ElseIf Moving = True Then
                Dim PTMoving As New Point(Xref, Yref)
                FreeHandLinesCoords.Add(PTMoving)
                KeepDrawingFreeHandLines(Xref, Yref, True)
            ElseIf Finish = True Then
                KeepDrawingFreeHandLines(Xref, Yref, False)
                Dim SpatialEditorImage As Bitmap = New Bitmap(CType(SpatialEditor.Image, Bitmap))
                Dim Pen1 As New Pen(LinesColor, LinesWidth)
                Dim Brush1 As New SolidBrush(LinesColor)
                Dim g As Graphics = SpatialEditor.CreateGraphics()
                g = Graphics.FromImage(SpatialEditorImage)
                Dim PTSFinished() As Point = FreeHandLinesCoords.ToArray
                Try
                    g.DrawClosedCurve(Pen1, PTSFinished)
                    If FillFreeHandLinesBoolean = True Then
                        g.FillClosedCurve(Brush1, PTSFinished, FillMode.Winding, 1.0F)
                    End If
                Catch ex As Exception
                End Try
                SpatialEditor.Image = SpatialEditorImage
                DrawnInformation.Add(SpatialEditor.Image)
                DrawnInformationInt = DrawnInformation.Count - 1
                UndoDrawnInformationInt = DrawnInformationInt
                Pen1.Dispose()
                Brush1.Dispose()
                g.Dispose()
            End If
            Return Nothing
        End Function
    
        Dim KeepDrawingFreeHandLinesList As New List(Of Integer)
    
        Private Function KeepDrawingFreeHandLines(ByRef Xref As Integer, ByRef Yref As Integer, ByVal Start As Boolean) As Boolean
            If Start = True Then
                Dim Pen1 As New Pen(LinesColor, 1)
                Dim g As Graphics = SpatialEditor.CreateGraphics()
                Dim Counter As Integer = 0
                KeepDrawingFreeHandLinesList.Add(Xref)
                KeepDrawingFreeHandLinesList.Add(Yref)
                If KeepDrawingFreeHandLinesList.Count > 10 Then
                    Do Until Counter = KeepDrawingFreeHandLinesList.Count - 2
                        g.DrawLine(Pen1, KeepDrawingFreeHandLinesList(Counter), KeepDrawingFreeHandLinesList(Counter + 1), KeepDrawingFreeHandLinesList(Counter + 2), KeepDrawingFreeHandLinesList(Counter + 3))
                        Counter += 2
                    Loop
                    Pen1.Dispose()
                    g.Dispose()
                End If
            ElseIf Start = False Then
                KeepDrawingFreeHandLinesList.Clear()
            End If
            Return Nothing
        End Function
    
        Private Function AddTextToDrawing(ByRef FontInfo As Font, ByRef FontColor As Color, ByRef TextInfo As String, ByRef Xref As Integer, ByRef Yref As Integer, ByVal Start As Boolean) As Boolean
            If Start = True Then
                Dim SpatialEditorImage As Bitmap = New Bitmap(CType(SpatialEditor.Image, Bitmap))
                Dim Brush1 As New SolidBrush(FontColor)
                Dim g As Graphics = SpatialEditor.CreateGraphics()
                g = Graphics.FromImage(SpatialEditorImage)
                g.DrawString(TextInfo, FontInfo, Brush1, Xref, Yref)
                SpatialEditor.Image = SpatialEditorImage
                DrawnInformation.Add(SpatialEditor.Image)
                DrawnInformationInt = DrawnInformation.Count - 1
                UndoDrawnInformationInt = DrawnInformationInt
                Brush1.Dispose()
                g.Dispose()
            End If
            Return Nothing
        End Function
    
    #Region "OpaquePictureBox"
    
        Public Class OpaquePictureBox
            Inherits Control
    
            Private Shared ReadOnly DefaultBackground As Color = Color.Transparent
            Private TransparentImage As Image
    
            Public Sub New()
                Me.SetStyle(ControlStyles.AllPaintingInWmPaint, True)
                Me.SetStyle(ControlStyles.Opaque, True)
                Me.SetStyle(ControlStyles.SupportsTransparentBackColor, True)
                BackColor = DefaultBackground
            End Sub
    
            Public Overrides Property BackColor() As System.Drawing.Color
                Get
                    Return MyBase.BackColor
                End Get
                Set(ByVal value As System.Drawing.Color)
                    MyBase.BackColor = value
                End Set
            End Property
    
            Public Property Image() As Image
                Get
                    Return TransparentImage
                End Get
                Set(ByVal value As Image)
                    TransparentImage = value
                    Invalidate()
                End Set
            End Property
    
            Protected Overrides ReadOnly Property CreateParams() As System.Windows.Forms.CreateParams
                Get
                    Dim cp As CreateParams = MyBase.CreateParams
                    cp.ExStyle = cp.ExStyle Or &H20
                    Return cp
                End Get
            End Property
    
            ' Infrastructure to cause the default background to be transparent
            Public Function ShouldSerializeBackColor() As Boolean
                Return BackColor = DefaultBackground
            End Function
    
            ' Infrastructure to cause the default background to be transparent
            Public Sub ResetBackground()
                BackColor = DefaultBackground
            End Sub
    
        End Class
    
    #End Region
    
    End Class
    


    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.

    Saturday, October 05, 2013 10:24 PM
  • So did you try it yet Carter?

    Also if you save a copy of the transparent image with drawings on it and the drawings are various colors except white or black there is a way to replace all the color of a drawn object with another color or even turn all its pixels back to transparent. So if you saved it then made a function to reload it over the map you could create that capability. Although you can replace white or black too.

    This is the transparent overlay with just borders, text and objects drawn on it which can be saved and you could make a function to reload it to update it or something I suppose.


    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.



    Sunday, October 06, 2013 12:49 AM
  • So did you try it yet Carter?

    Also if you save a copy of the transparent image with drawings on it and the drawings are various colors except white or black there is a way to replace all the color of a drawn object with another color or even turn all its pixels back to transparent. So if you saved it then made a function to reload it over the map you could create that capability. Although you can replace white or black too.

    This is the transparent overlay with just borders, text and objects drawn on it which can be saved and you could make a function to reload it to update it or something I suppose.


    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.



    I have tried it a little, I have not been home to work with it too much. So far I like the way it works. By saving a draft when I were to click to a different time period I could still modify the previous grid when I were to switch back to it.

    Regards, Carter Humphreys

    Sunday, October 06, 2013 2:47 AM
  • I suppose. I did find a bug in it when drawing text then using the remove last item function. I don't believe that I coded it to actually remove the items removed which I do when drawing lines or shapes as soon as drawing begins again. I did it that way so you could remove items and add them back again before starting drawing again. But I suppose I forgot to remove text drawings when new text drawing begins if the user had removed them.

    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.

    Monday, October 07, 2013 4:08 AM
  • I suppose. I did find a bug in it when drawing text then using the remove last item function. I don't believe that I coded it to actually remove the items removed which I do when drawing lines or shapes as soon as drawing begins again. I did it that way so you could remove items and add them back again before starting drawing again. But I suppose I forgot to remove text drawings when new text drawing begins if the user had removed them.

    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.


    I don't see the bug, when I added text and then used the remove last item button, the last drawing or text added is removed.

    Regards, Carter Humphreys

    Monday, October 07, 2013 10:39 AM
  • It's there. I will fix it and load the code for that fix in a new post so you can add it into the code in your project when I get time. Although I will reload the project again on my skydrive when I do that too.

    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.

    Monday, October 07, 2013 12:20 PM
  • I took  the code from your project and placed ito into mine and when I click the panel to select the color table and then click on the color table to use that color, I get an error:

    An unhandled exception of type 'System.NullReferenceException' occurred in System.Drawing.dll

    Additional information: Object reference not set to an instance of an object.

    And then it brings me to this part of the code:

    Private Sub ColorTable_MouseDown(sender As Object, e As MouseEventArgs) Handles ColorTable.MouseDown
            Dim Bmp1 As New Bitmap(Panel3.BackgroundImage)
            Dim Bmp2 As New Bitmap(ColorTable.Image)
            If PickLinesColor = True Then
                LinesColor = Bmp2.GetPixel(e.X, e.Y)
                For x As Integer = 0 To Panel3.BackgroundImage.Width - 1
                    For y As Integer = 0 To Panel3.BackgroundImage.Height - 1
                        If Bmp1.GetPixel(x, y).Equals(Color.FromArgb(0, 0, 0, 0)) Then
                        Else
                            Bmp1.SetPixel(x, y, LinesColor)
                        End If
                    Next y
                Next x
            End If
            Panel3.BackgroundImage = Bmp1
            PickLinesColor = False
        End Sub

    This seems weird as I didn't modify any of the code, other that assigning which buttons do what as they were different from yours to mine, and I used all the code so its not like I forgot to place something in the project? 


    Regards, Carter Humphreys


    • Edited by CarterJH Tuesday, October 08, 2013 1:55 AM panl ---> panel
    Tuesday, October 08, 2013 1:55 AM
  • That's because some object listed in the code is not referenced. Is the picturebox for the Color Table named ColorTable?  Is the Panel that the Color Table MouseDown event references named Panel3 and if so does it have an image in it set as its background image? And is the Color Table pictureboxs image ColorTable.Image or ColorTable.BackgroundImage?

    All of those images I provided in my projects resources have transparent backgrounds, except the color table images I believe, and are .Png files specifically for that reason. So, in this instance, clicking on the ColorTable should make the panel images line change color as that is the non-transparent pixels in the image. The reason you see a white background on the images is because the panel controls backcolor is set to white in my project.

    And usually with an error like that the debugger takes you right to the line where the error occured so you can attempt to resolve the issue from whatever is wrong in that line.


    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.



    Tuesday, October 08, 2013 3:20 AM
  • Everything is referenced the same. Below is the code.

    Option Strict On
    Option Explicit On
    
    Imports System.Drawing.Drawing2D
    
    Public Class Menu
        Private Sub DeleteUsersToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles DeleteUsersToolStripMenuItem.Click
            Using DU As New Delete_User_Dialog
                DU.ShowDialog()
            End Using
        End Sub
    
        Private Sub FormatterLauncherToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles FormatterLauncherToolStripMenuItem.Click
            Dim test As New Formatter_Launcher
            test.ShowDialog()
        End Sub
    
        Private Sub ExitGFEToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ExitGFEToolStripMenuItem.Click
            End
        End Sub
    
        Private Sub MakeHazardToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles MakeHazardToolStripMenuItem.Click
            Dim HAZ As New MakeHazard
            HAZ.ShowDialog()
        End Sub
    
        Private Sub DefineSmartToolsToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles DefineSmartToolsToolStripMenuItem.Click
            Edit_Actions_Dialog.ShowDialog()
        End Sub
    
        Private Sub ToolStripButton13_Click(sender As Object, e As EventArgs) Handles ToolStripButton13.Click
            Edit_Actions_Dialog.ShowDialog()
        End Sub
    
        Private Sub DateTimePicker1_ValueChanged(sender As Object, e As EventArgs) Handles DateTimePicker1.ValueChanged
            DateTimePicker1.Format = DateTimePickerFormat.Custom
            DateTimePicker1.CustomFormat = "HH:mm:ssZ dd-MMM-yy"
            Time.Text = DateTimePicker1.Text
        End Sub
    
    
        Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
            DateTimePicker1.Value = Now.AddHours(4)
        End Sub
    
        Private Sub maxT_Click(sender As Object, e As EventArgs) Handles maxT.Click
            If maxT.ForeColor = Color.Gray Then
                maxT_GridManager.Checked = True
                ' Other Changes ^^^
                ' Color Table
                ColorTable.ImageLocation = "C:\Users\CarterHumphreys\SkyDrive\Tables\T.png"
                ' Label Colors
                maxT.ForeColor = Color.White
                minT.ForeColor = Color.Gray
                T.ForeColor = Color.Gray
                Td.ForeColor = Color.Gray
                PoP.ForeColor = Color.Gray
                TSTM.ForeColor = Color.Gray
                FZRA.ForeColor = Color.Gray
                SLT.ForeColor = Color.Gray
                SN.ForeColor = Color.Gray
                QPF.ForeColor = Color.Gray
                SnowAmt.ForeColor = Color.Gray
                IceAccum.ForeColor = Color.Gray
                Wx.ForeColor = Color.Gray
                Sky.ForeColor = Color.Gray
                Wind.ForeColor = Color.Gray
                WindGust.ForeColor = Color.Gray
            Else
                maxT_GridManager.Checked = False
                maxT.ForeColor = Color.Gray
                ColorTable.ImageLocation = ""
            End If
        End Sub
    
        Private Sub minT_Click(sender As Object, e As EventArgs) Handles minT.Click
            If minT.ForeColor = Color.Gray Then
                ' Other Changes ^^^
                minT_GridManager.Checked = True
                ' Color Table
                ColorTable.ImageLocation = "C:\Users\CarterHumphreys\SkyDrive\Tables\T.png"
                ' Label Colors
                maxT.ForeColor = Color.Gray
                minT.ForeColor = Color.White
                T.ForeColor = Color.Gray
                Td.ForeColor = Color.Gray
                PoP.ForeColor = Color.Gray
                TSTM.ForeColor = Color.Gray
                FZRA.ForeColor = Color.Gray
                SLT.ForeColor = Color.Gray
                SN.ForeColor = Color.Gray
                QPF.ForeColor = Color.Gray
                SnowAmt.ForeColor = Color.Gray
                IceAccum.ForeColor = Color.Gray
                Wx.ForeColor = Color.Gray
                Sky.ForeColor = Color.Gray
                Wind.ForeColor = Color.Gray
                WindGust.ForeColor = Color.Gray
            Else
                minT_GridManager.Checked = False
                minT.ForeColor = Color.Gray
                ColorTable.ImageLocation = ""
            End If
        End Sub
    
        Private Sub Wx_Click(sender As Object, e As EventArgs) Handles Wx.Click
            If Wx.ForeColor = Color.Gray Then
                ' Other Changes ^^^
                ' Color Table
                ColorTable.ImageLocation = "C:\Users\CarterHumphreys\SkyDrive\Tables\Wx.png"
                ' Label Colors
                maxT.ForeColor = Color.Gray
                minT.ForeColor = Color.Gray
                T.ForeColor = Color.Gray
                Td.ForeColor = Color.Gray
                PoP.ForeColor = Color.Gray
                TSTM.ForeColor = Color.Gray
                FZRA.ForeColor = Color.Gray
                SLT.ForeColor = Color.Gray
                SN.ForeColor = Color.Gray
                QPF.ForeColor = Color.Gray
                SnowAmt.ForeColor = Color.Gray
                IceAccum.ForeColor = Color.Gray
                Wx.ForeColor = Color.White
                Sky.ForeColor = Color.Gray
                Wind.ForeColor = Color.Gray
                WindGust.ForeColor = Color.Gray
            Else
                Wx.ForeColor = Color.Gray
                ColorTable.ImageLocation = ""
            End If
        End Sub
    
        Private Sub T_Click(sender As Object, e As EventArgs) Handles T.Click
            If T.ForeColor = Color.Gray Then
                ' Other Changes ^^^
                T_GridManager.Checked = True
                ' Color Table
                ColorTable.ImageLocation = "C:\Users\CarterHumphreys\SkyDrive\Tables\T.png"
                ' Label Colors
                maxT.ForeColor = Color.Gray
                minT.ForeColor = Color.Gray
                T.ForeColor = Color.White
                Td.ForeColor = Color.Gray
                PoP.ForeColor = Color.Gray
                TSTM.ForeColor = Color.Gray
                FZRA.ForeColor = Color.Gray
                SLT.ForeColor = Color.Gray
                SN.ForeColor = Color.Gray
                QPF.ForeColor = Color.Gray
                SnowAmt.ForeColor = Color.Gray
                IceAccum.ForeColor = Color.Gray
                Wx.ForeColor = Color.Gray
                Sky.ForeColor = Color.Gray
                Wind.ForeColor = Color.Gray
                WindGust.ForeColor = Color.Gray
            Else
                T.ForeColor = Color.Gray
                ColorTable.ImageLocation = ""
            End If
        End Sub
    
        Private Sub Td_Click(sender As Object, e As EventArgs) Handles Td.Click
            If Td.ForeColor = Color.Gray Then
                ' Other Changes ^^^
                ' Color Table
                ColorTable.ImageLocation = "C:\Users\CarterHumphreys\SkyDrive\Tables\T.png"
                ' Label Colors
                maxT.ForeColor = Color.Gray
                minT.ForeColor = Color.Gray
                T.ForeColor = Color.Gray
                Td.ForeColor = Color.White
                PoP.ForeColor = Color.Gray
                TSTM.ForeColor = Color.Gray
                FZRA.ForeColor = Color.Gray
                SLT.ForeColor = Color.Gray
                SN.ForeColor = Color.Gray
                QPF.ForeColor = Color.Gray
                SnowAmt.ForeColor = Color.Gray
                IceAccum.ForeColor = Color.Gray
                Wx.ForeColor = Color.Gray
                Sky.ForeColor = Color.Gray
                Wind.ForeColor = Color.Gray
                WindGust.ForeColor = Color.Gray
            Else
                Td.ForeColor = Color.Gray
                ColorTable.ImageLocation = ""
            End If
        End Sub
    
        Private Sub PoP_Click(sender As Object, e As EventArgs) Handles PoP.Click
            If PoP.ForeColor = Color.Gray Then
                ' Other Changes ^^^
                ' Color Table
                ColorTable.ImageLocation = "C:\Users\CarterHumphreys\SkyDrive\Tables\PoP.png"
                ' Label Colors
                maxT.ForeColor = Color.Gray
                minT.ForeColor = Color.Gray
                T.ForeColor = Color.Gray
                Td.ForeColor = Color.Gray
                PoP.ForeColor = Color.White
                TSTM.ForeColor = Color.Gray
                FZRA.ForeColor = Color.Gray
                SLT.ForeColor = Color.Gray
                SN.ForeColor = Color.Gray
                QPF.ForeColor = Color.Gray
                SnowAmt.ForeColor = Color.Gray
                IceAccum.ForeColor = Color.Gray
                Wx.ForeColor = Color.Gray
                Sky.ForeColor = Color.Gray
                Wind.ForeColor = Color.Gray
                WindGust.ForeColor = Color.Gray
            Else
                PoP.ForeColor = Color.Gray
                ColorTable.ImageLocation = ""
            End If
        End Sub
    
        Private Sub TSTM_Click(sender As Object, e As EventArgs) Handles TSTM.Click
            If TSTM.ForeColor = Color.Gray Then
                ' Other Changes ^^^
                ' Color Table
                ColorTable.ImageLocation = "C:\Users\CarterHumphreys\SkyDrive\Tables\PoP.png"
                ' Label Colors
                maxT.ForeColor = Color.Gray
                minT.ForeColor = Color.Gray
                T.ForeColor = Color.Gray
                Td.ForeColor = Color.Gray
                PoP.ForeColor = Color.Gray
                TSTM.ForeColor = Color.White
                FZRA.ForeColor = Color.Gray
                SLT.ForeColor = Color.Gray
                SN.ForeColor = Color.Gray
                QPF.ForeColor = Color.Gray
                SnowAmt.ForeColor = Color.Gray
                IceAccum.ForeColor = Color.Gray
                Wx.ForeColor = Color.Gray
                Sky.ForeColor = Color.Gray
                Wind.ForeColor = Color.Gray
                WindGust.ForeColor = Color.Gray
            Else
                TSTM.ForeColor = Color.Gray
                ColorTable.ImageLocation = ""
            End If
        End Sub
    
        Private Sub FZRA_Click(sender As Object, e As EventArgs) Handles FZRA.Click
            If FZRA.ForeColor = Color.Gray Then
                ' Other Changes ^^^
                ' Color Table
                ColorTable.ImageLocation = "C:\Users\CarterHumphreys\SkyDrive\Tables\PoP.png"
                ' Label Colors
                maxT.ForeColor = Color.Gray
                minT.ForeColor = Color.Gray
                T.ForeColor = Color.Gray
                Td.ForeColor = Color.Gray
                PoP.ForeColor = Color.Gray
                TSTM.ForeColor = Color.Gray
                FZRA.ForeColor = Color.White
                SLT.ForeColor = Color.Gray
                SN.ForeColor = Color.Gray
                QPF.ForeColor = Color.Gray
                SnowAmt.ForeColor = Color.Gray
                IceAccum.ForeColor = Color.Gray
                Wx.ForeColor = Color.Gray
                Sky.ForeColor = Color.Gray
                Wind.ForeColor = Color.Gray
                WindGust.ForeColor = Color.Gray
            Else
                FZRA.ForeColor = Color.Gray
                ColorTable.ImageLocation = ""
            End If
        End Sub
    
        Private Sub SLT_Click(sender As Object, e As EventArgs) Handles SLT.Click
            If SLT.ForeColor = Color.Gray Then
                ' Other Changes ^^^
                ' Color Table
                ColorTable.ImageLocation = "C:\Users\CarterHumphreys\SkyDrive\Tables\PoP.png"
                ' Label Colors
                maxT.ForeColor = Color.Gray
                minT.ForeColor = Color.Gray
                T.ForeColor = Color.Gray
                Td.ForeColor = Color.Gray
                PoP.ForeColor = Color.Gray
                TSTM.ForeColor = Color.Gray
                FZRA.ForeColor = Color.Gray
                SLT.ForeColor = Color.White
                SN.ForeColor = Color.Gray
                QPF.ForeColor = Color.Gray
                SnowAmt.ForeColor = Color.Gray
                IceAccum.ForeColor = Color.Gray
                Wx.ForeColor = Color.Gray
                Sky.ForeColor = Color.Gray
                Wind.ForeColor = Color.Gray
                WindGust.ForeColor = Color.Gray
            Else
                SLT.ForeColor = Color.Gray
                ColorTable.ImageLocation = ""
            End If
        End Sub
    
        Private Sub SN_Click(sender As Object, e As EventArgs) Handles SN.Click
            If SN.ForeColor = Color.Gray Then
                ' Other Changes ^^^
                ' Color Table
                ColorTable.ImageLocation = "C:\Users\CarterHumphreys\SkyDrive\Tables\PoP.png"
                ' Label Colors
                maxT.ForeColor = Color.Gray
                minT.ForeColor = Color.Gray
                T.ForeColor = Color.Gray
                Td.ForeColor = Color.Gray
                PoP.ForeColor = Color.Gray
                TSTM.ForeColor = Color.Gray
                FZRA.ForeColor = Color.Gray
                SLT.ForeColor = Color.Gray
                SN.ForeColor = Color.White
                QPF.ForeColor = Color.Gray
                SnowAmt.ForeColor = Color.Gray
                IceAccum.ForeColor = Color.Gray
                Wx.ForeColor = Color.Gray
                Sky.ForeColor = Color.Gray
                Wind.ForeColor = Color.Gray
                WindGust.ForeColor = Color.Gray
            Else
                SN.ForeColor = Color.Gray
                ColorTable.ImageLocation = ""
            End If
        End Sub
    
        Private Sub QPF_Click(sender As Object, e As EventArgs) Handles QPF.Click
            If QPF.ForeColor = Color.Gray Then
                ' Other Changes ^^^
                ' Color Table
                ColorTable.ImageLocation = "C:\Users\CarterHumphreys\SkyDrive\Tables\QPF_2.png"
                ' Label Colors
                maxT.ForeColor = Color.Gray
                minT.ForeColor = Color.Gray
                T.ForeColor = Color.Gray
                Td.ForeColor = Color.Gray
                PoP.ForeColor = Color.Gray
                TSTM.ForeColor = Color.Gray
                FZRA.ForeColor = Color.Gray
                SLT.ForeColor = Color.Gray
                SN.ForeColor = Color.Gray
                QPF.ForeColor = Color.White
                SnowAmt.ForeColor = Color.Gray
                IceAccum.ForeColor = Color.Gray
                Wx.ForeColor = Color.Gray
                Sky.ForeColor = Color.Gray
                Wind.ForeColor = Color.Gray
                WindGust.ForeColor = Color.Gray
            Else
                QPF.ForeColor = Color.Gray
                ColorTable.ImageLocation = ""
            End If
        End Sub
    
        Private Sub SnowAmt_Click(sender As Object, e As EventArgs) Handles SnowAmt.Click
            If SnowAmt.ForeColor = Color.Gray Then
                ' Other Changes ^^^
                ' Color Table
                ColorTable.ImageLocation = "C:\Users\CarterHumphreys\SkyDrive\Tables\SnowAmt_2.png"
                ' Label Colors
                maxT.ForeColor = Color.Gray
                minT.ForeColor = Color.Gray
                T.ForeColor = Color.Gray
                Td.ForeColor = Color.Gray
                PoP.ForeColor = Color.Gray
                TSTM.ForeColor = Color.Gray
                FZRA.ForeColor = Color.Gray
                SLT.ForeColor = Color.Gray
                SN.ForeColor = Color.Gray
                QPF.ForeColor = Color.Gray
                SnowAmt.ForeColor = Color.White
                IceAccum.ForeColor = Color.Gray
                Wx.ForeColor = Color.Gray
                Sky.ForeColor = Color.Gray
                Wind.ForeColor = Color.Gray
                WindGust.ForeColor = Color.Gray
            Else
                SnowAmt.ForeColor = Color.Gray
                ColorTable.ImageLocation = ""
            End If
        End Sub
    
        Private Sub IceAccum_Click(sender As Object, e As EventArgs) Handles IceAccum.Click
            If IceAccum.ForeColor = Color.Gray Then
                ' Other Changes ^^^
                ' Color Table
                ColorTable.ImageLocation = "C:\Users\CarterHumphreys\SkyDrive\Tables\IceAccum.png"
                ' Label Colors
                maxT.ForeColor = Color.Gray
                minT.ForeColor = Color.Gray
                T.ForeColor = Color.Gray
                Td.ForeColor = Color.Gray
                PoP.ForeColor = Color.Gray
                TSTM.ForeColor = Color.Gray
                FZRA.ForeColor = Color.Gray
                SLT.ForeColor = Color.Gray
                SN.ForeColor = Color.Gray
                QPF.ForeColor = Color.Gray
                SnowAmt.ForeColor = Color.Gray
                IceAccum.ForeColor = Color.White
                Wx.ForeColor = Color.Gray
                Sky.ForeColor = Color.Gray
                Wind.ForeColor = Color.Gray
                WindGust.ForeColor = Color.Gray
            Else
                IceAccum.ForeColor = Color.Gray
                ColorTable.ImageLocation = ""
            End If
        End Sub
    
        Private Sub Sky_Click(sender As Object, e As EventArgs) Handles Sky.Click
            If Sky.ForeColor = Color.Gray Then
                ' Other Changes ^^^
                ' Color Table
                ColorTable.ImageLocation = "C:\Users\CarterHumphreys\SkyDrive\Tables\Sky.png"
                ' Label Colors
                maxT.ForeColor = Color.Gray
                minT.ForeColor = Color.Gray
                T.ForeColor = Color.Gray
                Td.ForeColor = Color.Gray
                PoP.ForeColor = Color.Gray
                TSTM.ForeColor = Color.Gray
                FZRA.ForeColor = Color.Gray
                SLT.ForeColor = Color.Gray
                SN.ForeColor = Color.Gray
                QPF.ForeColor = Color.Gray
                SnowAmt.ForeColor = Color.Gray
                IceAccum.ForeColor = Color.Gray
                Wx.ForeColor = Color.Gray
                Sky.ForeColor = Color.White
                Wind.ForeColor = Color.Gray
                WindGust.ForeColor = Color.Gray
            Else
                Sky.ForeColor = Color.Gray
                ColorTable.ImageLocation = ""
            End If
        End Sub
    
        Private Sub Wind_Click(sender As Object, e As EventArgs) Handles Wind.Click
            If Wind.ForeColor = Color.Gray Then
                ' Other Changes ^^^
                ' Color Table
                ColorTable.ImageLocation = "C:\Users\CarterHumphreys\SkyDrive\Tables\Wind.png"
                ' Label Colors
                maxT.ForeColor = Color.Gray
                minT.ForeColor = Color.Gray
                T.ForeColor = Color.Gray
                Td.ForeColor = Color.Gray
                PoP.ForeColor = Color.Gray
                TSTM.ForeColor = Color.Gray
                FZRA.ForeColor = Color.Gray
                SLT.ForeColor = Color.Gray
                SN.ForeColor = Color.Gray
                QPF.ForeColor = Color.Gray
                SnowAmt.ForeColor = Color.Gray
                IceAccum.ForeColor = Color.Gray
                Wx.ForeColor = Color.Gray
                Sky.ForeColor = Color.Gray
                Wind.ForeColor = Color.White
                WindGust.ForeColor = Color.Gray
            Else
                Wind.ForeColor = Color.Gray
                ColorTable.ImageLocation = ""
            End If
        End Sub
    
        Private Sub WindGust_Click(sender As Object, e As EventArgs) Handles WindGust.Click
            If Wind.ForeColor = Color.Gray Then
                ' Other Changes ^^^
                ' Color Table
                ColorTable.ImageLocation = "C:\Users\CarterHumphreys\SkyDrive\Tables\Wind.png"
                ' Label Colors
                maxT.ForeColor = Color.Gray
                minT.ForeColor = Color.Gray
                T.ForeColor = Color.Gray
                Td.ForeColor = Color.Gray
                PoP.ForeColor = Color.Gray
                TSTM.ForeColor = Color.Gray
                FZRA.ForeColor = Color.Gray
                SLT.ForeColor = Color.Gray
                SN.ForeColor = Color.Gray
                QPF.ForeColor = Color.Gray
                SnowAmt.ForeColor = Color.Gray
                IceAccum.ForeColor = Color.Gray
                Wx.ForeColor = Color.Gray
                Sky.ForeColor = Color.Gray
                Wind.ForeColor = Color.Gray
                WindGust.ForeColor = Color.White
            Else
                Wind.ForeColor = Color.Gray
                ColorTable.ImageLocation = ""
            End If
        End Sub
        Private Sub Me_close(sender As Object, e As EventArgs) Handles Me.FormClosed
            End
        End Sub
    
        Private Sub DateTimePicker2_ValueChanged(sender As Object, e As EventArgs) Handles maxT_Time.ValueChanged
            maxT_Time.Format = DateTimePickerFormat.Custom
            maxT_Time.CustomFormat = "ddd HHZ dd-MMM-yy"
            maxT_Time.Hide()
    
        End Sub
    
       Private Sub Menu_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            maxT_Time.Hide()
            MinT_Time.Hide()
            Td_Time.Hide()
            T_Time.Hide()
            TSTM_Time.Hide()
            PoP_Time.Hide()
            DateTimePicker8.Hide()
            DateTimePicker9.Hide()
            DateTimePicker10.Hide()
            DateTimePicker11.Hide()
            DateTimePicker12.Hide()
            DateTimePicker13.Hide()
            DateTimePicker14.Hide()
            DateTimePicker15.Hide()
            DateTimePicker16.Hide()
            DateTimePicker17.Hide()
            DateTimePicker1.Format = DateTimePickerFormat.Custom
            DateTimePicker1.CustomFormat = "HH:mm:ssZ dd-MMM-yy"
            Time.Text = DateTimePicker1.Text
            DateTimePicker2.Format = DateTimePickerFormat.Custom
            DateTimePicker2.CustomFormat = "MMM dd (ddd)"
            D1.Text = DateTimePicker2.Text
            Timer1.Start()
            Timer1.Interval = 10
            Start_Up_Dialog.Hide()
            '
            '
            ' John's Code:
            Me.Size = New Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height)
            Me.CenterToScreen()
            DateTimePicker1.Format = DateTimePickerFormat.Custom
            DateTimePicker1.CustomFormat = "HH:mm:ssZ dd-MMM-yy"
    
            Dim PictureBox1 As New OpaquePictureBox
            PictureBox1.Name = "PictureBox1"
            PictureBox1.Left = SpatialEditor.Left
            PictureBox1.Top = SpatialEditor.Top
            PictureBox1.Size = New Size(SpatialEditor.Width, SpatialEditor.Height)
            AddHandler PictureBox1.MouseDown, AddressOf PictureBox1_MouseDown
            AddHandler PictureBox1.MouseUp, AddressOf PictureBox1_MouseUp
            AddHandler PictureBox1.MouseMove, AddressOf PictureBox1_MouseMove
            AddHandler PictureBox1.MouseEnter, AddressOf PictureBox1_MouseEnter
            AddHandler PictureBox1.MouseLeave, AddressOf PictureBox1_MouseLeave
            Me.Controls.Add(PictureBox1)
            PictureBox1.BringToFront()
    
            Dim SEI As New Bitmap(SpatialEditor.Width, SpatialEditor.Height)
            SEI.MakeTransparent()
            SpatialEditor.Image = SEI
    
            SaveFileDialog1.Filter = "Png file (*.png)|*.png"
            Timer1.Start()
    
            SpatialEditor.BackgroundImage = My.Resources.CWA3
        End Sub
        '
        ' John's Code:
        '
        Dim DrawnInformation As New List(Of Image)
        Dim DrawnInformationInt As Integer = 0
        Dim RemovingDrawnItems As Boolean = False
    
        Private Sub UndoGridEditToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles UndoGridEditToolStripMenuItem.Click
            If DrawnInformationInt > 0 Then
                SpatialEditor.Image = DrawnInformation(DrawnInformationInt - 1)
                DrawnInformationInt -= 1
                UndoDrawnInformationInt = DrawnInformationInt
                RemovingDrawnItems = True
            Else
                Dim OriginalImage As New Bitmap(SpatialEditor.Width, SpatialEditor.Height)
                OriginalImage.MakeTransparent()
                SpatialEditor.Image = OriginalImage
                DrawnInformationInt -= 1
                UndoDrawnInformationInt = DrawnInformationInt
                MessageBox.Show("No grid edit")
            End If
        End Sub
    
        Dim UndoDrawnInformationInt As Integer = 0
    
        Private Sub UndoRemove_Click(sender As Object, e As EventArgs) Handles RedoGridEditToolStripMenuItem.Click
            If UndoDrawnInformationInt < DrawnInformation.Count - 1 Then
                SpatialEditor.Image = DrawnInformation(UndoDrawnInformationInt + 1)
                UndoDrawnInformationInt += 1
                DrawnInformationInt = UndoDrawnInformationInt
            Else
                RemovingDrawnItems = False
                MessageBox.Show("Grid Edit Reapplied")
            End If
        End Sub
    
        Private Sub ToolStripButton14_Click(sender As Object, e As EventArgs) Handles ToolStripButton14.Click
            If DrawnInformationInt > 0 Then
                SpatialEditor.Image = DrawnInformation(DrawnInformationInt - 1)
                DrawnInformationInt -= 1
                UndoDrawnInformationInt = DrawnInformationInt
                RemovingDrawnItems = True
            Else
                Dim OriginalImage As New Bitmap(SpatialEditor.Width, SpatialEditor.Height)
                OriginalImage.MakeTransparent()
                SpatialEditor.Image = OriginalImage
                DrawnInformationInt -= 1
                UndoDrawnInformationInt = DrawnInformationInt
                MessageBox.Show("Grid Edit Removed")
            End If
        End Sub
    
        Dim TextDrawing As Boolean = False
        Dim TextDrawingFont As Font
        Dim TextDrawingColor As Color
    
        Private Sub ToolStripButton15_Click(sender As Object, e As EventArgs) Handles ToolStripButton15.Click
            If TextDrawing = False Then
                TextDrawing = True
                Try
                    FontDialog1.ShowDialog()
                    TextDrawingFont = FontDialog1.Font
                    ColorDialog1.ShowDialog()
                    TextDrawingColor = ColorDialog1.Color
                Catch ex As Exception
                End Try
                Dim tooltip7 As New ToolTip
                tooltip7.IsBalloon = True
                tooltip7.ToolTipIcon = ToolTipIcon.Info
                tooltip7.ToolTipTitle = "Adding Text"
                tooltip7.Show("Place the cursor on the picturebox at the location where" & vbCrLf & "you desire the top left corner of the text to begin.", _
                             TextBox1, New Point(CInt(TextBox1.Width / 2 - 20), -80), 3000)
            End If
        End Sub
    
    
    
        Dim Panel1Image As Integer = 1
        Dim CursorColor As Color = Color.Black
    
        Private Sub Panel1_Click(sender As Object, e As EventArgs) Handles Panel1.Click
            If Panel1Image = 6 Then
                MessageBox.Show("You can not change the pencils colors because" & vbCrLf & "it has multiple colors.")
            Else
                Dim Bmp As New Bitmap(Panel1.BackgroundImage)
                Dim CursorColors As New ColorDialog
                CursorColors.FullOpen = True
                If CursorColors.ShowDialog = Windows.Forms.DialogResult.OK Then
                    CursorColor = CursorColors.Color
                End If
                For x As Integer = 0 To Panel1.BackgroundImage.Width - 1
                    For y As Integer = 0 To Panel1.BackgroundImage.Height - 1
                        If Bmp.GetPixel(x, y).Equals(Color.FromArgb(0, 0, 0, 0)) Then
                        Else
                            Bmp.SetPixel(x, y, CursorColor)
                        End If
                    Next y
                Next x
                Panel1.BackgroundImage = Bmp
            End If
        End Sub
    
        Private Sub Panel1_MouseHover(sender As Object, e As EventArgs) Handles Panel1.MouseHover
            Dim tooltip1 As New ToolTip
            tooltip1.IsBalloon = True
            tooltip1.ToolTipIcon = ToolTipIcon.Info
            tooltip1.ToolTipTitle = "Cursors"
            tooltip1.Show("Click here to choose cursor color.", _
                         Panel1, New Point(CInt(Panel1.Width / 2 - 20), 30), 3000)
        End Sub
    
        Private Sub NumericUpDown1_ValueChanged(sender As Object, e As EventArgs) Handles NumericUpDown1.ValueChanged
            CursorLinesWidth = CInt(NumericUpDown1.Value)
        End Sub
    
        Private Sub NumericUpDown1_MouseHover(sender As Object, e As EventArgs) Handles NumericUpDown1.MouseHover
            Dim tooltip2 As New ToolTip
            tooltip2.IsBalloon = True
            tooltip2.ToolTipIcon = ToolTipIcon.Info
            tooltip2.ToolTipTitle = "Cursor Line Width"
            tooltip2.Show("Click here to choose cursor line width.", _
                         NumericUpDown1, New Point(CInt(NumericUpDown1.Width / 2 - 20), 30), 3000)
        End Sub
    
        Private Sub Panel2_Click(sender As Object, e As EventArgs) Handles Panel2.Click
            Dim Bmp As New Bitmap(Panel2.BackgroundImage)
            Dim CursorColors As New ColorDialog
            CursorColors.FullOpen = True
            If CursorColors.ShowDialog = Windows.Forms.DialogResult.OK Then
                CursorLinesColor = CursorColors.Color
                For x As Integer = 0 To Panel2.BackgroundImage.Width - 1
                    For y As Integer = 0 To Panel2.BackgroundImage.Height - 1
                        If Bmp.GetPixel(x, y).Equals(Color.FromArgb(0, 0, 0, 0)) Then
                        Else
                            Bmp.SetPixel(x, y, CursorLinesColor)
                        End If
                    Next y
                Next x
            End If
            Panel2.BackgroundImage = Bmp
        End Sub
    
        Private Sub Panel2_MouseHover(sender As Object, e As EventArgs) Handles Panel2.MouseHover
            Dim tooltip3 As New ToolTip
            tooltip3.IsBalloon = True
            tooltip3.ToolTipIcon = ToolTipIcon.Info
            tooltip3.ToolTipTitle = "Cursor Lines Color"
            tooltip3.Show("Click here to choose cursor lines color.", _
                         Panel2, New Point(CInt(Panel2.Width / 2 - 20), 30), 3000)
        End Sub
    
        Dim PickLinesColor As Boolean = False
    
        Private Sub Panel3_Click(sender As Object, e As EventArgs) Handles Panel3.Click
            tooltip5.RemoveAll()
            Dim tooltip4 As New ToolTip
            PickLinesColor = True
            tooltip4.IsBalloon = True
            tooltip4.ToolTipIcon = ToolTipIcon.Info
            tooltip4.ToolTipTitle = "Drawing Line Color"
            tooltip4.Show("Click on color table to choose line color.", _
                         Panel3, New Point(CInt(Panel3.Width / 2 - 20), 30), 3000)
        End Sub
    
        Dim tooltip5 As New ToolTip
    
        Private Sub Panel3_MouseHover(sender As Object, e As EventArgs) Handles Panel3.MouseHover
            tooltip5.IsBalloon = True
            tooltip5.ToolTipIcon = ToolTipIcon.Info
            tooltip5.ToolTipTitle = "Drawing Line Color"
            tooltip5.Show("Click here to choose drawing line color from color table.", _
                         Panel3, New Point(CInt(Panel3.Width / 2 - 20), 30), 3000)
        End Sub
    
        Dim LinesWidth As Integer = 1
    
        Private Sub NumericUpDown2_ValueChanged(sender As Object, e As EventArgs) Handles NumericUpDown2.ValueChanged
            LinesWidth = CInt(NumericUpDown2.Value)
        End Sub
    
        Private Sub NumericUpDown2_MouseHover(sender As Object, e As EventArgs) Handles NumericUpDown2.MouseHover
            Dim tooltip6 As New ToolTip
            tooltip6.IsBalloon = True
            tooltip6.ToolTipIcon = ToolTipIcon.Info
            tooltip6.ToolTipTitle = "Drawing Line Width"
            tooltip6.Show("Click here to choose drawing line width.", _
                         NumericUpDown2, New Point(CInt(NumericUpDown2.Width / 2 - 20), 30), 3000)
        End Sub
    
        Dim LinesColor As Color = Color.Black
    
        Private Sub ColorTable_MouseDown(sender As Object, e As MouseEventArgs) Handles ColorTable.MouseDown
            Dim Bmp1 As New Bitmap(Panel3.BackgroundImage)
            Dim Bmp2 As New Bitmap(ColorTable.Image)
            If PickLinesColor = True Then
                LinesColor = Bmp2.GetPixel(e.X, e.Y)
                For x As Integer = 0 To Panel3.BackgroundImage.Width - 1
                    For y As Integer = 0 To Panel3.BackgroundImage.Height - 1
                        If Bmp1.GetPixel(x, y).Equals(Color.FromArgb(0, 0, 0, 0)) Then
                        Else
                            Bmp1.SetPixel(x, y, LinesColor)
                        End If
                    Next y
                Next x
            End If
            Panel3.BackgroundImage = Bmp1
            PickLinesColor = False
        End Sub
    
        Dim PixelLocationsXGray As New List(Of Integer)
        Dim PixelLocationsYGray As New List(Of Integer)
        Dim PixelLocationsXYellow As New List(Of Integer)
        Dim PixelLocationsYYellow As New List(Of Integer)
    
        Private Sub RedrawBorders_Click(sender As Object, e As EventArgs) Handles RedrawBorders.Click
            PixelLocationsXGray.Clear()
            PixelLocationsYGray.Clear()
            PixelLocationsXYellow.Clear()
            PixelLocationsYYellow.Clear()
            Dim Bmp As Bitmap
            Bmp = CType(SpatialEditor.BackgroundImage(), Bitmap)
            For x = 0 To SpatialEditor.Width - 1
                For y = 0 To SpatialEditor.Height - 1
                    If Bmp.GetPixel(x, y).Name.ToString = "ffc8c8c8" Then
                        PixelLocationsXGray.Add(x)
                        PixelLocationsYGray.Add(y)
                    End If
                Next
            Next
            For x = 0 To SpatialEditor.Width - 1
                For y = 0 To SpatialEditor.Height - 1
                    If Bmp.GetPixel(x, y).Name.ToString = "ffd1d100" Then
                        PixelLocationsXYellow.Add(x)
                        PixelLocationsYYellow.Add(y)
                    End If
                Next
            Next
            Dim SEBmp As Bitmap
            SEBmp = CType(SpatialEditor.Image, Bitmap)
            For x = 0 To PixelLocationsXGray.Count - 1
                SEBmp.SetPixel(PixelLocationsXGray(x), PixelLocationsYGray(x), Color.FromArgb(255, 200, 200, 200))
            Next
            For x = 0 To PixelLocationsXYellow.Count - 1
                SEBmp.SetPixel(PixelLocationsXYellow(x), PixelLocationsYYellow(x), Color.FromArgb(255, 209, 209, 0))
            Next
            SpatialEditor.Image = SEBmp
        End Sub
    
        Dim MouseButtonLeft As Boolean = False
    
        Private Sub PictureBox1_MouseDown(sender As Object, e As MouseEventArgs)
            If MouseButtons = Windows.Forms.MouseButtons.Left Then
                MouseButtonLeft = True
                If StraightLines = True Then
                    DrawingStraightLineStartX = e.X
                    DrawingStraightLineStartY = e.Y
                    StraightLineXinfo = e.X
                    StraightLineYinfo = e.Y
                    KeepDrawingLineTemp()
                ElseIf FreeHandLinesStart = True Then
                    DrawFreehandLinesOnSpatialEditor(e.X, e.Y, True, Nothing, Nothing, Nothing)
                ElseIf TextDrawing = True Then
                    AddTextToDrawing(TextDrawingFont, TextDrawingColor, TextBox1.Text, e.X, e.Y, True)
                End If
            End If
        End Sub
    
        Private Sub PictureBox1_MouseMove(sender As Object, e As MouseEventArgs)
            If DOSE = True Then
                PictureBox1CursorLocationLines(e.X, e.Y, True)
            End If
            If StraightLines = True AndAlso MouseButtonLeft = True AndAlso DOSE = True Then
                StraightLineXinfo = e.X
                StraightLineYinfo = e.Y
                KeepDrawingLineTemp()
            ElseIf StraightLines = True And MouseButtonLeft = True And DOSE = False Then
                StraightLineXinfo = e.X
                StraightLineYinfo = e.Y
                SpatialEditor.Refresh()
                KeepDrawingLineTemp()
            ElseIf FreeHandLinesStart = True And MouseButtonLeft = True AndAlso DOSE = True Then
                DrawFreehandLinesOnSpatialEditor(e.X, e.Y, Nothing, True, Nothing, Nothing)
            ElseIf FreeHandLinesStart = True And MouseButtonLeft = True And DOSE = False Then
                DrawFreehandLinesOnSpatialEditor(e.X, e.Y, Nothing, True, Nothing, Nothing)
            End If
        End Sub
    
        Private Sub PictureBox1_MouseUp(sender As Object, e As MouseEventArgs)
            MouseButtonLeft = False
            If StraightLines = True Then
                DrawStraightLinesOnSpatialEditor(e.X, e.Y, True, RemovingDrawnItems)
                SpatialEditor.Refresh()
            ElseIf FreeHandLinesStart = True Then
                DrawFreehandLinesOnSpatialEditor(e.X, e.Y, Nothing, Nothing, True, RemovingDrawnItems)
                SpatialEditor.Refresh()
            End If
        End Sub
    
        Private Sub PictureBox1_MouseEnter(sender As Object, e As EventArgs)
            If DOSE = True Or StraightLines = True Or FreeHandLinesStart = True Then
                Dim BMP As New Bitmap(Panel1.BackgroundImage)
                Me.Cursor = New Cursor(BMP.GetHicon)
            End If
        End Sub
    
        Private Sub PictureBox1_MouseLeave(sender As Object, e As EventArgs)
            If DOSE = True Or StraightLines = True Or FreeHandLinesStart = True Then
                Cursor = Cursors.Arrow
            End If
        End Sub
    
        Dim DOSE As Boolean = False
        Dim LeaveLineCrossingEmpty As Integer = 0 ' Sets SpatialEditorCursorLocationLines leave 12 pixel width height and width empty at mouse cursor center point.
        Dim CursorLinesColor As Color = Color.Black
        Dim CursorLinesWidth As Integer = 1
    
        Private Function PictureBox1CursorLocationLines(ByRef Xref As Integer, ByRef Yref As Integer, ByVal Okay As Boolean) As Integer
            If Okay = True Then
                SpatialEditor.Refresh()
                Dim Ctrl As Control
                For Each Ctrl In Me.Controls
                    If Ctrl.Name = "PictureBox1" Then
                        Dim Brush As New SolidBrush(CursorLinesColor)
                        Dim Pen1 As New Pen(Brush, CursorLinesWidth)
                        Dim g As Graphics = Ctrl.CreateGraphics()
                        If LeaveLineCrossingEmpty = 1 Then
                            g.DrawLine(Pen1, 0, Yref, Xref - 6, Yref) ' Draws horizontal line from 0 (left side of SpatialEditor) to -6 pixels left side of mouse center
                            g.DrawLine(Pen1, Xref + 6, Yref, Ctrl.Width, Yref) ' Draws horizontal line from +6 pixels on right side of mouse center to SpatialEditors right side
                            g.DrawLine(Pen1, Xref, 0, Xref, Yref - 6) ' Draws vertical line
                            g.DrawLine(Pen1, Xref, Yref + 6, Xref, Ctrl.Height) ' Draws vertical line
                        Else
                            g.DrawLine(Pen1, 0, Yref, Ctrl.Width, Yref) ' Draws horizontal line
                            g.DrawLine(Pen1, Xref, 0, Xref, Ctrl.Height) ' Draws vertical line
                        End If
                        Brush.Dispose()
                        Pen1.Dispose()
                        g.Dispose()
                    End If
                Next
            End If
            Return Nothing
        End Function
    
        Dim StraightLines As Boolean = False
        Dim DrawingStraightLineStartX As Integer = 0
        Dim DrawingStraightLineStartY As Integer = 0
        Dim StraightLineXinfo As Integer = 0
        Dim StraightLineYinfo As Integer = 0
    
        Private Function DrawStraightLinesOnSpatialEditor(ByRef Xref As Integer, ByRef Yref As Integer, ByVal Okay As Boolean, ByVal Remove As Boolean) As Boolean
            If Remove = True Then
                RemovingDrawnItems = False
                If DrawnInformationInt = -1 Then
                    DrawnInformation.Clear()
                ElseIf DrawnInformationInt > -1 Then
                    Do Until DrawnInformation.Count - 1 = DrawnInformationInt
                        DrawnInformation.RemoveAt(DrawnInformation.Count - 1)
                    Loop
                End If
            End If
            If Okay = True Then
                Dim SpatialEditorImage As Bitmap = New Bitmap(CType(SpatialEditor.Image, Bitmap))
                Dim Pen1 As New Pen(LinesColor, LinesWidth)
                Dim g As Graphics = SpatialEditor.CreateGraphics()
                g = Graphics.FromImage(SpatialEditorImage)
                g.DrawLine(Pen1, DrawingStraightLineStartX, DrawingStraightLineStartY, Xref, Yref)
                Pen1.Dispose()
                g.Dispose()
                SpatialEditor.Image = SpatialEditorImage
                DrawnInformation.Add(SpatialEditor.Image)
                DrawnInformationInt = DrawnInformation.Count - 1
                UndoDrawnInformationInt = DrawnInformationInt
            End If
            Return Nothing
        End Function
    
        Private Sub KeepDrawingLineTemp()
            Dim Pen1 As New Pen(LinesColor, 1)
            Dim g As Graphics = SpatialEditor.CreateGraphics()
            g.DrawLine(Pen1, DrawingStraightLineStartX, DrawingStraightLineStartY, StraightLineXinfo, StraightLineYinfo)
            Pen1.Dispose()
            g.Dispose()
        End Sub
    
        Dim FreeHandLinesCoords As New List(Of Point)
        Dim FreeHandLinesStart As Boolean = False
        Dim FreeHandLinesFinish As Boolean = False
        Dim DrawingFreeHandLinesStartX As Integer = 0
        Dim DrawingFreeHandLinesStartY As Integer = 0
        Dim FreeHandLinesXinfo As Integer = 0
        Dim FreeHandLinesYinfo As Integer = 0
    
        Private Function DrawFreehandLinesOnSpatialEditor(ByRef Xref As Integer, ByRef Yref As Integer, ByVal Start As Boolean, ByVal Moving As Boolean, ByVal Finish As Boolean, ByVal Remove As Boolean) As Boolean
            If Remove = True Then
                RemovingDrawnItems = False
                If DrawnInformationInt = -1 Then
                    DrawnInformation.Clear()
                ElseIf DrawnInformationInt > -1 Then
                    Do Until DrawnInformation.Count - 1 = DrawnInformationInt
                        DrawnInformation.RemoveAt(DrawnInformation.Count - 1)
                    Loop
                End If
            End If
            If Start = True Then
                FreeHandLinesCoords.Clear()
                Dim PTStart As New Point(Xref, Yref)
                FreeHandLinesCoords.Add(PTStart)
            ElseIf Moving = True Then
                Dim PTMoving As New Point(Xref, Yref)
                FreeHandLinesCoords.Add(PTMoving)
                KeepDrawingFreeHandLines(Xref, Yref, True)
            ElseIf Finish = True Then
                KeepDrawingFreeHandLines(Xref, Yref, False)
                Dim SpatialEditorImage As Bitmap = New Bitmap(CType(SpatialEditor.Image, Bitmap))
                Dim Pen1 As New Pen(LinesColor, LinesWidth)
                Dim Brush1 As New SolidBrush(LinesColor)
                Dim g As Graphics = SpatialEditor.CreateGraphics()
                g = Graphics.FromImage(SpatialEditorImage)
                Dim PTSFinished() As Point = FreeHandLinesCoords.ToArray
                Try
                    g.DrawClosedCurve(Pen1, PTSFinished)
                    If FillFreeHandLinesBoolean = True Then
                        g.FillClosedCurve(Brush1, PTSFinished, FillMode.Winding, 1.0F)
                    End If
                Catch ex As Exception
                End Try
                SpatialEditor.Image = SpatialEditorImage
                DrawnInformation.Add(SpatialEditor.Image)
                DrawnInformationInt = DrawnInformation.Count - 1
                UndoDrawnInformationInt = DrawnInformationInt
                Pen1.Dispose()
                Brush1.Dispose()
                g.Dispose()
            End If
            Return Nothing
        End Function
    
        Dim KeepDrawingFreeHandLinesList As New List(Of Integer)
    
        Private Function KeepDrawingFreeHandLines(ByRef Xref As Integer, ByRef Yref As Integer, ByVal Start As Boolean) As Boolean
            If Start = True Then
                Dim Pen1 As New Pen(LinesColor, 1)
                Dim g As Graphics = SpatialEditor.CreateGraphics()
                Dim Counter As Integer = 0
                KeepDrawingFreeHandLinesList.Add(Xref)
                KeepDrawingFreeHandLinesList.Add(Yref)
                If KeepDrawingFreeHandLinesList.Count > 10 Then
                    Do Until Counter = KeepDrawingFreeHandLinesList.Count - 2
                        g.DrawLine(Pen1, KeepDrawingFreeHandLinesList(Counter), KeepDrawingFreeHandLinesList(Counter + 1), KeepDrawingFreeHandLinesList(Counter + 2), KeepDrawingFreeHandLinesList(Counter + 3))
                        Counter += 2
                    Loop
                    Pen1.Dispose()
                    g.Dispose()
                End If
            ElseIf Start = False Then
                KeepDrawingFreeHandLinesList.Clear()
            End If
            Return Nothing
        End Function
    
        Private Function AddTextToDrawing(ByRef FontInfo As Font, ByRef FontColor As Color, ByRef TextInfo As String, ByRef Xref As Integer, ByRef Yref As Integer, ByVal Start As Boolean) As Boolean
            If Start = True Then
                Dim SpatialEditorImage As Bitmap = New Bitmap(CType(SpatialEditor.Image, Bitmap))
                Dim Brush1 As New SolidBrush(FontColor)
                Dim g As Graphics = SpatialEditor.CreateGraphics()
                g = Graphics.FromImage(SpatialEditorImage)
                g.DrawString(TextInfo, FontInfo, Brush1, Xref, Yref)
                SpatialEditor.Image = SpatialEditorImage
                DrawnInformation.Add(SpatialEditor.Image)
                DrawnInformationInt = DrawnInformation.Count - 1
                UndoDrawnInformationInt = DrawnInformationInt
                Brush1.Dispose()
                g.Dispose()
            End If
            Return Nothing
        End Function
    #Region "OpaquePictureBox"
    
        Public Class OpaquePictureBox
            Inherits Control
    
            Private Shared ReadOnly DefaultBackground As Color = Color.Transparent
            Private TransparentImage As Image
    
            Public Sub New()
                Me.SetStyle(ControlStyles.AllPaintingInWmPaint, True)
                Me.SetStyle(ControlStyles.Opaque, True)
                Me.SetStyle(ControlStyles.SupportsTransparentBackColor, True)
                BackColor = DefaultBackground
            End Sub
    
            Public Overrides Property BackColor() As System.Drawing.Color
                Get
                    Return MyBase.BackColor
                End Get
                Set(ByVal value As System.Drawing.Color)
                    MyBase.BackColor = value
                End Set
            End Property
    
            Public Property Image() As Image
                Get
                    Return TransparentImage
                End Get
                Set(ByVal value As Image)
                    TransparentImage = value
                    Invalidate()
                End Set
            End Property
    
            Protected Overrides ReadOnly Property CreateParams() As System.Windows.Forms.CreateParams
                Get
                    Dim cp As CreateParams = MyBase.CreateParams
                    cp.ExStyle = cp.ExStyle Or &H20
                    Return cp
                End Get
            End Property
    
            ' Infrastructure to cause the default background to be transparent
            Public Function ShouldSerializeBackColor() As Boolean
                Return BackColor = DefaultBackground
            End Function
    
            ' Infrastructure to cause the default background to be transparent
            Public Sub ResetBackground()
                BackColor = DefaultBackground
            End Sub
    
        End Class
    
    #End Region
    
        Dim FillFreeHandLinesBoolean As Boolean = False
    
        Private Sub ToolStripButton16_Click(sender As Object, e As EventArgs) Handles ToolStripButton16.Click
            FillFreeHandLinesBoolean = False
            ToolStripButton16.Checked = True
        End Sub
        Private Sub ToolStripButton16_DoubleClick(sender As Object, e As EventArgs) Handles ToolStripButton16.DoubleClick
            FillFreeHandLinesBoolean = True
            ToolStripButton16.Checked = False
        End Sub
    
        Private Sub ToolStripButton17_Click(sender As Object, e As EventArgs) Handles ToolStripButton17.Click
            FreeHandLinesStart = True
            ToolStripButton17.Checked = True
        End Sub
    
        Private Sub ToolStripButton17_DoubleClick(sender As Object, e As EventArgs) Handles ToolStripButton17.DoubleClick
            FreeHandLinesStart = False
            ToolStripButton17.Checked = False
        End Sub
    
        Private Sub ToolStripButton3_Click(sender As Object, e As EventArgs) Handles ToolStripButton3.Click
            Temporal_Editor.Show()
        End Sub
    
        Private Sub DateTimePicker2_ValueChanged_1(sender As Object, e As EventArgs) Handles DateTimePicker2.ValueChanged
            DateTimePicker2.Format = DateTimePickerFormat.Custom
            DateTimePicker2.CustomFormat = "MMM dd (ddd)"
            D1.Text = DateTimePicker2.Text
        End Sub
    End Class


    Regards, Carter Humphreys

    Tuesday, October 08, 2013 9:31 PM
  • If it were working you would not be receiving an object reference exception.

    Please BEWARE that I have NO EXPERIENCE and NO EXPERTISE and probably onset of DEMENTIA which may affect my answers! Also, I've been told by an expert, that when you post an image it clutters up the thread and mysteriously, over time, the link to the image will somehow become "unstable" or something to that effect. :) I can only surmise that is due to Global Warming of the threads.

    Tuesday, October 08, 2013 10:38 PM