Map.NET continues pretty well. I've got a virtual scrolling area working now and an actual MapGrid class that stores the IDs of the cells. The scrolling area only draws the visible cells, but does pixel scrolling so looks quite cool. It also means that while it is a bit laggy compared to my C++ Map application, it is no more laggy with 1000x1000 cells than with 20x20.
I had to implement the virtual scrolling area using a PictureBox and a HScrollBar and VScrollBar though, which was dead fiddly. I really wish there was a .NET component like a VirtualScrollBox sort of thing, that provided system-managed scrollbars that you could just set the maximum values for and an OnScroll event that allowed you to paint manually to the client area, based on the H and V scroll positions.
If anyone knows of such a thing and could enlighten me, you'd make my day.
Anyway, so far so good. The next step is to allow the scheme file to generate a list of blocks with IDs and bitmaps, and make the values in the MapGrid refer to a block by ID, so the bitmap is drawn instead of the current blocks of solid colour. Going back in...
GDI+ does not currently support raster operations, apparently. So I can't draw a rectangle on the screen with a NOT operation. Bugger.
So I can't do a "rubber-band" selection rectangle without invalidating the entire PictureBox image on every mouse move.
I did try all this arcane interfacing with gdi32.dll stuff, but the program wouldn't run because of permissions or some such voodoo nonsense.
I tried just drawing a dotted rectangle and invalidating the PictureBox in the mouse move event and it seemed to work sort of okay, but I'm not happy.
Actually, that works sort of okay. On a maximised window at 1280x1024 with 32x32 blocks, it runs at an acceptable pace. Slows a bit with 8x8 blocks at the same resolution, but I really don't know what else to do.
It only really works here because the selection rectangle is locked to the cell boundaries. If it was pixel-free, I suspect it would be even worse.
Actually drawing the selection rect as a hollow white rectangle with a 2pixel wide line and a black drop shadow. Seems to stand out okay against most colours.
I am very disappointed that GDI+ doesn't support raster ops though. It seems pretty extreme that you have to resort to unmanaged code to do this in C#. Even if I could get the security settings right for this on my own PC, I suspect that anyone else running my final application would get a load of scary warning messages.
I think I'm going to call it GDI- from now on [flaming].