示例#1
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();
                }
            }
        }
示例#2
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
            }
        }