Visual Studio 2022: Windows Apps Forms: Visual Basic I want you to draw me a 15 by 10…
- User
Visual Studio 2022: Windows Apps Forms: Visual Basic
I want you to draw me a 15 by 10 grid on picGame That stretches across picGame
- Assistant
- User
Put numbers on the top of the grid from 1 to 15 and number 1 to 10 on the left side of the grid please
- Assistant
- User
FYI It's called frmDesigner...
Make the grid smaller, so the numbers across the top are above it and the numbers on the left are behind it.
- Assistant
- User
Make sure there is a gap of 30 pixels at the top bottom left and right
- Assistant
- User
Just raise the numbers at the top maybe 4 pixels.
Then we need walls. The walls works as follows...
the walls fit around every square they will be 20% the size of the square.
¦ ¦ ¦ ¦
- Assistant
- User
Now we have the bones Thank you...
Now we need to draw each segment individually. We have the walls Vertical Walls and Horizontal Walls Make the wall Blue for now, for testing purposes. And the floors green. And the segments inbetween red. (The segements inbetween are the tiny boxes inbetween walls)
- Assistant
- User
Thats a great start. Let's tidy it up. The size of the red squares is absolutley PERFECT. Make the walls that width also and stretch the floors to fill the inbetween area.
Also. We need a mousemove method now.
I have added (in Designer) 2 ToolStripStatusLabels. When the user hovers over the grid have stbMouseCoords display the mouses coordinates (in pixels) and stbGridCoords the mouses location on the grid. For example if we are hovered over Floor 1,4 the output is "Floor 1,4" or if we are hovered over a vertical wall or a Horizontal wall the output is "Vertical Wall" + X,Y or "Horizontal Wall" + X,Y.
- Assistant
- User
The mouse is perfect! TY
The grid however. is ugh
The white space around the red middle squares needs to go. the walls should fill the area between the red squares. And the floor should fill the rest.
Also when hovered over a red square have the output on stbGridCoords display "-" same for outside grid
- Assistant
- User
Almost. The top left of the green square should start at the bottom right of the red square and the bottom right of the green square should start at the top left of the red square.
- Assistant
- User
The floors are not filling the area.
The Red Squares are the perfect size. And the perfect location.... The walls should be the same width as the red squares. The top left corner of a vertical wall should start at the bottom left corner of a red square. The top left corner of a horizontal wall should start at the top right corner of a red square. The top left corner of a floor should start at the bottom right corner of the red square and the bottom right corner of the floor should be the top left corner of the red squares.
- Assistant
- User
Let's just do the Horizintal walls and red squares for now.
Draw the red squares exactly as they are. They are perfect!
Inbetween each red square draw the walls. The top left corner of a horizontal wall should start at the top right corner of a red square.SO you have this
[R ][ BLUE ][R ]
- Assistant
- User
Excellent!
Now add the vertical walls. So basically it's exactly the same as the horizontal walls just vertical
- Assistant
- User
Perfect!
And now the white space in the middle is our floor. And hosuld be green :)
- Assistant
- User
Almost. The middle square isn't quite centred. It off by about 10 pixels too far right and too far down.
Also add the mousemove back please
- Assistant
- User
OK the math has gone wrong somewhere. This part has to be mathematically perfect or later on down the line we run into issues.
The stbGridCoords is off slightly about 10 pixels too far right and 10 pixels too far down.
However. looking at the grid it's in complete form I believe the walls are slightly too thick (I apologize) lets make the red squares 10% smaller and adjust everything else to fit.
- Assistant
- User
Another 10% smaller on the red squares and remember the walls need to match the width of the red squares. And the floor fills the area inbetween
- Assistant
- User
OK. I'm happy with the grid. It's perfect! Thank you. You're a superstar!
The MouseMove is off slightly. The top of the first horizontal blue wall is around pixel 22. However stbGridCoords doesn't register it until pixel 30
I believe this is because of Dim gap As Integer = 30
Don't alter the grid. It's absolutely beautiful as it is. But. Adjust the maths slightly
- Assistant
- User
Perfect.
Now to add a flashing highlight. When we hover over a square or wall the area will highlight with a flashing highlighter.
- Assistant
- User
Sadly no timer is being drawn?
Also. FYI I a Utilities class. Inside I have this Sub Public Sub EnableDoubleBuffering(control As Control) Dim propertyInfo As PropertyInfo = control.GetType().GetProperty("DoubleBuffered", BindingFlags.NonPublic Or BindingFlags.Instance) propertyInfo.SetValue(control, True, Nothing) End Sub
- Assistant
- User
- Assistant
- User
The highlight is still off by 8 pixels to the right and to the bottom.
Also make it flash black and white please
- Assistant