Ejemplo n.º 1
0
        // Draw a command timeline for each bank -- The lines drawing get erased when the form gets expanded
        private void drawBankLines(TimeLineGraphics tgfx)
        {
            System.Drawing.Pen myPen;
            myPen = new Pen(Color.Black);
            System.Drawing.Graphics formGraphics = this.CreateGraphics();

            Font drawFont = new System.Drawing.Font("Arial", Config.gfx.gui_font_size);

            // Draw a line for each bank
            uint   numBanks    = Config.mem.bank_max;
            uint   yStart      = (uint)Config.gfx.y_line_start_pos;
            string placeHolder = "CMD\nCYC\nROW";
            SizeF  stringSize  = formGraphics.MeasureString(placeHolder, drawFont, Config.gfx.gui_box_width_for_string);
            // Determine the spacing between each command timeline
            uint lineSpace = (uint)(button1.Location.Y - yStart - stringSize.Height -
                                    myPen.Width * numBanks) / (numBanks - 1);

            // One line at a time
            for (int b = 0; b < numBanks; b++)
            {
                int yCoord = (int)(yStart + b * lineSpace);

                // Bank id string
                Point  text = new Point(0, yCoord);
                string bstr = "B" + b;
                //formGraphics.DrawString(bstr, drawFont, Brushes.Black, text);
                stringSize = formGraphics.MeasureString(bstr, drawFont, Config.gfx.gui_box_width_for_string);
                addTextBox(bstr, text.X, text.Y, (int)stringSize.Width, (int)stringSize.Height,
                           Brushes.Crimson, Brushes.White);

                // Bank cmd timelines
                int   lineYCoord = yCoord + (int)stringSize.Height + 1;
                Point start      = new Point(Config.gfx.x_line_start_pos, lineYCoord);
                Point end        = new Point(this.Size.Width - 50, lineYCoord);
                formGraphics.DrawLine(myPen, start, end);
                text.X = start.X;
                tgfx.UpdateBankState(start, end, text, b);
            }
        }
Ejemplo n.º 2
0
 public Form1(Sim.Sim sim)
 {
     InitializeComponent();
     this.sim = sim;
     tgfx     = new TimeLineGraphics();
 }