コード例 #1
0
        private void Export_Tiff(object sender, EventArgs e)
        {
            if (listBox2.SelectedIndex == -1)
            {
                return;
            }

            int i = int.Parse(listBox2.Items[listBox2.SelectedIndex].ToString());

            if (!SecondGump.IsValidIndex(i))
            {
                return;
            }

            string path     = Options.OutputPath;
            string fileName = Path.Combine(path, $"Gump(Sec) 0x{i:X}.tiff");

            SecondGump.GetGump(i).Save(fileName, ImageFormat.Tiff);
            MessageBox.Show(
                $"Gump saved to {fileName}",
                "Saved",
                MessageBoxButtons.OK,
                MessageBoxIcon.Information,
                MessageBoxDefaultButton.Button1);
        }
コード例 #2
0
        private void Listbox1_DrawItem(object sender, DrawItemEventArgs e)
        {
            ListBox listBox = (ListBox)sender;

            if (e.Index < 0)
            {
                return;
            }

            Brush fontBrush = Brushes.Gray;

            int i = (int)listBox.Items[e.Index];

            if (listBox.SelectedIndex == e.Index)
            {
                e.Graphics.FillRectangle(Brushes.LightSteelBlue, e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height);
            }

            bool valid = (int)listBox.Tag == 1 ? Gumps.IsValidIndex(i) : SecondGump.IsValidIndex(i);

            if (valid)
            {
                Bitmap bmp = (int)listBox.Tag == 1 ? Gumps.GetGump(i) : SecondGump.GetGump(i);

                if (bmp != null)
                {
                    if (listBox2.Items.Count > 0)
                    {
                        if (!Compare(i))
                        {
                            fontBrush = Brushes.Blue;
                        }
                    }
                    int width  = bmp.Width > 80 ? 80 : bmp.Width;
                    int height = bmp.Height > 54 ? 54 : bmp.Height;

                    e.Graphics.DrawImage(bmp, new Rectangle(e.Bounds.X + 3, e.Bounds.Y + 3, width, height));
                }
                else
                {
                    fontBrush = Brushes.Red;
                }
            }
            else
            {
                fontBrush = Brushes.Red;
            }

            e.Graphics.DrawString($"0x{i:X}", Font, fontBrush,
                                  new PointF(85,
                                             e.Bounds.Y + ((e.Bounds.Height / 2) -
                                                           (e.Graphics.MeasureString($"0x{i:X}", Font).Height / 2))));
        }
コード例 #3
0
        private void OnClickCopy(object sender, EventArgs e)
        {
            if (listBox2.SelectedIndex == -1)
            {
                return;
            }

            int i = (int)listBox2.Items[listBox2.SelectedIndex];

            if (!SecondGump.IsValidIndex(i))
            {
                return;
            }

            Bitmap copy = new Bitmap(SecondGump.GetGump(i));

            Gumps.ReplaceGump(i, copy);
            Options.ChangedUltimaClass["Gumps"] = true;
            ControlEvents.FireGumpChangeEvent(this, i);
            _mCompare[i] = true;
            listBox1.BeginUpdate();
            bool done = false;

            for (int id = 0; id < 0x10000; id++)
            {
                if (id > i)
                {
                    listBox1.Items.Insert(id, i);
                    done = true;
                    break;
                }
                if (id == i)
                {
                    done = true;
                    break;
                }
            }
            if (!done)
            {
                listBox1.Items.Add(i);
            }

            listBox1.EndUpdate();
            listBox1.Invalidate();
            listBox2.Invalidate();
            Listbox_SelectedChange(listBox1, null);
        }
コード例 #4
0
        private void Listbox_SelectedChange(object sender, EventArgs e)
        {
            ListBox listBox = (ListBox)sender;

            if (listBox.SelectedIndex == -1)
            {
                return;
            }

            int  i = (int)listBox.Items[listBox.SelectedIndex];
            bool valid;

            if ((int)listBox.Tag == 1)
            {
                valid = Gumps.IsValidIndex(i);
                if (listBox2.Items.Count > 0)
                {
                    listBox2.SelectedIndex = listBox2.Items.IndexOf(i);
                }
            }
            else
            {
                valid = SecondGump.IsValidIndex(i);
                listBox1.SelectedIndex = listBox1.Items.IndexOf(i);
            }
            if (valid)
            {
                Bitmap bmp = (int)listBox.Tag == 1 ? Gumps.GetGump(i) : SecondGump.GetGump(i);

                if (bmp != null)
                {
                    if ((int)listBox.Tag == 1)
                    {
                        pictureBox1.BackgroundImage = bmp;
                    }
                    else
                    {
                        pictureBox2.BackgroundImage = bmp;
                    }
                }
                else
                {
                    if ((int)listBox.Tag == 1)
                    {
                        pictureBox1.BackgroundImage = null;
                    }
                    else
                    {
                        pictureBox2.BackgroundImage = null;
                    }
                }
            }
            else
            {
                if ((int)listBox.Tag == 1)
                {
                    pictureBox1.BackgroundImage = null;
                }
                else
                {
                    pictureBox2.BackgroundImage = null;
                }
            }
            listBox.Invalidate();
        }