Пример #1
0
        private void AddString_Click(object Sender, EventArgs e)
        {
            TextBoxDialog d = new TextBoxDialog("Add String", new String[] { "Name:", "Value:" });

            if (d.ShowDialog(this) == DialogResult.OK)
            {
                if ((d.TextBox[0].Text != "") && (!Resource.ContainsKey(d.TextBox[0].Text)))
                {
                    Resource.Add(d.TextBox[0].Text, d.TextBox[1].Text);
                    Initialize();
                }
            }
        }
Пример #2
0
        private void Rename_Click(object Sender, EventArgs e)
        {
            if (List.SelectedItems.Count != 1)
            {
                return;
            }
            String Key = List.SelectedItems[0].Text;

            if (Key == null)
            {
                return;
            }

            TextBoxDialog d = new TextBoxDialog("Rename Resource", new String[] { "Name:" });

            d.TextBox[0].Text = Key;
            if (d.ShowDialog(this) == DialogResult.OK)
            {
                object value = Resource[Key];
                Resource.Remove(Key);
                Resource.Add(d.TextBox[0].Text, value);
                Initialize();
            }
        }
Пример #3
0
        private void List_ItemActivate(object Sender, EventArgs e)
        {
            if (List.SelectedItems.Count != 1)
            {
                return;
            }
            String Key = List.SelectedItems[0].Text;

            if (Key == null)
            {
                return;
            }

            object Value = Resource[Key];

            if (Value.GetType() == typeof(Icon))
            {
                Icon       i = (Icon)Value;
                BitmapForm b = new BitmapForm(Text + " [" + Key + "]", i.ToBitmap());
                b.MdiParent = this.MdiParent;
                b.Show();
                return;
            }

            if (Value.GetType() == typeof(Bitmap))
            {
                BitmapForm b = new BitmapForm(Text + " [" + Key + "]", (Bitmap)Value);
                b.MdiParent = this.MdiParent;
                b.Show();
                return;
            }

            if (Value.GetType() == typeof(String))
            {
                TextBoxDialog d = new TextBoxDialog("Edit String", new String[] { "Name:", "Value:" });
                d.TextBox[0].Text = Key;
                d.TextBox[1].Text = (String)Value;
                if (d.ShowDialog(this) == DialogResult.OK)
                {
                    if (d.TextBox[0].Text != "")
                    {
                        Resource.Remove(Key);
                        Resource.Add(d.TextBox[0].Text, d.TextBox[1].Text);
                        Initialize();
                    }
                }
                return;
            }

            if (Value.GetType() == typeof(Cursor))
            {
                Cursor   c = (Cursor)Value;
                Bitmap   a = new Bitmap(c.Size.Width, c.Size.Height);
                Graphics g = Graphics.FromImage(a);
                g.FillRectangle(new SolidBrush(Color.DarkCyan), 0, 0, a.Width, a.Height);
                c.Draw(g, new Rectangle(0, 0, a.Width, a.Height));
                BitmapForm b = new BitmapForm(Text + " [" + Key + "]", a);
                b.MdiParent = this.MdiParent;
                b.Show();
                return;
            }
        }