public void ClonePanel(List<Control> controlList, Control ctl, int cntX, int cntY, int SpaceX, int SpaceY, int Max) { for (int i = 0; i < cntY; i++) { for (int j = 0; j < cntX; j++) { if ((i != 0) || (j != 0)) { if (((i * cntX) + (j + 1)) > Max) { break; } BindingSourceEx item = new BindingSourceEx(this.ds, this.bsRepeat.DataMember); this.bsRList.Add(item); Control control = this.copyControls(ctl, item); control.SuspendLayout(); this.pList.Add(control); Point point = new Point(); point.X = ctl.Location.X + ((ctl.Width + SpaceX) * j); point.Y = ctl.Location.Y + ((ctl.Height + SpaceY) * i); control.Location = point; controlList.Add(control); } } } }
private Control copyControls(Control sourceControl, BindingSourceEx BS) { string dataMember = ""; System.Type type = sourceControl.GetType(); System.Type[] typeArray = new System.Type[] { type }; ConstructorInfo[] constructors = type.GetConstructors(); object[] parameters = new object[0]; Control dest = (Control) constructors[0].Invoke(parameters); this.copyProperties(sourceControl, dest); string propertyName = ""; if ((sourceControl is LBMaskedTextBox) || (sourceControl is LBInputComboBox)) { propertyName = "Text"; } if (((sourceControl is LBTextBox) || (sourceControl is LBCommaTextBox)) || ((sourceControl is LBDivTextBox) || (sourceControl is LBDateTimePicker))) { propertyName = "BindText"; } if (sourceControl is LBComboBox) { propertyName = "SelectedValue"; } if ((sourceControl is LBCheckBox) || (sourceControl is LBRadioButton)) { propertyName = "CheckedText"; } if (propertyName != "") { PropertyDescriptor descriptor = TypeDescriptor.GetProperties(dest)["id"]; if (descriptor != null) { dataMember = descriptor.Converter.ConvertToInvariantString(descriptor.GetValue(dest)); } Binding binding = new Binding(propertyName, BS, dataMember, false, DataSourceUpdateMode.OnPropertyChanged); dest.DataBindings.Clear(); dest.DataBindings.Add(binding); } if (sourceControl is RanLabel) { BS.PositionItem = (RanLabel) dest; } if (!(sourceControl is LBDivTextBox) && sourceControl.HasChildren) { foreach (Control control2 in sourceControl.Controls) { Control control3 = this.copyControls(control2, BS); dest.Controls.Add(control3); } } return dest; }
private void InitializeComponent() { this.components = new Container(); ComponentResourceManager manager = new ComponentResourceManager(typeof(CommonJobPanel)); this.toolTip = new ToolTip(this.components); this.lbNavigator = new LBNavigator(); this.bindingNavigatorMoveFirstItem = new ToolStripButton(); this.bindingNavigatorMovePreviousItem = new ToolStripButton(); this.bindingNavigatorSeparator = new ToolStripSeparator(); this.toolStripTextBox1 = new ToolStripTextBox(); this.toolStripLabel1 = new ToolStripLabel(); this.bindingNavigatorSeparator1 = new ToolStripSeparator(); this.bindingNavigatorMoveNextItem = new ToolStripButton(); this.bindingNavigatorMoveLastItem = new ToolStripButton(); this.bindingNavigatorSeparator2 = new ToolStripSeparator(); this.lblNextpage = new ToolStripLabel(); this.bsCom = new BindingSourceEx(this.components); this.bsRepeat = new BindingSourceEx(this.components); this.lbNavigator.BeginInit(); this.lbNavigator.SuspendLayout(); ((ISupportInitialize) this.bsCom).BeginInit(); ((ISupportInitialize) this.bsRepeat).BeginInit(); base.SuspendLayout(); this.toolTip.IsBalloon = true; this.toolTip.ToolTipIcon = ToolTipIcon.Info; this.lbNavigator.AddNewItem = null; this.lbNavigator.CountItem = null; this.lbNavigator.DeleteItem = null; this.lbNavigator.Dock = DockStyle.None; this.lbNavigator.Font = new Font("Tahoma", 9f, FontStyle.Regular, GraphicsUnit.Point, 0x80); this.lbNavigator.Items.AddRange(new ToolStripItem[] { this.bindingNavigatorMoveFirstItem, this.bindingNavigatorMovePreviousItem, this.bindingNavigatorSeparator, this.toolStripTextBox1, this.toolStripLabel1, this.bindingNavigatorSeparator1, this.bindingNavigatorMoveNextItem, this.bindingNavigatorMoveLastItem, this.bindingNavigatorSeparator2, this.lblNextpage }); this.lbNavigator.Location = new Point(0x19, 0xce); this.lbNavigator.MoveFirstItem = null; this.lbNavigator.MoveLastItem = null; this.lbNavigator.MoveNextItem = null; this.lbNavigator.MovePreviousItem = null; this.lbNavigator.Name = "lbNavigator"; this.lbNavigator.PositionItem = null; this.lbNavigator.repetition_id = ""; this.lbNavigator.repetition_max = 1; this.lbNavigator.Size = new System.Drawing.Size(0xba, 0x19); this.lbNavigator.Stretch = true; this.lbNavigator.TabIndex = 12; this.lbNavigator.Text = "lbNavigator1"; this.lbNavigator.Visible = false; this.bindingNavigatorMoveFirstItem.DisplayStyle = ToolStripItemDisplayStyle.Image; // this.bindingNavigatorMoveFirstItem.Image = (Image) manager.GetObject("bindingNavigatorMoveFirstItem.Image"); this.bindingNavigatorMoveFirstItem.Name = "bindingNavigatorMoveFirstItem"; this.bindingNavigatorMoveFirstItem.RightToLeftAutoMirrorImage = true; this.bindingNavigatorMoveFirstItem.Size = new System.Drawing.Size(0x17, 0x16); this.bindingNavigatorMoveFirstItem.Text = "Hạng mục đầu ti\x00ean"; this.bindingNavigatorMoveFirstItem.Click += new EventHandler(this.bindingNavigatorMoveFirstItem_Click); this.bindingNavigatorMovePreviousItem.DisplayStyle = ToolStripItemDisplayStyle.Image; // this.bindingNavigatorMovePreviousItem.Image = (Image) manager.GetObject("bindingNavigatorMovePreviousItem.Image"); this.bindingNavigatorMovePreviousItem.Name = "bindingNavigatorMovePreviousItem"; this.bindingNavigatorMovePreviousItem.RightToLeftAutoMirrorImage = true; this.bindingNavigatorMovePreviousItem.Size = new System.Drawing.Size(0x17, 0x16); this.bindingNavigatorMovePreviousItem.Text = "Hạng mục trước"; this.bindingNavigatorMovePreviousItem.Click += new EventHandler(this.bindingNavigatorMovePreviousItem_Click); this.bindingNavigatorSeparator.Name = "bindingNavigatorSeparator"; this.bindingNavigatorSeparator.Size = new System.Drawing.Size(6, 0x19); this.toolStripTextBox1.BackColor = SystemColors.Window; this.toolStripTextBox1.Font = new Font("Tahoma", 9f, FontStyle.Regular, GraphicsUnit.Point, 0x80); this.toolStripTextBox1.MaxLength = 4; this.toolStripTextBox1.Name = "toolStripTextBox1"; this.toolStripTextBox1.Size = new System.Drawing.Size(0x2b, 0x19); this.toolStripTextBox1.TextBox.ContextMenuStrip = new ContextMenuStrip(); this.toolStripTextBox1.KeyDown += new KeyEventHandler(this.toolStripTextBox1_KeyDown); this.toolStripTextBox1.TextBox.MouseMove += new MouseEventHandler(this.toolStripTextBox_MouseMove); this.toolStripLabel1.Name = "toolStripLabel1"; this.toolStripLabel1.Size = new System.Drawing.Size(0x13, 0x16); this.toolStripLabel1.Text = "/0"; this.bindingNavigatorSeparator1.Name = "bindingNavigatorSeparator1"; this.bindingNavigatorSeparator1.Size = new System.Drawing.Size(6, 0x19); this.bindingNavigatorMoveNextItem.DisplayStyle = ToolStripItemDisplayStyle.Image; // this.bindingNavigatorMoveNextItem.Image = (Image) manager.GetObject("bindingNavigatorMoveNextItem.Image"); this.bindingNavigatorMoveNextItem.Name = "bindingNavigatorMoveNextItem"; this.bindingNavigatorMoveNextItem.RightToLeftAutoMirrorImage = true; this.bindingNavigatorMoveNextItem.Size = new System.Drawing.Size(0x17, 0x16); this.bindingNavigatorMoveNextItem.Text = "Hạng mục tiếp theo"; this.bindingNavigatorMoveNextItem.Click += new EventHandler(this.bindingNavigatorMoveNextItem_Click); this.bindingNavigatorMoveLastItem.DisplayStyle = ToolStripItemDisplayStyle.Image; // this.bindingNavigatorMoveLastItem.Image = (Image) manager.GetObject("bindingNavigatorMoveLastItem.Image"); this.bindingNavigatorMoveLastItem.Name = "bindingNavigatorMoveLastItem"; this.bindingNavigatorMoveLastItem.RightToLeftAutoMirrorImage = true; this.bindingNavigatorMoveLastItem.Size = new System.Drawing.Size(0x17, 0x16); this.bindingNavigatorMoveLastItem.Text = "Hạng mục cuối c\x00f9ng"; this.bindingNavigatorMoveLastItem.Click += new EventHandler(this.bindingNavigatorMoveLastItem_Click); this.bindingNavigatorSeparator2.Name = "bindingNavigatorSeparator2"; this.bindingNavigatorSeparator2.Size = new System.Drawing.Size(6, 0x19); this.lblNextpage.Name = "lblNextpage"; this.lblNextpage.Size = new System.Drawing.Size(0, 0x16); this.bsCom.DataMember = "COM"; this.bsCom.PositionItem = null; this.bsRepeat.PositionItem = null; this.bsRepeat.PositionChanged += new EventHandler(this.bsRepeat_PositionChanged); base.AutoScaleDimensions = new SizeF(6f, 12f); /// base.AutoScaleMode = AutoScaleMode.Font; this.AutoScroll = true; base.Controls.Add(this.lbNavigator); base.Name = "CommonJobPanel"; this.Font = new Font("Courier New", 9f, FontStyle.Regular, GraphicsUnit.Point, 0); base.Size = new System.Drawing.Size(0x267, 0x381); base.Paint += new PaintEventHandler(this.CommonJobPanel_Paint); this.lbNavigator.EndInit(); this.lbNavigator.ResumeLayout(false); this.lbNavigator.PerformLayout(); ((ISupportInitialize) this.bsCom).EndInit(); ((ISupportInitialize) this.bsRepeat).EndInit(); base.ResumeLayout(false); base.PerformLayout(); }