示例#1
0
        //static readonly Brush tableBrush = new LinearGradientBrush(new Rectangle(0, 0, Consts.tableBlockLength, bmpHeight), Color.LightBlue, Color.DarkBlue, 0f);

        private static void DrawTables(FileDBContext db, FileStream fs, Bitmap[] bmps)
        {
            TableBlock tableBlockHead = db.GetTableBlockHeadNode();
            TableBlock previousTable  = tableBlockHead;

            {
                long     index    = previousTable.ThisPos.PagePos() / Consts.pageSize;
                Bitmap   bmp      = bmps[index];
                Graphics g        = Graphics.FromImage(bmp);
                int      length   = previousTable.ToBytes().Length;
                int      startPos = (int)(previousTable.ThisPos - Consts.pageSize * index);
                Brush    brush    = new LinearGradientBrush(new Point(startPos, 0), new Point(startPos + length), Color.DarkOrange, Color.OrangeRed);
                g.FillRectangle(brush, startPos, 1, length, bmpHeight - 1);
                g.DrawRectangle(boundPen, startPos, 1, length, bmpHeight - 1);
                g.Dispose();
            }
            while (previousTable.NextPos != 0)
            {
                previousTable.TryLoadNextObj(fs);
                TableBlock table = previousTable.NextObj;

                long     index    = table.ThisPos.PagePos() / Consts.pageSize;
                Bitmap   bmp      = bmps[index];
                Graphics g        = Graphics.FromImage(bmp);
                int      length   = table.ToBytes().Length;
                int      startPos = (int)(table.ThisPos - Consts.pageSize * index);
                Brush    brush    = new LinearGradientBrush(new Point(startPos, 0), new Point(startPos + length, 0), Color.DarkOrange, Color.OrangeRed);
                g.FillRectangle(brush, startPos, 1, length, bmpHeight - 1);
                g.DrawRectangle(boundPen, startPos, 1, length, bmpHeight - 1);
                g.Dispose();

                previousTable = table;
            }
        }