private void PaintEntry(Graphics aGraphics, Point aTopLeft, GridEntry aEntry) { Color backColor; if(aEntry.Hovering) backColor = Color.LightGray; else backColor = aEntry.Selected ? Color.DarkKhaki : BackColor; using (SolidBrush brush = new SolidBrush(backColor)) { Rectangle rec = new Rectangle(aTopLeft, new Size(mEntryWidth, mRowHeight)); aGraphics.FillRectangle(brush, rec); brush.Color = ForeColor; aGraphics.DrawString(aEntry.Altitude.ToString(), this.Font, brush, new PointF(aTopLeft.X, aTopLeft.Y)); if (aEntry.Tile) { brush.Color = mLevel.Palette[aEntry.TilePaletteIndex]; aGraphics.FillRectangle(brush, new Rectangle(aTopLeft.X, aTopLeft.Y + mRowHeight / 3, mEntryWidth / 2, 2 * mRowHeight / 3)); } if (aEntry.Tunnel || aEntry.Block) { brush.Color = mLevel.Palette[aEntry.BlockPaletteIndex]; aGraphics.FillRectangle(brush, new Rectangle(aTopLeft.X + mEntryWidth / 2, aTopLeft.Y + mRowHeight / 3, mEntryWidth / 2, 2 * mRowHeight / 3)); } } }
public void Addrow(int aCount) { if (mGrabNode == null) return; if (aCount < 1 || 40 < aCount) return; for (int count = 0; count < aCount; ++count) { GridRow row = new GridRow(); for (int i = 0; i < 7; ++i) row[i] = new GridEntry(mGrabNode.Value[i]); LinkedListNode<GridRow> node = new LinkedListNode<GridRow>(row); mLevel.Grid.AddAfter(mGrabNode, node); } AutoScrollMinSize = ContentSize; mWindow.Recalculate(); Invalidate(); }
public Grid(BinaryReader reader, string version) { mRowData = new LinkedList<GridRow>(); byte[] buf = new byte[2]; while (reader.Read(buf, 0, 1) > 0) { reader.BaseStream.Seek(-1, SeekOrigin.Current); GridRow row = new GridRow(); for (int i = 0; i < 7; ++i) row[i] = new GridEntry(reader, version); mRowData.AddLast(new GridRow(row)); } }
public GridRow(GridRow aOther) { for (int i = 0; i < 7; i++) mEntry[i] = new GridEntry(aOther[i]); }
public GridRow() { for (int i = 0; i < 7; i++) mEntry[i] = new GridEntry(); }
public GridEntry(GridEntry aOther) { mAltitude = aOther.mAltitude; mTilePaletteIndex = aOther.mTilePaletteIndex; mBlockPaletteIndex = aOther.mBlockPaletteIndex; mTile = aOther.mTile; mTunnel = aOther.mTunnel; mBlock = aOther.mBlock; mExit = aOther.mExit; }