Пример #1
0
        void WfIniUcPanel(ady_tb pAdyModel)
        {
            UcTransparentPanel panel = new UcTransparentPanel();

            panel.Name        = pAdyModel.ady03.ToString(); //以adg03 程式代號做識別
            panel.BorderStyle = BorderStyle.None;

            panel.Location    = new Point(pAdyModel.ady04, pAdyModel.ady05);
            panel.Size        = new Size(pAdyModel.ady06, pAdyModel.ady07);
            panel.MouseLeave += panel_MouseLeave;
            panel.MouseEnter += panel_MouseEnter;
            panel.MouseClick += panel_MouseClick;
            panel.Cursor      = Cursors.Hand;
            panel.AllowResize = false;

            //Label label = new Label();
            //label.Text = panel.Name;
            //label.BackColor = Color.White;
            //label.AutoSize = true;

            //panel.Controls.Add(label);
            pnlFlow.Controls.Add(panel);
            panel.BringToFront();

            panel.Refresh();
        }
Пример #2
0
        void WfIniUcPanel(vw_admi611s pDetailModel)
        {
            UcTransparentPanel panel = new UcTransparentPanel();

            panel.Name        = pDetailModel.ady02.ToString(); //以序號做識別
            panel.BorderStyle = BorderStyle.Fixed3D;
            panel.BorderColor = Color.White;
            panel.Location    = new Point(pDetailModel.ady04, pDetailModel.ady05);
            panel.Size        = new Size(pDetailModel.ady06, pDetailModel.ady07);

            panel.MouseDown        += panel_MouseDown;
            panel.MouseMove        += panel_MouseMove;
            panel.MouseUp          += panel_MouseUp;
            panel.MouseDoubleClick += panel_MouseDoubleClick;
            panel.Resize           += panel_Resize;
            panel.MouseHover       += panel_MouseHover;
            panel.MouseLeave       += panel_MouseLeave;
            panel.AllowResize       = true;

            Label label = new Label();

            label.Text      = panel.Name;
            label.BackColor = Color.White;
            label.AutoSize  = true;

            panel.Controls.Add(label);
            pnl_adx03.Controls.Add(panel);
            panel.BringToFront();

            panel.Refresh();
        }
Пример #3
0
        void panel_Resize(object sender, EventArgs e)
        {
            string             panelName;
            UcTransparentPanel panel = (sender as UcTransparentPanel);

            panelName = panel.Name;
            if (Admi611sList == null || Admi611sList.Count == 0)
            {
                return;
            }

            var admi611s = Admi611sList.Where(p => p.ady02.ToString() == panelName)
                           .FirstOrDefault();

            if (admi611s == null)
            {
                return;
            }

            if (WfChkPanelInside(panel) == true)
            {
                admi611s.ady06 = panel.Size.Width;
                admi611s.ady07 = panel.Size.Height;
            }
            else
            {
                var result = WfShowConfirmMsg("已超過邊界,是否要刪除?");

                //if (WfShowConfirmMsg("已超過邊界,是否要刪除?")==1)
                if (result == DialogResult.Yes)
                {
                    panel.Dispose();
                    Admi611sList.Remove(admi611s);
                }
                else
                {
                    panel.Size = new Size(admi611s.ady06, admi611s.ady07);
                    panel.Refresh();
                }
            }
        }
Пример #4
0
        void panel_MouseUp(object sender, MouseEventArgs e)
        {
            UcTransparentPanel panel = null;
            Point panelLocation;

            System.Drawing.Size panelSize;
            try
            {
                panel = ((UcTransparentPanel)sender);
                if (FormEditMode != YREditType.修改 && FormEditMode != YREditType.新增)
                {
                    return;
                }

                if (e.Button != MouseButtons.Left)
                {
                    return;
                }

                if (isMove)
                {
                    var admi611sModel = Admi611sList.Where(p => p.ady02 == int.Parse(panel.Name))
                                        .FirstOrDefault();
                    panelSize     = panel.Size;     // = new Size(pDetailModel.ady06, pDetailModel.ady07);
                    panelLocation = panel.Location; // = new Point(pDetailModel.ady06, pDetailModel.ady07);
                    if (WfChkPanelInside(panel) == false)
                    {
                        var result = WfShowConfirmMsg("已超過邊界,是否要刪除?");
                        //if (WfShowConfirmMsg("已超過邊界,是否要刪除?") == 1)
                        if (result == DialogResult.Yes)
                        {
                            panel.Dispose();
                            Admi611sList.Remove(admi611sModel);
                        }
                        else
                        {
                            panel.Location = new Point(admi611sModel.ady04, admi611sModel.ady05);
                            panel.Refresh();
                        }
                    }
                    else
                    {
                        admi611sModel.ady04 = panelLocation.X;
                        admi611sModel.ady05 = panelLocation.Y;
                        admi611sModel.ady06 = panelSize.Width;
                        admi611sModel.ady07 = panelSize.Height;
                    }

                    panel.Refresh();
                    isMove = false;
                }
            }
            catch (Exception ex)
            {
                WfShowErrorMsg(ex.Message);
            }
            finally
            {
                isInDoubleClick = false;      //避免引發mousedoubleclick事件後 又再次處理 mouse up
            }
        }