示例#1
0
 private void cmoSelectedSection_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (sender == this.cmoSelectedSection)
     {
         SectionDecoder current = (SectionDecoder)this.cmoSelectedSection.SelectedItem;
         current.Decode(false);
         this.txtMaxRings.Text = "" + current.Data.MaxRings;
         this.picSectionImage.Invalidate();
     }
 }
示例#2
0
        void UpdateCurrentSection()
        {
            if (this.cmoSelectedSection.SelectedIndex >= 0)
            {
                SectionDecoder current = (SectionDecoder)this.cmoSelectedSection.SelectedItem;

                try
                {
                    current.Data.MaxRings = UInt32.Parse(this.txtMaxRings.Text);
                }
                catch (FormatException ex)
                {
                    MessageBox.Show(this, "Insert non-negative integer value for field Max Rings", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        }
示例#3
0
        private void picSectionImage_Paint(object sender, PaintEventArgs e)
        {
            if (this.cmoSelectedSection.SelectedIndex < 0)
            {
                return;
            }

            float currentY = 0;

            SectionDecoder current = (SectionDecoder)(this.cmoSelectedSection.SelectedItem);

            Graphics g = e.Graphics;

            for (int y = 0; y < SectionDecoder.SECTION_HEIGHT; y++)
            {
                for (int x = 0; x < SectionDecoder.SECTION_HEIGHT; x++)
                {
                    uint val = current.Data.GetValueAt(x, y);
                    byte avs = current.Data.GetAvoidSearchAt(x, y);

                    if (avs == 1)
                    {
                        g.FillRectangle(Brushes.White, x * 20, y * 20, 20, 20);
                    }

                    if (val != SectionDecoder.SECTION_ITEM_UNKNOWN)
                    {
                        g.DrawString("" + current.Data.GetValueAt(x, y), MainForm.font, MainForm.dataFontBrushes[val],
                                     x * 20, y * 20);
                    }
                    else
                    {
                        g.DrawString("U", MainForm.font, MainForm.fontBrush, x * 20, y * 20);
                    }
                }
            }

            currentY += SectionDecoder.SECTION_HEIGHT * 20 + 10;

            g.DrawString("Source bitmap", MainForm.font, MainForm.fontBrush, 0, currentY);
            currentY += g.MeasureString("Source bitmap", MainForm.font).Height;

            g.DrawImage(current.SectionBitmap, 0, currentY);
            currentY += current.SectionBitmap.Height + 10;
        }
示例#4
0
        private void picSectionImage_MouseDown(object sender, MouseEventArgs e)
        {
            int x = e.X / 20;
            int y = e.Y / 20;

            SectionDecoder current = (SectionDecoder)this.cmoSelectedSection.SelectedItem;

            if (x < 0 || y < 0 || x >= SectionDecoder.SECTION_WIDTH || y >= SectionDecoder.SECTION_HEIGHT)
            {
                return;
            }

            if (current.Data.GetAvoidSearchAt(x, y) == 0)
            {
                current.Data.SetAvoidSearchAt(1, x, y);
            }
            else
            {
                current.Data.SetAvoidSearchAt(0, x, y);
            }

            this.picSectionImage.Invalidate();
        }