示例#1
0
        private void UserControl1_Click(object sender, EventArgs e)
        {
            myEventArgs myEventArgs_temp = new myEventArgs(arrControls_User);

            if (myEvent != null)
            {
                myEvent(this, myEventArgs_temp);
            }
        }
示例#2
0
        private void commonClick(object sender, EventArgs e)
        {
            myEventArgs myEventArgs_temp = new myEventArgs((Control)sender, this);

            if (myEvent != null)
            {
                myEvent(this, myEventArgs_temp);
            }
        }
示例#3
0
文件: Form1.cs 项目: Gwee/csharp
        private void fromUser(object sender, myEventArgs e)
        {
            this.Controls.Remove(myControl);

            myControl          = e.mControl;
            myControl.Location = new Point(250, 150);
            this.Controls.Add(myControl);

            e.mUserControl.Controls.Remove(e.mControl);
        }
示例#4
0
        private void commonClick(object sender, EventArgs e)
        {
            string sText = ((Control)sender).Text;
            string sType = sender.GetType().Name;

            myEventArgs myEventArgs_temp = new myEventArgs(sText, sType);

            if (myEvent != null)
            {
                myEvent(this, myEventArgs_temp);
            }
        }
示例#5
0
文件: Form1.cs 项目: Gwee/csharp
        private void fromUser(object sender, myEventArgs e)
        {
            for (int i = 0; i < ListControls_Form.Count; i++)
            {
                this.Controls.Remove(ListControls_Form[i]);
            }
            ListControls_Form.Clear();

            for (int i = 0; i < e.arrControls.Length; i++)
            {
                if (e.arrControls[i].Text != "")
                {
                    //////////// Copy controls
                    Control tempControl;
                    if (e.arrControls[i].GetType().Name == "Label")
                    {
                        tempControl = new Label();
                        ((Label)tempControl).TextAlign   = ContentAlignment.MiddleCenter;
                        ((Label)tempControl).BorderStyle = BorderStyle.FixedSingle;
                    }
                    else
                    {
                        tempControl = new Button();
                    }

                    tempControl.Font      = e.arrControls[i].Font;
                    tempControl.Size      = e.arrControls[i].Size;
                    tempControl.BackColor = e.arrControls[i].BackColor;
                    tempControl.Text      = e.arrControls[i].Text;

                    ListControls_Form.Add(tempControl);

                    //////////// Move controls
                    // ListControls_Form.Add(e.arrControls[i]);
                    // myUserControl1.Controls.Remove(e.arrControls[i]);
                }
            }

            ListControls_Form.Sort((x, y) => int.Parse(x.Text) - int.Parse(y.Text));

            int lastY = 10;

            for (int i = 0; i < ListControls_Form.Count; i++)
            {
                ListControls_Form[i].Location = new Point(200, lastY);
                lastY += ListControls_Form[i].Size.Height + 5;
                this.Controls.Add(ListControls_Form[i]);
            }
        }
示例#6
0
        private void commonClick(object sender, EventArgs e)
        {
            string sText      = ((Control)sender).Text;
            Type   sType      = sender.GetType();
            Color  sBackColor = ((Control)sender).BackColor;
            Font   sFont      = ((Control)sender).Font;
            Size   sSize      = ((Control)sender).Size;

            myEventArgs myEventArgs_temp = new myEventArgs(sText, sType, sBackColor, sFont, sSize);

            if (myEvent != null)
            {
                myEvent(this, myEventArgs_temp);
            }
        }
示例#7
0
文件: Form1.cs 项目: Gwee/csharp
        private void fromUser(object sender, myEventArgs e)
        {
            if (arrControls_Form != null)
            {
                for (int i = 0; i < arrControls_Form.Length; i++)
                {
                    this.Controls.Remove(arrControls_Form[i]);
                }
            }

            string[] arrStr = new string[e.arrControls.Length];
            for (int i = 0; i < e.arrControls.Length; i++)
            {
                arrStr[i] = e.arrControls[i].Text;
            }

            int[] arrIndex = sorting(arrStr);
            arrControls_Form = new Control[arrIndex.Length];
            int lastY = 10;

            for (int i = 0; i < arrIndex.Length; i++)
            {
                //////////// Copy controls
                if (e.arrControls[arrIndex[i]].GetType().Name == "Label")
                {
                    arrControls_Form[i] = new Label();
                    ((Label)arrControls_Form[i]).TextAlign   = ContentAlignment.MiddleCenter;
                    ((Label)arrControls_Form[i]).BorderStyle = BorderStyle.FixedSingle;
                }
                else
                {
                    arrControls_Form[i] = new Button();
                }
                arrControls_Form[i].Font      = e.arrControls[arrIndex[i]].Font;
                arrControls_Form[i].Size      = e.arrControls[arrIndex[i]].Size;
                arrControls_Form[i].BackColor = e.arrControls[arrIndex[i]].BackColor;
                arrControls_Form[i].Text      = e.arrControls[arrIndex[i]].Text;

                //////////// Move controls
                //arrControls_Form[i] = e.arrControls[arrIndex[i]];
                //myUserControl1.Controls.Remove(arrControls_Form[i]);

                arrControls_Form[i].Location = new Point(160, lastY);
                lastY += arrControls_Form[i].Size.Height + 5;
                this.Controls.Add(arrControls_Form[i]);
            }
        }
示例#8
0
 private void fromUser(object sender, myEventArgs e)
 {
     this.Controls.Remove(myControl);
     if (e.mType.Name == "Button")
     {
         myControl = new Button();
     }
     else
     {
         myControl = new Label();
     }
     myControl.Text      = e.mText;
     myControl.BackColor = e.mBackColor;
     myControl.Font      = e.mFont;
     myControl.Size      = e.mSize;
     myControl.Location  = new Point(250, 150);
     this.Controls.Add(myControl);
 }
示例#9
0
 private void fromUser(object sender, myEventArgs e)
 {
     label1.Text = e.myStrText + "  from  " + e.myStrType;
 }