예제 #1
0
        private void panel9_DragDrop(object sender, DragEventArgs e)
        {
            System.Diagnostics.Debug.WriteLine("panel9 drag drop...");

            Vrsta      vrsta = model.vrste[selectedId - 1];
            StikerView sv    = new StikerView(vrsta);

            sv.Location = panel9.PointToClient(new Point(e.X - 37, e.Y));  // globalne koordinate u lokalne koordinate..

            sv.MouseDown += sv_MouseDown;
            sv.Controls["naziv"].MouseDown        += sv_MouseDown;
            sv.Controls["bojaEtiketa"].MouseDown  += sv_MouseDown;
            sv.Controls["slikaEtiketa"].MouseDown += sv_MouseDown;


            sv.MouseUp += sv_MouseUp;
            sv.Controls["naziv"].MouseUp        += sv_MouseUp;
            sv.Controls["bojaEtiketa"].MouseUp  += sv_MouseUp;
            sv.Controls["slikaEtiketa"].MouseUp += sv_MouseUp;

            /* sv.MouseMove += sv_MouseMove;
             * sv.Controls["naziv"].MouseMove += sv_MouseMove;
             * sv.Controls["bojaEtiketa"].MouseMove += sv_MouseMove;
             * sv.Controls["slikaEtiketa"].MouseMove += sv_MouseMove;*/

            vrsta.aktivnaEtiketa.x = sv.Location.X;
            vrsta.aktivnaEtiketa.y = sv.Location.Y;

            panel9.Controls.Add(sv);      // add na panel

            model.stikeriMapa.Add(vrsta); // snimanje u model
        }
예제 #2
0
        private void Main_Load(object sender, EventArgs e)
        {
            foreach (Vrsta v in model.stikeriMapa)
            {
                StikerView sv = new StikerView(v);
                sv.Location = new Point(v.aktivnaEtiketa.x, v.aktivnaEtiketa.y);

                sv.MouseDown += sv_MouseDown;
                sv.Controls["naziv"].MouseDown        += sv_MouseDown;
                sv.Controls["bojaEtiketa"].MouseDown  += sv_MouseDown;
                sv.Controls["slikaEtiketa"].MouseDown += sv_MouseDown;

                sv.MouseUp += sv_MouseUp;
                sv.Controls["naziv"].MouseUp        += sv_MouseUp;
                sv.Controls["bojaEtiketa"].MouseUp  += sv_MouseUp;
                sv.Controls["slikaEtiketa"].MouseUp += sv_MouseUp;

                /*sv.MouseMove += sv_MouseMove;
                 * sv.Controls["naziv"].MouseMove += sv_MouseMove;
                 * sv.Controls["bojaEtiketa"].MouseMove += sv_MouseMove;
                 * sv.Controls["slikaEtiketa"].MouseMove += sv_MouseMove;*/

                panel9.Controls.Add(sv);
            }
        }
예제 #3
0
        void sv_MouseMove(object sender, MouseEventArgs e)
        {
            Control c = (Control)sender;

            System.Diagnostics.Debug.WriteLine("GLOBALNE KOORDINATE KONTROLE: " + c.PointToScreen(new Point(e.X, e.Y)));
            System.Diagnostics.Debug.WriteLine("RODITELJ JE: " + c.Parent);
            //return;
            StikerView sv = new StikerView();

            if (c.Parent is AleksandarBosnjak.StikerView)
            {
                sv = (StikerView)c.Parent;
            }
            else if (c.Parent is System.Windows.Forms.Panel)
            {
                sv = (StikerView)sender;
            }

            aktivanStikerView = sv;
            if (e.Button == MouseButtons.Left)
            {
                if (selektovan == true)
                {
                    sv.Location = panel9.PointToClient(e.Location);
                    sv.vrsta.aktivnaEtiketa.x = sv.Location.X;
                    sv.vrsta.aktivnaEtiketa.y = sv.Location.Y;

                    Rectangle gloXY = sv.RectangleToScreen(sv.Bounds);

                    /*if (panel9.Controls["panel7"].Bounds.IntersectsWith(sv.Bounds))         // nad kantom je
                     * {
                     *  panel9.Controls["panel7"].BackColor = Color.LightGreen;
                     *  panel9.Controls["panel7"].Refresh();
                     *  nadKantom = true;
                     * }
                     * else
                     * {
                     *  panel9.Controls["panel7"].BackColor = Color.White;
                     *  panel9.Controls["panel7"].Refresh();
                     *  nadKantom = false;
                     * }*/

                    sv.ContextMenuStrip = stikerContextMenu;
                }
            }
        }
예제 #4
0
        private void panel9_DragEnter(object sender, DragEventArgs e)
        {
            System.Diagnostics.Debug.WriteLine("PANEL 9 DRAG ENTER!!");

            Type tip = new StikerView().GetType();

            dragEnterPanel9 = true;
            eDragDrop       = e;

            if (e.Data.GetType() == tip)
            {
                e.Effect = DragDropEffects.None;
            }
            else
            {
                e.Effect = DragDropEffects.Copy;
            }
        }
예제 #5
0
        void sv_MouseDown(object sender, MouseEventArgs e)
        {
            StikerView sv = new StikerView();
            Control    c  = (Control)sender;
            int        x;

            if (c.Parent is AleksandarBosnjak.StikerView)
            {
                sv = (StikerView)c.Parent;
            }
            else if (c.Parent is System.Windows.Forms.Panel)
            {
                sv = (StikerView)sender;
            }

            selektovan        = true;
            aktivanStikerView = sv;


            for (int i = 0; i < dataGridView1.Rows.Count; i++)
            {
                if (dataGridView1.Rows[i].Cells["Oznaka"].Value == aktivanStikerView.vrsta.oznaka)
                {
                    dataGridView1.ClearSelection();
                    dataGridView1.FirstDisplayedScrollingRowIndex = dataGridView1.Rows[i].Index;
                    dataGridView1.CurrentCell      = dataGridView1.Rows[i].Cells[0];
                    dataGridView1.Rows[i].Selected = true;
                    dataGridView1.Refresh();
                }
            }

            if (panel9.Controls["pictureBox1"] != null)
            {
                panel9.Controls.SetChildIndex(panel9.Controls["pictureBox1"], panel9.Controls.Count);
                panel9.Controls["pictureBox1"].Location = new Point(aktivanStikerView.Location.X - 8, aktivanStikerView.Location.Y - 10);
                panel9.Controls["pictureBox1"].Visible  = true;
            }
        }