コード例 #1
0
        private void NewItem_Click(object sender, EventArgs e)
        {
            BitmapForma forma = new BitmapForma(func);

            forma.MdiParent = this;
            forma.Show();
            forma.Name = MdiChildren.Length + "New";
            for (int i = 0; i < WindowsItem.DropDownItems.Count; i++)
            {
                (WindowsItem.DropDownItems[i] as ToolStripMenuItem).Checked = false;
            }

            WindowsItem.DropDownItems.Add(MdiChildren.Length + " Новый").Name = MdiChildren.Length + "New";
            (WindowsItem.DropDownItems[WindowsItem.DropDownItems.Count - 1] as ToolStripMenuItem).Checked = true;
            m_filenames.Add(forma.Name, "New");
            m_ComboBox.SelectedItem = 0;
        }
コード例 #2
0
        private void Paint_Load(object sender, EventArgs e)
        {
            m_filenames = new StringDictionary();
            arraylines  = new object[] { 0, 1, 2, 3, 4 };

            m_pictureboxup      = new PictureBox();
            m_pictureboxup.Size = new System.Drawing.Size(20, 020);
            //      m_pictureboxup.Click += OnClickPictureBoxUp;

            m_pictureboxdown        = new PictureBox();
            m_pictureboxdown.Click += OnClickPictureBoxDown;
            m_pictureboxdown.Size   = new System.Drawing.Size(20, 20);

            m_ComboBox.Size                  = new System.Drawing.Size(55, 25);
            m_ComboBox.DrawMode              = DrawMode.OwnerDrawFixed;
            m_ComboBox.DropDownStyle         = ComboBoxStyle.DropDownList;
            m_ComboBox.FormattingEnabled     = true;
            m_ComboBox.DrawItem             += OnDrawItem;
            m_ComboBox.SelectedIndexChanged += OnSelectChange;
            m_ComboBox.Items.AddRange(arraylines);
            m_ComboBox.SelectedIndex = 0;

            ToolStripControlHost combo = new ToolStripControlHost(m_ComboBox);


            NumericUpDown m_numeric = new NumericUpDown();

            m_numeric.ValueChanged += OnValueChanged;
            m_numeric.Minimum       = 1;
            ToolStripControlHost m_toolhost = new ToolStripControlHost(m_numeric);


            BitmapForma m_bitmap = new BitmapForma(new Paint.MyDelegate(func));

            m_bitmap.MdiParent = this;
            m_bitmap.Show();
            m_bitmap.Name = "1New";
            WindowsItem.DropDownItems.Add("1 Новый").Name = "1New";
            (WindowsItem.DropDownItems[0] as ToolStripMenuItem).Checked = true;
            m_filenames.Add(m_bitmap.Name, "New");
            WindowsItem.DropDownItemClicked += WinDropDownItemClick;

            var imageup   = new Bitmap(m_pictureboxup.Width, m_pictureboxup.Height);
            var imagedown = new Bitmap(m_pictureboxdown.Width, m_pictureboxdown.Height);

            m_pictureboxup.Image   = imageup;
            m_pictureboxdown.Image = imagedown;
            using (var graphics = Graphics.FromImage(imageup)){
                graphics.Clear(Color.Black);
            }
            using (var graphics = Graphics.FromImage(imagedown))
            {
                graphics.Clear(Color.White);
            }

            ToolsClass.MainPict    = Color.Black;
            ToolsClass.AnotherPict = Color.White;
            ToolStripControlHost pictureup   = new ToolStripControlHost(m_pictureboxup);
            ToolStripControlHost picturedown = new ToolStripControlHost(m_pictureboxdown);

            tool             = new PencilTool(m_bitmap.Controls[0] as PictureBox);
            m_bitmap.tool    = tool;
            m_timer          = new Timer();
            m_timer.Interval = 1000;
            m_timer.Tick    += OnTimer;

            LayoutMdi(MdiLayout.Cascade);
        }