コード例 #1
0
ファイル: Form1.cs プロジェクト: Cris-Bwls/WinFormsProject
        //--------------------------------------------------------
        //	imagePalletteToolStripMenuItem_Click
        //		On Click changes visibility of ImagePalette window
        //		If it doesnt exist it creates it
        //--------------------------------------------------------
        private void imagePalletteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (dataGroupForm.IsDisposed)
            {
                dataGroupForm = new DataGroupForm(true);
            }

            dataGroupForm.Visible = !dataGroupForm.Visible;
        }
コード例 #2
0
        //--------------------------------------------------------
        //	UngroupImages
        //		Moves Images back to Ungrouped
        //--------------------------------------------------------
        private void UngroupImages()
        {
            DataGroupForm form = (DataGroupForm)m_parentPanel.FindForm();

            foreach (PictureBox picture in m_dataList)
            {
                picture.Parent = form.GetUnGroupedPanel();
                form.unGroupedList.Add(picture);
            }
            form.ResizeUngrouped();
        }
コード例 #3
0
        //--------------------------------------------------------
        //	DataPanel_DragDrop
        //		On Drop moves picture box from origin to destination
        //		if able
        //--------------------------------------------------------
        private void DataPanel_DragDrop(object sender, DragEventArgs e)
        {
            // Check that the sender is a picturebox
            PictureBox temp = e.Data.GetData(typeof(PictureBox)) as PictureBox;

            if (temp == null)
            {
                e.Effect = DragDropEffects.None;
                return;
            }

            // Check that it came from DataGroupForm
            DataGroupForm f = temp.FindForm() as DataGroupForm;

            if (f == null)
            {
                e.Effect = DragDropEffects.None;
                return;
            }

            // Check if PictureBox is in Ungrouped List
            if (f.unGroupedList.Contains(temp))
            {
                f.unGroupedList.Remove(temp);
                f.ResizeUngrouped();

                temp.Parent = m_dataPanel;

                this.m_dataList.Add(temp);
                this.ResizeData();

                return;
            }

            // Check if PictureBox is in a Group
            foreach (Group g in f.groupList)
            {
                if (g.m_dataList.Contains(temp))
                {
                    g.m_dataList.Remove(temp);
                    g.ResizeData();

                    temp.Parent = m_dataPanel;

                    this.m_dataList.Add(temp);
                    this.ResizeData();

                    return;
                }
            }
        }