Exemplo n.º 1
0
        public static PanelDoubleBuffered[] Factory(Action <object, PaintEventArgs> paintevent)
        {
            int num = ImageTableSettings.Rows * ImageTableSettings.Columns,
                x = 0, y = 0, h = ImageTableSettings.Height, w = ImageTableSettings.Width;

            PanelDoubleBuffered[] panels = new PanelDoubleBuffered[num];

            for (int i = 0; i < num; i++)
            {
                if (i % ImageTableSettings.Columns == 0 && i > 0)
                {
                    y += h;
                    x  = 0;
                }
                PanelDoubleBuffered p = new PanelDoubleBuffered();
                p.Height   = ImageTableSettings.Height;
                p.Width    = ImageTableSettings.Width;
                p.Paint   += new System.Windows.Forms.PaintEventHandler(paintevent);
                p.Location = new Point(x, y);
                panels[i]  = p;
                x         += w;
            }

            return(panels);
        }
Exemplo n.º 2
0
 public override void doDoubleClick(PanelDoubleBuffered pn, ShapeBase ns)
 {
 }
Exemplo n.º 3
0
        public virtual void doDoubleClick(PanelDoubleBuffered pn, ShapeBase ns)
        {
            parentPanel = pn;
            namingShape = ns;

            if (parentPanel.isNaming)
            {
                parentPanel.AffectingShape.endEditName();
                return;
            }

            parentPanel.AffectingShape = ns;
            parentPanel.isNaming       = true;

            txtName = new TextBox();

            //cho class con định vị xong rồi add lên shape theo vị trí đó
            dinhviTextBox(txtName);

            txtName.Text = sName; //hiện tên cũ

            sName = "";
            this.Invalidate();

            this.Controls.Add(txtName);
            txtName.SelectAll();
            txtName.Focus();
            txtName.KeyPress += new System.Windows.Forms.KeyPressEventHandler(txtName_KeyPress);

            //Data type cho attribute
            if (this is AttributeShape)
            {
                if (((AttributeShape)this).attributeChilds.Count == 0)
                {
                    ucDataDescription          = new DataDescription();
                    ucDataDescription.Location = new Point(this.Location.X + this.Width + 5, this.Location.Y);
                    parentPanel.Controls.Add(ucDataDescription);

                    //Cho USC nằm lên trên.
                    parentPanel.Controls.SetChildIndex(ucDataDescription, 0);

                    if (((AttributeShape)this).type == AttributeType.Key)
                    {
                        ucDataDescription.chkNull.Enabled = false;
                    }

                    if (((AttributeShape)this).dataType != null)
                    {
                        ucDataDescription.cboDataType.SelectedItem = ((AttributeShape)this).dataType;
                    }
                    if (((AttributeShape)this).dataLength != 0)
                    {
                        ucDataDescription.txtLength.Text = ((AttributeShape)this).dataLength.ToString();
                    }

                    ucDataDescription.chkNull.Checked = ((AttributeShape)this).allowNull;

                    if (((AttributeShape)this).description != "")
                    {
                        ucDataDescription.txtDescription.Text = ((AttributeShape)this).description;
                    }

                    ucDataDescription.btnOK.Click += new EventHandler(btnOK_Click);
                }
            }
        }