private void AddNewImage(ref List <RadioButtonWithInfo> buttons, Bitmap bitmap, uint address, EventHandler click_event) { RadioButtonWithInfo texButton = new RadioButtonWithInfo(); texButton.Click += click_event; texButton.Address = address; texButton.BitmapImage = bitmap; texButton.Width = 32; texButton.Height = 32; texButton.BackgroundImage = new Bitmap(bitmap, 28, 28); texButton.BackgroundImageLayout = ImageLayout.Center; texButton.AutoSize = false; texButton.Appearance = Appearance.Button; texButton.FlatStyle = FlatStyle.Flat; texButton.FlatAppearance.BorderSize = 1; texButton.FlatAppearance.BorderColor = Color.Black; byte segment = (byte)(address >> 24); if (!ROM.Instance.isSegmentMIO0(segment)) { texButton.FlatAppearance.MouseOverBackColor = Color.Goldenrod; texButton.FlatAppearance.CheckedBackColor = Color.Gold; texButton.FlatAppearance.MouseDownBackColor = Color.DarkGoldenrod; } else { texButton.FlatAppearance.MouseOverBackColor = Color.Firebrick; texButton.FlatAppearance.CheckedBackColor = Color.DarkRed; texButton.FlatAppearance.MouseDownBackColor = Color.Maroon; } texButton.BackColor = Color.Transparent; buttons.Add(texButton); }
private void ot_RadioButtonWithInfo_Click(object sender, EventArgs e) { ROM rom = ROM.Instance; RadioButtonWithInfo button = (RadioButtonWithInfo)sender; string[] tags = (string[])button.BitmapImage.Tag; ot_bitmap_preview.BackgroundImage = button.BitmapImage; //ot_info_SegAddress.Text = "Seg Addr: " + button.Address.ToString("X8"); //ot_info_RomAddress.Text = "ROM Address: " + (rom.decodeSegmentAddress(button.Address)).ToString("X"); foreach (string tag in tags) { if (tag.StartsWith("Width:")) { ot_info_width.Text = tag; } else if (tag.StartsWith("Height:")) { ot_info_height.Text = tag; } else if (tag.StartsWith("Format:")) { ot_info_Format.Text = tag; } else if (tag.StartsWith("Seg Addr:")) { ot_info_SegAddress.Text = tag; } else if (tag.StartsWith("ROM Address:")) { ot_info_RomAddress.Text = tag; } else if (tag.StartsWith("Name:")) { ot_name.Text = tag; } } }
private void RadioButtonWithInfo_Click(object sender, EventArgs e) { ROM rom = ROM.Instance; RadioButtonWithInfo button = (RadioButtonWithInfo)sender; string[] tags = (string[])button.BitmapImage.Tag; info_bitmapImage.BackgroundImage = button.BitmapImage; info_SegmentAddress.Text = "Seg Addr: " + button.Address.ToString("X8"); byte segment = (byte)(button.Address >> 24); if (!ROM.Instance.isSegmentMIO0(segment)) { info_Address.Text = "ROM Address: " + (rom.decodeSegmentAddress(button.Address)).ToString("X"); } else { info_Address.Text = "ROM Address: N/A"; } foreach (string tag in tags) { if (tag.StartsWith("Width:")) { info_Width.Text = tag; } else if (tag.StartsWith("Height:")) { info_Height.Text = tag; } else if (tag.StartsWith("Format:")) { info_Format.Text = tag; } } }