コード例 #1
0
ファイル: MainForm.cs プロジェクト: eckhard45/flow
// PictBoxes im Panel2: gerufen von setNodeData() und picturebox_MouseDown()
// PictBoxes mit Tag == "neu" sind nur Platzhalter (ohne Image)
        private pictBox machNeuePB(string Pfad, string Titel = "neu gemacht", bool mitBild = true)
        {
            picbox2       = new pictBox(Pfad, Titel);
            picbox2.Image = Image.FromFile("Leerbild.jpg");
            try {
                if (mitBild)
                {
                    picbox2.Image = Image.FromFile(Pfad);
                }
            } catch (IOException e) {
                picbox2.Image = null;
            }
            picbox2.Datei       = Pfad;
            picbox2.ContextMenu = this.ContextMenu;
            picbox2.Size        = new System.Drawing.Size(80, 100);
            picbox2.SizeMode    = PictureBoxSizeMode.StretchImage;
            this.flowLayoutPanel2.Controls.Add(picbox2);
            picbox2.AllowDrop = true;
            picbox2.MouseUp  += new MouseEventHandler(picbox2_MouseClickUp);
            //picbox2.MouseDown += new MouseEventHandler(pictBox2_MouseDown);
            //picbox2.MouseHover += new EventHandler(pictBox2_Hover);
            picbox2.DragEnter += new DragEventHandler(pictureBox3_DragEnter);
            picbox2.DragDrop  += new System.Windows.Forms.DragEventHandler(pictureBox2_DragDrop);
            return(picbox2);
        }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: eckhard45/flow
        // Handler für picBoxes in Panel2
        private void pictBox2_MouseDown(object sender, MouseEventArgs e)
        {
            pictBox pb = (pictBox)sender;

            Debug.WriteLine("down pb2: " + pb.Datei);
            picbox_Click(pb, flowLayoutPanel2);
            alteLoc = pb.Location;
            if (e.Button == MouseButtons.Left)  // mit linker Taste schieben, rechter Contextmenu
            {
                movingPB = pb;
                DoDragDrop(pb.Datei, DragDropEffects.Copy);
                //ab hier springt Programm zu Enter und Drop Handlern und kommt zurück;
                if (wasDropped)                 // neue picBox nur, wenn auf neue gezogen wird
                {
                    picbox2          = machNeuePB("", "picbox2_neu", false);
                    picbox2.Name     = "picbox2_neu";   // + dist.ToString();
                    picbox2.Datei    = pb.Datei;
                    picbox2.Location = neueLoc;
                    this.flowLayoutPanel2.Controls.Add(picbox2);
                    neueLoc = newLocation(neueLoc);
                    Program.dbg(pb.Name);
                    wasDropped = false;
                }
            }
        }
コード例 #3
0
        //  private pictBox picbox3;	// die pictBox'en in flowpanel2 zum schieben


        // Handler für picBoxes in Panel2
        private void pictBox2_MouseDown(object sender, MouseEventArgs e)
        {
            pictBox pb = (pictBox)sender;

            Debug.WriteLine("down pb2: " + pb.Datei);
            if (e.Button == MouseButtons.Left)
            {
                pb.Location = new Point(pb.Left + 80, pb.Top + 100);
            }
            if (e.Button == MouseButtons.Right)
            {
                if ((pb.Left - 80) > 0 && (pb.Top - 100) > 0)
                {
                    pb.Location = new Point(pb.Left - 80, pb.Top - 100);
                }
            }

            /***********
             * if (img == null) return;
             * if (wasDropped) {
             * dist +=5;
             * picbox3 = new pictBox(pb.Tag.ToString(), "picbox2_" + dist.ToString());
             * picbox3.Name = "picbox2_" + dist.ToString();
             * picbox3.Size = new System.Drawing.Size(80, 100);
             * picbox3.SizeMode = PictureBoxSizeMode.StretchImage;
             * picbox3.ContextMenu = this.ContextMenu;
             * picbox3.Click += new EventHandler(picbox2_MouseClickUp);
             * this.picbox3.ContextMenuStrip = this.contextMenuStrip1;
             * //pb.DragEnter += new DragEventHandler(pictureBox3_DragEnter);
             * //pb.DragDrop += new DragEventHandler(pictureBox3_DragDrop);
             *************/
        }
コード例 #4
0
ファイル: MainForm.cs プロジェクト: eckhard45/flow
 private void panel_Click(object sender, MouseEventArgs e)
 {
     Program.dbg(sender.ToString());
     neueLoc          = new Point(e.X, e.Y);
     picbox2          = machNeuePB("", "picbox2_neu", false);
     picbox2.Name     = "picbox2_neu"; // + dist.ToString();
     picbox2.Location = neueLoc;
     this.flowLayoutPanel2.Controls.Add(picbox2);
     flowLayoutPanel2.MouseClick -= new MouseEventHandler(panel_Click);
 }
コード例 #5
0
ファイル: MainForm.cs プロジェクト: eckhard45/flow
        void pictureBox3_DragEnter(object sender, DragEventArgs e)
        {
            pictBox pb = (pictBox)sender;

            Program.dbg(pb.Name);
            pb.MouseDown -= new MouseEventHandler(pictBox2_MouseDown);
            //if (e.Data.GetDataPresent(pb.DataFormat)){}
            e.Data.GetDataPresent(DataFormats.StringFormat);
            e.Effect = DragDropEffects.Copy;
            Program.dbg("Enter2: " + e.X + "," + e.Y + "effect: " + e.Effect.ToString());
        }
コード例 #6
0
        void pictureBox3_DragDrop(object sender, DragEventArgs e)
        {
            pictBox pb = (pictBox)sender;

            Debug.WriteLine("Drop: " + pb.Name);
            wasDropped = true;
            pb.Image   = img;
            Program.dbg(pb.Image.ToString());
            pb.Datei = (string)e.Data.GetData(DataFormats.StringFormat);
            Program.dbg(pb.Datei.ToString());
        }
コード例 #7
0
ファイル: MainForm.cs プロジェクト: eckhard45/flow
        void pictureBox2_DragEnter(object sender, DragEventArgs e)
        {
            pictBox pb = (pictBox)sender;

            Debug.WriteLine("Enter: " + pb.Name);
//	if (e.Data.GetDataPresent(pb.DataFormat)){
            e.Data.GetDataPresent(DataFormats.StringFormat);
            e.Effect = DragDropEffects.Copy;
            Debug.WriteLine("Enter: " + e.X + "," + e.Y);
//	} else {
//        Debug.WriteLine("EnterElse: " + e.X +"," + e.Y);
//	}
        }
コード例 #8
0
        void pictureBox3_DragEnter(object sender, DragEventArgs e)
        {
            pictBox pb = (pictBox)sender;

            Debug.WriteLine("Enter: " + pb.Name);
            if (e.Data.GetDataPresent(pb.DataFormat))
            {
                e.Data.GetDataPresent(DataFormats.StringFormat);
                e.Effect = DragDropEffects.Copy;
                Program.dbg("DragEnter");
            }
            Debug.WriteLine("ccEnterX2: " + e.X + "," + e.Y);
        }
コード例 #9
0
ファイル: MainForm.cs プロジェクト: eckhard45/flow
        void pictureBox2_DragDrop(object sender, DragEventArgs e)
        {
            pictBox pb = (pictBox)sender;

            Debug.WriteLine("Drop: " + pb.Name);
            wasDropped = true;
            pb.Datei   = (string)e.Data.GetData(DataFormats.StringFormat);
            Program.dbg("neuL: " + neueLoc.ToString() + "\t" + pb.Datei);
            neueLoc  = newLocation(neueLoc);
            pb.Image = Image.FromFile(pb.Datei);
            listBox1.Items.Add(pb.Datei);
            picBsChanged = true;
            Program.dbg(pb.Datei);
            return;
        }
コード例 #10
0
ファイル: MainForm.cs プロジェクト: eckhard45/flow
        private void schieben_Click(object sender, EventArgs e)
        {
            Program.dbg(sender.ToString());
            Panel flowP1   = this.flowLayoutPanel2;
            int   pbtabidx = 0;
            Point freieLoc = new Point(0, 0);

            foreach (pictBox ctrl in flowP1.Controls)
            {
                if (ctrl.Focused)
                {
                    pbtabidx     = ctrl.TabIndex;
                    picbox2      = machNeuePB("", "picbox2_neu", false);
                    picbox2.Name = "Leerbild";
                    freieLoc     = ctrl.Location;
//			neueLoc = newLocation(neueLoc);
                    picbox2.Location = neueLoc;
                    flowP1.Controls.Add(picbox2);
                    break;
                }
            }
            Debug.WriteLine("schieben_Click: " + "\tAnz.: " + flowP1.Controls.Count);
            Point loc1 = flowP1.Controls[flowP1.Controls.Count - 2].Location;

            for (int i = pbtabidx; i < flowP1.Controls.Count - 1; i++)
            {
                Debug.WriteLine("name: " + flowP1.Controls[i].GetType().ToString() + "\t" + flowP1.Controls[i].TabIndex);
                if (flowP1.Controls[i].GetType() == typeof(pictBox))
                {
                    flowP1.Controls[i].Location = flowP1.Controls[i + 1].Location;
                    //System.Threading.Thread.Sleep(1000);
                }
            }
            picbox2          = machNeuePB("", "picbox2_neu", false);
            picbox2.Name     = "Leerbild";
            picbox2.Location = freieLoc;
            this.flowLayoutPanel2.Controls.Add(picbox2);
            tbPfad.Text   = "";
            tbFDescr.Text = "";
            tbFName.Text  = "";
            tbFTitel.Text = "";
            picBsChanged  = true;
        }
コード例 #11
0
ファイル: MainForm.cs プロジェクト: eckhard45/flow
        private void picbox2_MouseClickUp(System.Object sender, EventArgs e)
        {
            pictBox pb = (pictBox)sender;

            Debug.WriteLine("picbox2_MouseClickUp: " + pb.Titel + "\t" + pb.TabIndex.ToString());
            picbox_Click(pb, flowLayoutPanel2);
            if (pb.Datei.Length > 25)
            {
                this.tbPfad.Text = "..." + pb.Datei.Substring(pb.Datei.Length - 25);
            }
            else
            {
                this.tbPfad.Text = pb.Datei;
            }
            this.tbFTitel.Text = pb.Titel;
            this.tbFName.Text  = pb.Name;
            this.tbFDescr.Text = pb.Descr;
            pb.MouseDown      += new MouseEventHandler(pictBox2_MouseDown);
        }
コード例 #12
0
ファイル: MainForm.cs プロジェクト: eckhard45/flow
        private void btFirst_Click(object sender, System.EventArgs e)
        {
            //Program.dbg(((Button)sender).Name);
            pictBox  lastpb    = new pictBox("", "");
            XElement firstelem = xTree.Descendants("etappe").First();

            strID   = firstelem.Element("ID").Value;
            firstID = strID;
            Int16 savStrID = Int16.Parse(strID);

            setNodeData(strID);
            if (strID == "")
            {
                hScrollBar1.Value = ++savStrID;
            }
            else
            {
                hScrollBar1.Value = Int16.Parse(strID);
            }
        }
コード例 #13
0
ファイル: MainForm.cs プロジェクト: eckhard45/flow
// Handler für PictureBoxes in Panel1
        private void picturebox_MouseDown(System.Object sender, MouseEventArgs e)
        {
            PictureBox pb = (PictureBox)sender;

            Debug.WriteLine("down: " + pb.Tag);
            img = pb.Image;
            if (img == null)
            {
                return;
            }
            DoDragDrop(pb.Tag, DragDropEffects.Copy);
            if (wasDropped)
            {
                picbox2          = machNeuePB(pb.Tag.ToString(), "picbox2_neu", false);
                picbox2.Name     = "picbox2_" + (nr * 10).ToString();
                picbox2.Location = neueLoc;
                this.flowLayoutPanel2.Controls.Add(picbox2);
                nr++;
                wasDropped = false;
            }
        }
コード例 #14
0
ファイル: MainForm.cs プロジェクト: eckhard45/flow
        private void btLast_Click(object sender, System.EventArgs e)
        {
            Program.dbg(((Button)sender).Name);
            pictBox lastpb = new pictBox("", "");

            sortEtappen();
            XElement lastelem = xTree.Descendants("etappe").Last();

            strID  = lastelem.Element("ID").Value;
            lastID = strID;
            Int16 savStrID = Int16.Parse(strID);

            setNodeData(strID); // setzt strID über letzte ID hinaus auf leer
            if (strID == "")
            {
                hScrollBar1.Value = --savStrID;
            }
            else
            {
                hScrollBar1.Value = Int16.Parse(strID);
            }
        }
コード例 #15
0
ファイル: MainForm.cs プロジェクト: eckhard45/flow
 private void picbox_Click(pictBox pb, Panel fp)
 {
     Debug.WriteLine("selected: " + pb.Datei);
     foreach (Control ctrl in fp.Controls)
     {
         if (ctrl.GetType() == typeof(pictBox))
         {
             ((pictBox)ctrl).BorderStyle = BorderStyle.None;
             ((pictBox)ctrl).Padding     = new Padding(0);
             ((pictBox)ctrl).BackColor   = Color.Transparent;
             ((pictBox)ctrl).MouseDown  -= new MouseEventHandler(pictBox2_MouseDown);
         }
     }
     pb.Select();
     pb.BorderStyle     = BorderStyle.Fixed3D;
     pb.BackColor       = System.Drawing.Color.Blue;
     pb.Padding         = new Padding(4);
     actPicBox          = pb;
     this.tbPfad.Text   = actPicBox.Datei;
     this.tbFDescr.Text = actPicBox.Descr;
     this.tbFTitel.Text = actPicBox.Titel;
     this.tbFName.Text  = actPicBox.Name;
     Program.dbg(pb.Datei);
 }
コード例 #16
0
ファイル: MainForm.cs プロジェクト: eckhard45/flow
        private int setNodeData(string xthisID)
        {
            int rWert = 0;

            Debug.Print("vor getNextID: " + strID);
            keineEingaben();                // eventhandler entfernen
            strID = getNextID(xthisID, up); // setzt itemsID Liste und thisID
            Debug.Print("nach getNextID: " + strID);
            alleloeschen_Click(null, null);
            if (strID == "")
            {
                this.toolStripStatusLabel1.Text = "kein <row>-Satz gefunden";
                tbID.Text    = strID;
                tbTitel.Text = "";
                tbKarte.Text = "";
                tbZeit.Text  = "";
                tbDescr.Text = "";
                MessageBox.Show("kein weiterer XML-Satz vorhanden!\n" +
                                "Neue Etappen mit Menü erstellen!",
                                "Ende XML", MessageBoxButtons.OK);
                alleEingaben();
                geaendert = false;
                return(rWert);
            }
            foreach (XElement item in itemsID.Elements())
            {
                //Program.dbg(item.ToString());
                switch (item.Name.ToString())
                {
                case "Titel":
                    tbTitel.Text = item.Value;
                    break;

                case "IDKarte":
                    tbKarte.Text = item.Value;
                    break;

                case "Descr":
                    tbDescr.Text = item.Value;
                    break;

                case "Zeit":
                    tbZeit.Text = item.Value;
                    break;

                case "ID":
                    tbID.Text         = item.Value;
                    hScrollBar1.Value = int.Parse(item.Value);
                    break;

                case "fotos":
                    Int32 zaehler = 0;
                    neueLoc = new Point(3, 3);
                    foreach (XElement foto in item.Elements("foto"))
                    {
                        string pfad = Path.Combine(arbeitsverzeichnis, foto.Element("Pfad").Value.Trim());
                        picbox2          = machNeuePB(pfad, foto.Element("Titel").Value);
                        picbox2.Descr    = foto.Element("Desc").Value;
                        picbox2.Location = neueLoc;
                        if (foto.Element("Name") != null)
                        {
                            if (foto.Element("Name").Value == "Leerbild")
                            {
                                continue;
                            }
                            picbox2.Name = foto.Element("Name").Value;
                        }

                        listBox1.Items.Add(picbox2.Datei);
                        neueLoc = newLocation(neueLoc);
                        zaehler++;
                    }

                    /*******
                     * foreach (Control ctrl in flowLayoutPanel2.Controls) {
                     *      Program.dbg(ctrl.Name);
                     * }
                     ******/
                    break;
                }
            }
            geaendert  = false;
            wasDropped = true;                  // damit neue Bilder hochgeschoben werden können
            alleEingaben();
            return(rWert);
        }