示例#1
0
        public PFWaitBox(Action doAction, string waitMsg = "请等待", Action <PFWaitBox> formAction = null) : base()
        {
            myButton = new Label();
            //myButton.Location = new Point(72, 160);
            myButton.Location = new Point(72, 72);
            //myButton.Size = new Size(152, 32);
            myButton.TabIndex = 1;
            myButton.Text     = waitMsg;
            myButton.Width    = int.Parse(PFDataHelper.GetWordsWidth(waitMsg).Replace("px", ""));

            var lab      = myButton;
            var waitForm = this;

            waitForm.Width  = lab.Width + 200;
            waitForm.Height = lab.Height + 100;
            //waitForm.FormBorderStyle = FormBorderStyle.FixedSingle;
            int windowBorder = (waitForm.Width - waitForm.ClientRectangle.Width) / 2;
            int topHeight    = (waitForm.Height - waitForm.ClientRectangle.Height - windowBorder);

            lab.Location = new Point((waitForm.Width - lab.Width) / 2, (waitForm.Height - topHeight - lab.Height) / 2);

            //ClientSize = new Size(292, 273);
            //ClientSize = new Size(292, 185);
            Controls.AddRange(new Control[] { myButton });
            //Text = " 'Control_Invoke' example";
            Text = "稍后";
            #region by wxj
            action = doAction;
            if (formAction != null)
            {
                formAction(this);
            }
            #endregion

            myDelegate = new AddListItem(AddListItemMethod);

            //myThread = new Thread(new ThreadStart(ThreadFunction));
            //myThread.Start();
        }