コード例 #1
0
        public static MedMyLine CloneMedMyLine(MedMyLine source)
        {
            MedMyLine target = new MedMyLine();

            CloneMedMyLine(source, target);
            return(target);
        }
コード例 #2
0
 public static void CloneMedMyLine(MedMyLine source, MedMyLine target)
 {
     CloneControl(source, target);
     target.LineType = source.LineType;
 }
コード例 #3
0
        protected void AddTableByLine()
        {
            try
            {
                object[] objects = propertyGrid1.SelectedObjects;
                if (objects == null || objects.Length == 0)
                {
                    return;
                }

                MPanel mpanel = objects[0] as MPanel;
                if (mpanel == null)
                {
                    return;
                }

                int maxy = 0;
                foreach (Control ctrl in mpanel.Controls)
                {
                    if (ctrl.Bottom > maxy)
                    {
                        maxy = ctrl.Bottom;
                    }
                }

                TableCreatorDlg tableCreator   = new TableCreatorDlg(mpanel.Size);
                XtraForm        dialogHostForm = new XtraForm();
                tableCreator.TablePos = new Point(0, maxy);
                dialogHostForm.Width  = 705;
                dialogHostForm.Height = 390;
                dialogHostForm.Text   = "创建表格";
                tableCreator.Dock     = DockStyle.Fill;
                dialogHostForm.Controls.Add(tableCreator);

                if (dialogHostForm.ShowDialog() == DialogResult.OK)
                {
                    Type tp           = Type.GetType("MedicalSystem.Anes.Document.Controls.MedMyLine");
                    int  allRowHeight = Convert.ToInt32(tableCreator.AllRowHeight);
                    int  allColWidth  = Convert.ToInt32(tableCreator.AllColWidth);

                    // 加入横线
                    int currentPos = tableCreator.TablePos.Y;
                    for (int i = 0; i < tableCreator.RowHeight.Length; i++)
                    {
                        if (i > 0)
                        {
                            MedMyLine line1 = CurrentDocumentsHostControl.DesignerHost.CreateComponent(tp) as MedMyLine;
                            line1.Location = new Point(tableCreator.TablePos.X, currentPos);
                            line1.Width    = allColWidth;
                            line1.Height   = 1;
                            line1.LineType = MedMyLine.InnerLineType.Horizontal;
                            line1.Parent   = mpanel;
                        }

                        currentPos += Convert.ToInt32(tableCreator.RowHeight[i]);

                        if (i == tableCreator.RowHeight.Length - 1)
                        {
                            MedMyLine line1 = CurrentDocumentsHostControl.DesignerHost.CreateComponent(tp) as MedMyLine;
                            line1.Location = new Point(tableCreator.TablePos.X, currentPos);
                            line1.Width    = allColWidth;
                            line1.Height   = 1;
                            line1.LineType = MedMyLine.InnerLineType.Horizontal;
                            line1.Parent   = mpanel;
                        }
                    }

                    // 加入竖线
                    currentPos = tableCreator.TablePos.X;
                    for (int i = 0; i < tableCreator.ColWidth.Length; i++)
                    {
                        if (i > 0)
                        {
                            MedMyLine line1 = CurrentDocumentsHostControl.DesignerHost.CreateComponent(tp) as MedMyLine;
                            line1.Location = new Point(currentPos, tableCreator.TablePos.Y);
                            line1.Width    = 1;
                            line1.Height   = allRowHeight;
                            line1.LineType = MedMyLine.InnerLineType.Vertical;
                            line1.Parent   = mpanel;
                        }

                        currentPos += Convert.ToInt32(tableCreator.ColWidth[i]);
                    }
                }
            }
            catch
            {
            }
        }