Beispiel #1
0
        private void btnAddDisk_DragDrop(object sender, DragEventArgs e)
        {
            string[] files       = (string[])e.Data.GetData(DataFormats.FileDrop);
            int      currentPane = 1;
            int      numFiles    = files.Length;
            int      fileIndex   = 0;

            while (panels.ContainsKey(currentPane) && (fileIndex < numFiles))
            {
                string filename = files[fileIndex];
                if (!panels[currentPane].IsInUse)
                {
                    panels[currentPane].SetContent(filename);
                    fileIndex++;
                }
                currentPane++;
            }
            while ((fileIndex < numFiles) && (fileIndex < 10))
            {
                string    filename = files[fileIndex];
                DiskPanel newPanel = AddDisk();
                newPanel.SetContent(filename);
                fileIndex++;
            }
        }
Beispiel #2
0
        private void diskPanel1_Dragging(object sender, MouseEventArgs e)
        {
            DiskPanel dragControl = (DiskPanel)sender;

            dragControl.BringToFront();
            foreach (Label sep in seperators)
            {
                sep.Visible = IsOverlapped(dragControl, sep);
            }
        }
Beispiel #3
0
        private void diskPanel1_Dropping(object sender, MouseEventArgs e)
        {
            DiskPanel dragControl = (DiskPanel)sender;

            int found         = -1;
            int numSeperators = seperators.Count;

            for (int index = 0; (found == -1) && (index < numSeperators); index++)
            {
                if (IsOverlapped(dragControl, seperators[index]))
                {
                    found = index;
                }
            }
            if (found != -1)
            {
                int numPanel = ((dragControl.DragOrigin.X - RefPoint.X) / 156) + 1;
                if (found < numPanel)
                {
                    for (int i = numPanel; i > (found + 1); i--)
                    {
                        panels[i]          = panels[i - 1];
                        panels[i].Location = new Point(RefPoint.X + ((i - 1) * 156), RefPoint.Y);
                    }
                    panels[found + 1]    = dragControl;
                    dragControl.Location = new Point(RefPoint.X + (found * 156), RefPoint.Y);
                }
                else
                {
                    for (int i = numPanel; i < found; i++)
                    {
                        panels[i]          = panels[i + 1];
                        panels[i].Location = new Point(RefPoint.X + ((i - 1) * 156), RefPoint.Y);
                    }
                    panels[found]        = dragControl;
                    dragControl.Location = new Point(RefPoint.X + ((found - 1) * 156), RefPoint.Y);
                }
                seperators[found].Visible = false;
            }
            else
            {
                dragControl.Location = dragControl.DragOrigin;
            }
        }
Beispiel #4
0
        private DiskPanel AddDisk()
        {
            this.Size = new Size(this.Size.Width + 156, this.Size.Height);

            DiskPanel newPanel = (DiskPanel)diskPanel1.Clone();

            newPanel.Dragging += diskPanel1_Dragging;
            newPanel.Dropping += diskPanel1_Dropping;
            newPanel.Location  = new Point(RefPoint.X + (numViews * 156), RefPoint.Y);
            newPanel.Size      = diskPanel1.Size;
            newPanel.Anchor    = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                                                                       | System.Windows.Forms.AnchorStyles.Left)));
            btnAddDisk.Location  = new Point(btnAddDisk.Location.X + 156, btnAddDisk.Location.Y);
            btnAddFiles.Location = new Point(btnAddFiles.Location.X + 156, btnAddFiles.Location.Y);

            Label newSeperator = new Label();

            newSeperator.Location = new Point(lblSeperator.Location.X + ((numViews + 1) * 156), lblSeperator.Location.Y);
            newSeperator.Size     = lblSeperator.Size;
            newSeperator.Anchor   = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                                                                          | System.Windows.Forms.AnchorStyles.Left)));
            newSeperator.BackColor   = lblSeperator.BackColor;
            newSeperator.BorderStyle = BorderStyle.FixedSingle;
            newSeperator.Visible     = false;
            seperators.Add(newSeperator);

            splitContainer1.Panel1.Controls.Add(newPanel);
            splitContainer1.Panel1.Controls.Add(newSeperator);

            numViews++;
            if (numViews >= (Screen.PrimaryScreen.Bounds.Width / 156))
            {
                btnAddDisk.Visible = false;
                this.Size          = new Size(this.Size.Width - btnAddDisk.Size.Width, this.Size.Height);
            }
            panels.Add(numViews, newPanel);
            return(newPanel);
        }
Beispiel #5
0
        public object Clone()
        {
            DiskPanel retVal = new DiskPanel();

            retVal.mainLayout       = new System.Windows.Forms.TableLayoutPanel();
            retVal.lstFiles         = new System.Windows.Forms.ListView();
            retVal.hdrName          = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
            retVal.CaptionBarLayout = new System.Windows.Forms.TableLayoutPanel();
            retVal.lblDiskTitle     = new System.Windows.Forms.Label();
            retVal.btnClose         = new System.Windows.Forms.Button();
            retVal.lblFree          = new System.Windows.Forms.Label();
            retVal.mainLayout.SuspendLayout();
            retVal.CaptionBarLayout.SuspendLayout();
            retVal.SuspendLayout();
            //
            // mainLayout
            //
            retVal.mainLayout.ColumnCount = 1;
            retVal.mainLayout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
            retVal.mainLayout.Controls.Add(retVal.lstFiles, 0, 1);
            retVal.mainLayout.Controls.Add(retVal.CaptionBarLayout, 0, 0);
            retVal.mainLayout.Controls.Add(retVal.lblFree, 0, 2);
            retVal.mainLayout.Dock     = System.Windows.Forms.DockStyle.Fill;
            retVal.mainLayout.Location = new System.Drawing.Point(0, 0);
            retVal.mainLayout.Name     = "mainLayout";
            retVal.mainLayout.RowCount = 3;
            retVal.mainLayout.RowStyles.Add(new System.Windows.Forms.RowStyle());
            retVal.mainLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
            retVal.mainLayout.RowStyles.Add(new System.Windows.Forms.RowStyle());
            retVal.mainLayout.Size     = new System.Drawing.Size(153, 511);
            retVal.mainLayout.TabIndex = 0;
            //
            // lstFiles
            //
            retVal.lstFiles.Margin    = new System.Windows.Forms.Padding(0);
            retVal.lstFiles.AllowDrop = true;
            retVal.lstFiles.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
                retVal.hdrName
            });
            retVal.lstFiles.Dock        = System.Windows.Forms.DockStyle.Fill;
            retVal.lstFiles.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
            retVal.lstFiles.Location    = new System.Drawing.Point(3, 26);
            retVal.lstFiles.Name        = "lstFiles";
            retVal.lstFiles.Size        = new System.Drawing.Size(147, 467);
            retVal.lstFiles.TabIndex    = 0;
            retVal.lstFiles.UseCompatibleStateImageBehavior = false;
            retVal.lstFiles.View          = System.Windows.Forms.View.Details;
            retVal.lstFiles.ItemActivate += new System.EventHandler(retVal.lstFiles_ItemActivate);
            retVal.lstFiles.DragDrop     += new System.Windows.Forms.DragEventHandler(retVal.lstFiles_DragDrop);
            retVal.lstFiles.DragEnter    += new System.Windows.Forms.DragEventHandler(retVal.General_DragEnter);
            //
            // hdrName
            //
            retVal.hdrName.Text  = "Name";
            retVal.hdrName.Width = 132;
            //
            // CaptionBarLayout
            //
            retVal.CaptionBarLayout.AutoSize     = true;
            retVal.CaptionBarLayout.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
            retVal.CaptionBarLayout.ColumnCount  = 2;
            retVal.CaptionBarLayout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
            retVal.CaptionBarLayout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
            retVal.CaptionBarLayout.Controls.Add(retVal.lblDiskTitle, 0, 0);
            retVal.CaptionBarLayout.Controls.Add(retVal.btnClose, 1, 0);
            retVal.CaptionBarLayout.Location = new System.Drawing.Point(0, 0);
            retVal.CaptionBarLayout.Margin   = new System.Windows.Forms.Padding(0);
            retVal.CaptionBarLayout.Name     = "CaptionBarLayout";
            retVal.CaptionBarLayout.RowCount = 1;
            retVal.CaptionBarLayout.RowStyles.Add(new System.Windows.Forms.RowStyle());
            retVal.CaptionBarLayout.Size     = new System.Drawing.Size(153, 23);
            retVal.CaptionBarLayout.TabIndex = 9;
            //
            // lblDiskTitle
            //
            retVal.lblDiskTitle.BackColor  = System.Drawing.SystemColors.InactiveCaption;
            retVal.lblDiskTitle.Font       = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            retVal.lblDiskTitle.Location   = new System.Drawing.Point(0, 0);
            retVal.lblDiskTitle.Margin     = new System.Windows.Forms.Padding(0);
            retVal.lblDiskTitle.Name       = "lblDiskTitle";
            retVal.lblDiskTitle.Size       = new System.Drawing.Size(137, 23);
            retVal.lblDiskTitle.TabIndex   = 6;
            retVal.lblDiskTitle.TextAlign  = System.Drawing.ContentAlignment.MiddleLeft;
            retVal.lblDiskTitle.MouseDown += new System.Windows.Forms.MouseEventHandler(retVal.lblDiskName_MouseDown);
            retVal.lblDiskTitle.MouseMove += new System.Windows.Forms.MouseEventHandler(retVal.lblDiskName_MouseMove);
            retVal.lblDiskTitle.MouseUp   += new System.Windows.Forms.MouseEventHandler(retVal.lblDiskName_MouseUp);
            //
            // btnClose
            //
            retVal.btnClose.Location = new System.Drawing.Point(137, 0);
            retVal.btnClose.Margin   = new System.Windows.Forms.Padding(0);
            retVal.btnClose.Name     = "btnClose";
            retVal.btnClose.Size     = new System.Drawing.Size(16, 20);
            retVal.btnClose.TabIndex = 5;
            retVal.btnClose.Text     = "x";
            retVal.btnClose.UseVisualStyleBackColor = true;
            retVal.btnClose.Click += new System.EventHandler(retVal.btnClosePane_Click);
            //
            // lblFree
            //
            retVal.lblFree.BackColor = System.Drawing.SystemColors.ActiveCaption;
            retVal.lblFree.Location  = new System.Drawing.Point(3, 496);
            retVal.lblFree.Name      = "lblFree";
            retVal.lblFree.Size      = new System.Drawing.Size(136, 15);
            retVal.lblFree.TabIndex  = 4;
            retVal.lblFree.Text      = "label1";
            //
            // DiskPanel
            //
            retVal.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            retVal.AutoScaleMode       = System.Windows.Forms.AutoScaleMode.Font;
            retVal.Controls.Add(retVal.mainLayout);
            retVal.Name = "DiskPanel";
            retVal.Size = new System.Drawing.Size(153, 511);
            retVal.mainLayout.ResumeLayout(false);
            retVal.mainLayout.PerformLayout();
            retVal.CaptionBarLayout.ResumeLayout(false);
            retVal.ResumeLayout(false);

            return(retVal);
        }