public Down(Hero hero, Map map, Control.ControlCollection controls) { this.hero = hero; this.map = map; this.controls = controls; }
public DataTable buscar_local_filtrado(Control.ControlCollection controles) { return(_BD.buscar_filtrado(controles, "Locales")); }
/// <summary> /// This is used to store the control values in the given collection to their associated project /// properties. /// </summary> /// <param name="controls">The control collection from which to get the values. Controls are bound if /// their <see cref="Control.Tag"/> property is a string that matches a project property.</param> /// <remarks>This method is recursive</remarks> protected void StoreProperties(Control.ControlCollection controls) { Type t; PropertyInfo pi; object controlValue; string typeName, boundProperty, propValue; foreach(Control c in controls) { t = c.GetType(); typeName = t.FullName; boundProperty = c.Tag as string; // Ignore unbound controls if(String.IsNullOrEmpty(boundProperty)) { // Scan containers too except for user controls unless they are in the custom user control // list. They may or may not represent a single-valued item and we can't process them // reliably. The same could be true of one of these if it's a derived type. if(!customControls.ContainsKey(typeName) && (c is GroupBox || c is Panel || c is TabControl || c is TabPage || c is SplitContainer || customUserControls.Contains(typeName))) this.StoreProperties(c.Controls); continue; } // Check for custom types first if(customControls.ContainsKey(typeName)) { pi = t.GetProperty(customControls[typeName], BindingFlags.Public | BindingFlags.Instance); } else if(c is TextBoxBase || c is Label) { pi = t.GetProperty("Text", BindingFlags.Public | BindingFlags.Instance); } else if(c is ComboBox) { if(((ComboBox)c).DataSource != null) pi = t.GetProperty("SelectedValue", BindingFlags.Public | BindingFlags.Instance); else pi = t.GetProperty("SelectedItem", BindingFlags.Public | BindingFlags.Instance); } else if(c is CheckBox) { pi = t.GetProperty("Checked", BindingFlags.Public | BindingFlags.Instance); } else if((c is DateTimePicker) || (c is UpDownBase) || (c is TrackBar)) { pi = t.GetProperty("Value", BindingFlags.Public | BindingFlags.Instance); } else if(c is ListBox) { if(((ListBox)c).DataSource != null) pi = t.GetProperty("SelectedValue", BindingFlags.Public | BindingFlags.Instance); else pi = t.GetProperty("SelectedItem", BindingFlags.Public | BindingFlags.Instance); } else pi = null; // Note that CheckedListBox is not handled here since it is most likely multi-valued. The // user must store it in the StoreControLValue() method override. // Give the user a chance to handle the control in a custom fashion. If not handled and we // couldn't figure out what to use, ignore it. if(!this.StoreControlValue(c) && pi != null) { controlValue = pi.GetValue(c, null); if(controlValue == null) propValue = String.Empty; else propValue = controlValue.ToString(); // If the string is empty and the property doesn't exist, don't create it unnecessarily if(propValue.Length != 0 || this.CurrentProject.MSBuildProject.GetProperty(boundProperty) != null) { if(this.IsEscapedProperty(boundProperty)) propValue = EscapeValueAttribute.Escape(propValue); this.CurrentProject.MSBuildProject.SetProperty(boundProperty, propValue); } } } }
}// CIsoStoragePermControls //------------------------------------------------- // InsertPropSheetPageControls // // Inserts controls into the given control collection //------------------------------------------------- internal override int InsertPropSheetPageControls(Control.ControlCollection cc) { System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(CIsoStoragePermControls)); this.m_radGrantFollowingPermission = new System.Windows.Forms.RadioButton(); this.m_cbUsage = new System.Windows.Forms.ComboBox(); this.m_lblDiskQuota = new System.Windows.Forms.Label(); this.m_lblQuotaDes = new System.Windows.Forms.Label(); this.m_lblBytes = new System.Windows.Forms.Label(); this.m_radUnrestricted = new System.Windows.Forms.RadioButton(); this.m_lblUsageAllowed = new System.Windows.Forms.Label(); this.m_txtDiskQuota = new System.Windows.Forms.TextBox(); this.m_lblUsageDescription = new System.Windows.Forms.Label(); this.m_ucOptions = new System.Windows.Forms.UserControl(); this.m_radGrantFollowingPermission.Location = ((System.Drawing.Point)(resources.GetObject("m_radGrantPermissions.Location"))); this.m_radGrantFollowingPermission.Size = ((System.Drawing.Size)(resources.GetObject("m_radGrantPermissions.Size"))); this.m_radGrantFollowingPermission.TabIndex = ((int)(resources.GetObject("m_radGrantPermissions.TabIndex"))); this.m_radGrantFollowingPermission.Text = resources.GetString("m_radGrantPermissions.Text"); m_radGrantFollowingPermission.Name = "Restricted"; this.m_cbUsage.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.m_cbUsage.DropDownWidth = 224; this.m_cbUsage.Location = ((System.Drawing.Point)(resources.GetObject("m_cbUsage.Location"))); this.m_cbUsage.Size = ((System.Drawing.Size)(resources.GetObject("m_cbUsage.Size"))); this.m_cbUsage.TabIndex = ((int)(resources.GetObject("m_cbUsage.TabIndex"))); m_cbUsage.Name = "Usage"; this.m_lblDiskQuota.Location = ((System.Drawing.Point)(resources.GetObject("m_lblDiskQuota.Location"))); this.m_lblDiskQuota.Size = ((System.Drawing.Size)(resources.GetObject("m_lblDiskQuota.Size"))); this.m_lblDiskQuota.TabIndex = ((int)(resources.GetObject("m_lblDiskQuota.TabIndex"))); this.m_lblDiskQuota.Text = resources.GetString("m_lblDiskQuota.Text"); m_lblDiskQuota.Name = "DiskQuotaLabel"; this.m_lblQuotaDes.Location = ((System.Drawing.Point)(resources.GetObject("m_lblQuotaDes.Location"))); this.m_lblQuotaDes.Size = ((System.Drawing.Size)(resources.GetObject("m_lblQuotaDes.Size"))); this.m_lblQuotaDes.TabIndex = ((int)(resources.GetObject("m_lblQuotaDes.TabIndex"))); this.m_lblQuotaDes.Text = resources.GetString("m_lblQuotaDes.Text"); m_lblQuotaDes.Name = "DiskQuotaDescription"; this.m_lblBytes.Location = ((System.Drawing.Point)(resources.GetObject("m_lblBytes.Location"))); this.m_lblBytes.Size = ((System.Drawing.Size)(resources.GetObject("m_lblBytes.Size"))); this.m_lblBytes.TabIndex = ((int)(resources.GetObject("m_lblBytes.TabIndex"))); this.m_lblBytes.Text = resources.GetString("m_lblBytes.Text"); m_lblBytes.Name = "BytesLabel"; this.m_radUnrestricted.Location = ((System.Drawing.Point)(resources.GetObject("m_radUnrestricted.Location"))); this.m_radUnrestricted.Size = ((System.Drawing.Size)(resources.GetObject("m_radUnrestricted.Size"))); this.m_radUnrestricted.TabIndex = ((int)(resources.GetObject("m_radUnrestricted.TabIndex"))); this.m_radUnrestricted.Text = resources.GetString("m_radUnrestricted.Text"); m_radUnrestricted.Name = "Unrestricted"; this.m_lblUsageAllowed.Location = ((System.Drawing.Point)(resources.GetObject("m_lblUsageAllowed.Location"))); this.m_lblUsageAllowed.Size = ((System.Drawing.Size)(resources.GetObject("m_lblUsageAllowed.Size"))); this.m_lblUsageAllowed.TabIndex = ((int)(resources.GetObject("m_lblUsageAllowed.TabIndex"))); this.m_lblUsageAllowed.Text = resources.GetString("m_lblUsageAllowed.Text"); m_lblUsageAllowed.Name = "UsageAllowedLabel"; this.m_txtDiskQuota.Location = ((System.Drawing.Point)(resources.GetObject("m_txtDiskQuota.Location"))); this.m_txtDiskQuota.Size = ((System.Drawing.Size)(resources.GetObject("m_txtDiskQuota.Size"))); this.m_txtDiskQuota.TabIndex = ((int)(resources.GetObject("m_txtDiskQuota.TabIndex"))); this.m_txtDiskQuota.Text = resources.GetString("m_txtDiskQuota.Text"); m_txtDiskQuota.Name = "DiskQuota"; this.m_lblUsageDescription.Location = ((System.Drawing.Point)(resources.GetObject("m_lblUsageDescription.Location"))); this.m_lblUsageDescription.Size = ((System.Drawing.Size)(resources.GetObject("m_lblUsageDescription.Size"))); this.m_lblUsageDescription.TabIndex = ((int)(resources.GetObject("m_lblUsageDescription.TabIndex"))); m_lblUsageDescription.Name = "UsageDescription"; this.m_ucOptions.Controls.AddRange(new System.Windows.Forms.Control[] { this.m_lblUsageAllowed, this.m_cbUsage, this.m_lblQuotaDes, this.m_lblDiskQuota, this.m_txtDiskQuota, this.m_lblUsageDescription, this.m_lblBytes }); this.m_ucOptions.Location = ((System.Drawing.Point)(resources.GetObject("m_ucOptions.Location"))); this.m_ucOptions.Size = ((System.Drawing.Size)(resources.GetObject("m_ucOptions.Size"))); this.m_ucOptions.TabIndex = ((int)(resources.GetObject("m_ucOptions.TabIndex"))); m_ucOptions.Name = "Options"; cc.AddRange(new System.Windows.Forms.Control[] { this.m_radGrantFollowingPermission, this.m_ucOptions, this.m_radUnrestricted, }); // Fill in the data PutValuesinPage(); // Hook up event handlers m_radGrantFollowingPermission.CheckedChanged += new EventHandler(onChangeUnRestrict); m_cbUsage.SelectedIndexChanged += new EventHandler(onChange); m_cbUsage.SelectedIndexChanged += new EventHandler(onUsageChange); m_txtDiskQuota.TextChanged += new EventHandler(onChange); m_txtDiskQuota.KeyPress += new KeyPressEventHandler(onKeyPress); m_radUnrestricted.CheckedChanged += new EventHandler(onChangeUnRestrict); return(1); }// InsertPropSheetPageControls
public bool agregar_local(Control.ControlCollection controles) { return(_BD.auto_insert(controles, "Locales")); }
private void SetControlProperties(Control.ControlCollection controls) { for (int i = 0; i < controls.Count; i++) { Control control = controls[i]; if (control is SplitterPanel splitterPanel) { splitterPanel.BackColor = AppearanceSettings.BaseBackColor; } else if (control is MenuStrip menuStrip) { menuStrip.Renderer = new CustomToolStripRenderer(); menuStrip.Font = this.Font; } else if (control is ToolStrip toolStrip) { toolStrip.Renderer = new CustomToolStripRenderer(); toolStrip.Font = this.Font; } else if (control is StatusStrip statusStrip) { statusStrip.Renderer = new CustomToolStripRenderer(); statusStrip.Font = this.Font; } else if (control is MdiClient && this.IsMdiContainer) { control.BackColor = AppearanceSettings.ApplicationBackColor; } else if (control is EditorControl editorControl) { editorControl.UpdateAppearance(); } else if (control is ProgressBar progressBar) { progressBar.BackColor = AppearanceSettings.ApplicationBackColor; } else if (control is ComboBox comboBox) { comboBox.FlatStyle = FlatStyle.Flat; comboBox.BackColor = AppearanceSettings.TextBoxBackColor; comboBox.ForeColor = AppearanceSettings.TextBoxForeColor; if (VisualWrapper.Apply(control) != null) { i--; } } else if (control is TextBoxBase textBoxBase) { textBoxBase.BackColor = AppearanceSettings.TextBoxBackColor; textBoxBase.ForeColor = AppearanceSettings.TextBoxForeColor; if (VisualWrapper.Apply(control) != null) { i--; } } else if (control is PropertyGrid propertyGrid) { propertyGrid.ViewBackColor = this.BackColor; propertyGrid.ViewForeColor = this.ForeColor; propertyGrid.HelpBackColor = AppearanceSettings.BaseBackColor; propertyGrid.HelpForeColor = AppearanceSettings.BaseForeColor; propertyGrid.LineColor = AppearanceSettings.BorderColor; propertyGrid.CategoryForeColor = AppearanceSettings.ActiveCaptionTextColor; } else if (control is DataGridView dataGridView) { dataGridView.ColumnHeadersDefaultCellStyle.BackColor = this.BackColor; dataGridView.ColumnHeadersDefaultCellStyle.ForeColor = this.ForeColor; dataGridView.GridColor = this.BackColor; dataGridView.BackgroundColor = AppearanceSettings.BaseBackColor; dataGridView.RowHeadersDefaultCellStyle = ((DataGridView)control).ColumnHeadersDefaultCellStyle; dataGridView.DefaultCellStyle.BackColor = AppearanceSettings.BaseBackColor; dataGridView.DefaultCellStyle.ForeColor = AppearanceSettings.BaseForeColor; } else if (control is ListView listView) { listView.BackColor = AppearanceSettings.BaseBackColor; listView.ForeColor = AppearanceSettings.BaseForeColor; control.Refresh(); } else if (control is Button button) { button.FlatStyle = FlatStyle.Flat; button.BackColor = AppearanceSettings.BaseBackColor; button.ForeColor = AppearanceSettings.BaseForeColor; button.FlatAppearance.BorderColor = AppearanceSettings.HoverItemBackColor; button.FlatAppearance.MouseOverBackColor = AppearanceSettings.HoverItemBackColor; button.FlatAppearance.MouseDownBackColor = AppearanceSettings.ActiveCaptionBackColor; button.FlatAppearance.BorderSize = 0; } else if (control is TreeView treeView) { treeView.BackColor = AppearanceSettings.BaseBackColor; treeView.ForeColor = AppearanceSettings.BaseForeColor; } control.Invalidate(); if (control.HasChildren) { SetControlProperties(control.Controls); } } }
public static void ListControls(string title, Control.ControlCollection controls) { ListControls(title, controls, false); }
/// <summary> /// Create a new FormValidator validating the specified form. /// </summary> /// <param name="formToValidate">The form which contains components to validate.</param> public FormValidator(Form formToValidate) { _controls = formToValidate.Controls; }
/// <summary> /// Create a new FormValidator validating the specified controls. /// </summary> /// <param name="comToValidate">Components to validate.</param> public FormValidator(Control.ControlCollection comToValidate) { _controls = comToValidate; }
private bool ValidateRow(FlowLayoutPanel sender) { Control.ControlCollection collection = sender.Controls; return(AllTextBoxesAreEmpty(collection) || AllTextBoxesAreNotEmpty(collection)); }
public override void AddToTab(TabPage o) { o.Text = "WBXML"; tagPageControl = o.Controls; }
public virtual void ReplaceControls(IAsyncControls form, Control.ControlCollection controls, ComboBox valueControl) { Form = form; ReplaceControl(controls, valueControl, ValueControl); }
private int Validar(Control.ControlCollection controls) { int result; double res; int msj = 0; bool est = false; foreach (Control c in controls) { if (c is TextBox & c.Text == String.Empty) { msj = 1; est = true; break; } } if (!est) { if (!(Int32.TryParse(txtHs.Text, out result))) { msj = 2; } else if (this.chkArribo.Checked) { if (txtTEA.Text.Contains(".")) { txtTEA.Text = txtTEA.Text.Replace('.', ','); } if (!(Double.TryParse(txtTEA.Text, out res))) { msj = 4; } else if (Convert.ToDouble(txtTEA.Text) < 0.1 || Convert.ToDouble(txtTEA.Text) > 1) { msj = 6; } } else if (this.chkServicio.Checked) { if (txtTDS1.Text.Contains(".")) { txtTDS1.Text = txtTDS1.Text.Replace('.', ','); } if (txtTDS2.Text.Contains(".")) { txtTDS2.Text = txtTDS2.Text.Replace('.', ','); } if (txtTDS3.Text.Contains(".")) { txtTDS3.Text = txtTDS3.Text.Replace('.', ','); } if (txtTDS4.Text.Contains(".")) { txtTDS4.Text = txtTDS4.Text.Replace('.', ','); } if (!(Double.TryParse(txtTDS1.Text, out res)) || !(Double.TryParse(txtTDS2.Text, out res)) || !(Double.TryParse(txtTDS3.Text, out res)) || !(Double.TryParse(txtTDS4.Text, out res))) { msj = 3; } else if ((Convert.ToDouble(txtTDS1.Text) < 0.1 || Convert.ToDouble(txtTDS1.Text) > 1) || (Convert.ToDouble(txtTDS2.Text) < 0.1 || Convert.ToDouble(txtTDS2.Text) > 1) || (Convert.ToDouble(txtTDS3.Text) < 0.1 || Convert.ToDouble(txtTDS3.Text) > 1) || (Convert.ToDouble(txtTDS4.Text) < 0.1 || Convert.ToDouble(txtTDS4.Text) > 1)) { msj = 5; } } else { msj = 7; } } return(msj); }
/// <summary> /// </summary> /// <param name="model"></param> /// <param name="controls"></param> public static void TryUpdateModel(object model, Control.ControlCollection controls) { var modelType = model.GetType(); var property = modelType.GetProperties(); var controlName = string.Empty; var controlNameList = new List <string>(); Control controller = null; foreach (var info in property) { //字符 if (info.PropertyType == typeof(string)) { controlNameList.Clear(); controlNameList.Add(StringPrefix + info.Name); controlNameList.Add(FilePicker + info.Name); controller = GetUniqueControl(controlNameList, controls); if (controller == null) { continue; } if (controller.GetType().FullName == typeof(TextBox).FullName) { info.SetValue(model, ((TextBox)controller).Text); } if (controller.GetType().FullName == typeof(CtlFilePicker).FullName) { info.SetValue(model, ((CtlFilePicker)controller).Text); } } //数字 if (info.PropertyType == typeof(int)) { controlName = IntPrefix + info.Name; controller = GetUniqueControl(controlName, controls); if (controller == null) { continue; } if (controller.GetType().FullName == typeof(NumericUpDown).FullName) { info.SetValue(model, (int)((NumericUpDown)controller).Value); } } if (info.PropertyType == typeof(double)) { controlName = DoublePrefix + info.Name; controller = GetUniqueControl(controlName, controls); if (controller == null) { continue; } if (controller.GetType().FullName == typeof(NumericUpDown).FullName) { info.SetValue(model, (double)((NumericUpDown)controller).Value); } } //布尔 if (info.PropertyType == typeof(bool)) { controlName = BooleanPrefix + info.Name; controller = GetUniqueControl(controlName, controls); if (controller == null) { continue; } if (controller.GetType().FullName == typeof(CheckBox).FullName) { info.SetValue(model, ((CheckBox)controller).Checked); } } } }
internal PageHtmlCacheItem(List<byte> datas, ThreadEntity CurrentThreadEntity) { _originalHtml = datas; _analyzedHtml = new List<byte>(datas); _controlCollection = new Control.ControlAnalyze(_analyzedHtml, CurrentThreadEntity).ControlCollection; }
public void ReplaceControls(IAsyncControls form, Control.ControlCollection controls, CheckedListBox valueControl) { Form = form; ReplaceControl(controls, valueControl, ValueControl); }
/// <summary> /// </summary> /// <param name="model"></param> /// <param name="controls"></param> public static void TryUpdateForm(object model, Control.ControlCollection controls) { var modelType = model.GetType(); var property = modelType.GetProperties(); var controlName = string.Empty; Control controller = null; foreach (var info in property) { //字符 if (info.PropertyType == typeof(string)) { controlName = StringPrefix + info.Name; controller = GetUniqueControl(controlName, controls); if (controller == null) { continue; } if (controller.GetType().FullName == typeof(TextBox).FullName) { ((TextBox)controller).Text = (string)info.GetValue(model); } } //数字 if (info.PropertyType == typeof(int)) { controlName = IntPrefix + info.Name; controller = GetUniqueControl(controlName, controls); if (controller == null) { continue; } if (controller.GetType().FullName == typeof(NumericUpDown).FullName) { ((NumericUpDown)controller).Value = (int)info.GetValue(model); } } //数字 if (info.PropertyType == typeof(double)) { controlName = DoublePrefix + info.Name; controller = GetUniqueControl(controlName, controls); if (controller == null) { continue; } if (controller.GetType().FullName == typeof(NumericUpDown).FullName) { ((NumericUpDown)controller).Value = (decimal)(double)info.GetValue(model); } } //布尔 if (info.PropertyType == typeof(bool)) { controlName = BooleanPrefix + info.Name; controller = GetUniqueControl(controlName, controls); if (controller == null) { continue; } if (controller.GetType().FullName == typeof(CheckBox).FullName) { ((CheckBox)controller).Checked = (bool)info.GetValue(model); } } } }
/// <summary> /// Find all XPanderPanelLists. /// </summary> /// <param name="searchAllChildren">A value indicating whether the FindPanels method loops through all controls.</param> /// <param name="controlsToLookIn">A collection of child controls.</param> /// <returns></returns> public static ArrayList FindPanelLists(bool searchAllChildren, Control.ControlCollection controlsToLookIn) { return(FindControls(typeof(XPanderPanelList), searchAllChildren, controlsToLookIn, new ArrayList())); }
public static void ListControls(Control.ControlCollection controls) { ListControls("Control Collection", controls, false); }
private void XBOptions_Load(object sender, EventArgs e) { if (File.Exists(filename)) { Control.ControlCollection coll = this.Controls; var d = GetAll(this, typeof(TextBox)); var c = GetAll(this, typeof(CheckBox)); string[] options = parse_ini.parse(filename); foreach (string option in options) { foreach (CheckBox col in c) { if (option.Substring(0, option.IndexOf('=')) == (col.Text)) { if (option.Contains("true")) { col.Checked = true; } else if (option.Contains("false")) { col.Checked = false; } } } foreach (TextBox col in d) { if (option.Substring(0, option.IndexOf('=')) == (col.Name)) { if (option.Contains("=")) { col.Text = option.Substring(option.IndexOf("=") + 1); } if (option.Substring(0, option.IndexOf('=')) == "xellbutton") { if (option.Substring(option.IndexOf("=") + 1) == "power") { rbtnPower.Checked = true; } else if (option.Substring(option.IndexOf("=") + 1) == "eject") { rbtnDVD.Checked = true; } else if (option.Substring(option.IndexOf("=") + 1) == "remopower") { rbtnIRp.Checked = true; } else if (option.Substring(option.IndexOf("=") + 1) == "remox") { rbtnIRX.Checked = true; } else if (option.Substring(option.IndexOf("=") + 1) == "winbutton") { rbtnIRW.Checked = true; } else if (option.Substring(option.IndexOf("=") + 1) == "wirelessx") { rbtnWlx.Checked = true; } else if (option.Substring(option.IndexOf("=") + 1) == "wiredx") { rbtnWX.Checked = true; } else if (option.Substring(option.IndexOf("=") + 1) == "kiosk") { rbtnKiosk.Checked = true; } else if (option.Substring(option.IndexOf("=") + 1) == "") { rbtnBlank.Checked = true; } } else if (option.Substring(0, option.IndexOf('=')) == "xellbutton2") { if (option.Substring(option.IndexOf("=") + 1) == "power") { rbtnPower2.Checked = true; } else if (option.Substring(option.IndexOf("=") + 1) == "eject") { rbtnDVD2.Checked = true; } else if (option.Substring(option.IndexOf("=") + 1) == "remopower") { rbtnIRp2.Checked = true; } else if (option.Substring(option.IndexOf("=") + 1) == "remox") { rbtnIRX2.Checked = true; } else if (option.Substring(option.IndexOf("=") + 1) == "winbutton") { rbtnIRW2.Checked = true; } else if (option.Substring(option.IndexOf("=") + 1) == "wirelessx") { rbtnWlx2.Checked = true; } else if (option.Substring(option.IndexOf("=") + 1) == "wiredx") { rbtnWX2.Checked = true; } else if (option.Substring(option.IndexOf("=") + 1) == "kiosk") { rbtnKiosk2.Checked = true; } else if (option.Substring(option.IndexOf("=") + 1) == "") { rbtnBlank2.Checked = true; } } else if (option.Substring(0, option.IndexOf('=')) == "cpufan") { try { trackBar1.Value = Convert.ToInt32(option.Substring(option.IndexOf("=") + 1)); } catch (Exception) { } } else if (option.Substring(0, option.IndexOf('=')) == "gpufan") { try { trackBar2.Value = Convert.ToInt32(option.Substring(option.IndexOf("=") + 1)); } catch (Exception) { } } } } } } }
private void InitialCarbinet(Control.ControlCollection controls, int carbinet_index) { //防止重复操作 if (controls.Count <= 0) //if (this.pictureBox1.Controls.Count <= 0) { //Control.ControlCollection controls = this.pictureBox1.Controls; //货架数目 int numberOfGroup = 1; //整个可用空间的宽度 int widthOfRoom = this.work_width; //隔层的高度 int floorGap = height_of_gap; //总共有多少列 int totalColumns = 10; //总共要分多少列,包括两个货架之间,货架之间的间隔暂时采用和普通列同一宽度的做法 int numberOfUnit = totalColumns + numberOfGroup - 1; // 可以计算出没一列的宽度 int widthOfUnit = widthOfRoom / numberOfUnit; // 货架上的物品区域距离货架左边缘的距离 int groupInitialLeft = 0; //货架距离整个区域的左边缘的距离 int groupWidth = (widthOfRoom - widthOfUnit * (numberOfGroup - 1)) / numberOfGroup; //计算每一个货架的宽度,需要减去货架之间间隔的宽度 //for (int i = 0; i < numberOfGroup; i++) { int numberofColumn = 20;//预设值,之后需要作为参数提取 int numberOfRow = number_of_row; Carbinet group = new Carbinet(controls); //Carbinet group = new Carbinet(this.pictureBox1.Controls); group.Left = groupInitialLeft; group.Top = 0; if (carbinet_index == 0 && this.groups.Count > 0)//保证货架的顺序对应 { this.groups.Insert(0, group); } else { this.groups.Add(group); } //初始化每一排的行 int initialTop = top_of_first_row; for (int irow = 1; irow <= numberOfRow; irow++, initialTop = initialTop + (int)(height_of_row + floorGap)) { CarbinetFloor row = new CarbinetFloor(group, irow, controls); //CarbinetFloor row = new CarbinetFloor(group, irow, this.pictureBox1.Controls); row.Width = groupWidth; row.Height = height_of_row; row.relativeTop = initialTop; row.relativeLeft = this.broadslide_width; group.AddFloor(row); for (int k = 1; k <= numberofColumn; k++) { string _equipmentID = carbinet_index.ToString() + "," + irow.ToString() + "," + k.ToString(); DocumentFile df = new DocumentFile(_equipmentID, irow); df.Width = widthOfUnit; df.Height = height_of_row; df.carbinetIndex = carbinet_index; df.floorNumber = irow; df.columnNumber = k; df.indexBase = "z" + k.ToString("0000"); MemoryTable.unitTable.Rows.Add(new object[] { _equipmentID, "", carbinet_index, irow, "empty", "normal" }); df.Click += new EventHandler(df_Click); group.AddDocFile(df); } } groupInitialLeft += groupWidth + widthOfUnit; } } }
///<summary> /// Constructor for <see cref="ControlCollectionWin"/> ///</summary> ///<param name="col"></param> public ControlCollectionWin(Control.ControlCollection col) { _col = col; }
public Validar.estado_validacion validar_local(Control.ControlCollection controles) { Validar validacion = new Validar(); return(validacion.validar_Form(controles)); }
private void AddValuesToControl(DataSet ds, Control.ControlCollection c) { foreach (Control c1 in c) { if (c1.HasChildren) { if (c1 is Panel) { //(c1 as Panel).BorderStyle = BorderStyle.None; } AddValuesToControl(ds, c1.Controls); } else if (c1.GetType() == typeof(TerraScan.UI.Controls.TerraScanTextBox)) { if (!string.IsNullOrEmpty(c1.Tag.ToString())) { if (ds.Tables[0].Rows.Count > 0) { c1.Text = ds.Tables[0].Rows[0][c1.Tag.ToString()].ToString(); } } } else if (c1.GetType() == typeof(TerraScan.UI.Controls.TerraScanComboBox)) { DataSet dsCombo = new DataSet(); for (int ctrlCount = 0; ctrlCount < this.dataSetCollection.Count; ctrlCount++) { if (this.dataSetCollection[ctrlCount].dataSetName.ToLower().Equals(c1.Tag.ToString().ToLower())) { dsCombo = this.form846022control.WorkItem.RdlToCode_FillCombo(this.dataSetCollection[ctrlCount].commandText); } } ((TerraScan.UI.Controls.TerraScanComboBox)c1).DataSource = dsCombo.Tables[0]; ((TerraScan.UI.Controls.TerraScanComboBox)c1).DisplayMember = dsCombo.Tables[0].Columns[1].ToString(); ((TerraScan.UI.Controls.TerraScanComboBox)c1).ValueMember = dsCombo.Tables[0].Columns[0].ToString(); //((TerraScan.UI.Controls.TerraScanComboBox)c1).SelectedValue = ds.Tables[0].Rows[0][c1.Tag.ToString()].ToString(); if (ds.Tables[0].Rows.Count > 0) { this.SetComboSelectedValue(((TerraScan.UI.Controls.TerraScanComboBox)c1), dsCombo, ds); } } else if (c1.GetType() == typeof(TerraScan.UI.Controls.TerraScanCheckBox)) { if (!string.IsNullOrEmpty(c1.Tag.ToString())) { string result = string.Empty; if (ds.Tables[0].Rows.Count > 0) { result = ds.Tables[0].Rows[0][c1.Tag.ToString()].ToString(); } if (result == "True") { ((CheckBox)c1).Checked = true; } } } else if (c1.GetType() == typeof(RadioButton)) { if (!string.IsNullOrEmpty(c1.Tag.ToString())) { string result = string.Empty; if (ds.Tables[0].Rows.Count > 0) { result = ds.Tables[0].Rows[0][c1.Tag.ToString()].ToString(); } if (c1.AccessibleName.ToString().EndsWith(result)) { ((RadioButton)c1).Checked = true; } } } } }
public void modificar_local(Control.ControlCollection controles) { _BD.auto_modificar(controles, "Locales"); }
internal JPictureBoxItemCollection(JPictureBoxData xpanderPanelList) { this.m_xpanderPanelList = xpanderPanelList; this.m_controlCollection = this.m_xpanderPanelList.Controls; }
/// <summary> /// This is used to bind the controls in the given collection to their associated project properties. /// </summary> /// <param name="controls">The control collection from which to get the bound controls. Controls are /// bound if their <see cref="Control.Tag"/> property is a string that matches a project property.</param> /// <remarks>This method is recursive</remarks> protected void BindProperties(Control.ControlCollection controls) { Type t; PropertyInfo pi; string typeName, boundProperty; try { isBinding = true; foreach(Control c in controls) { t = c.GetType(); typeName = t.FullName; boundProperty = c.Tag as string; // Ignore unbound controls if(String.IsNullOrEmpty(boundProperty)) { // Scan containers too except for user controls unless they are in the custom user control // list. They may or may not represent a single-valued item and we can't process them // reliably. The same could be true of one of these if it is a derived type. if(!customControls.ContainsKey(typeName) && (c is GroupBox || c is Panel || c is TabControl || c is TabPage || c is SplitContainer || customUserControls.Contains(typeName))) { this.BindProperties(c.Controls); continue; } continue; } // Check for custom types first if(customControls.ContainsKey(typeName)) { // Find and connect the Changed event for the named property if one exists var changedEvent = t.GetEvents().Where(ev => ev.Name == customControls[typeName] + "Changed").FirstOrDefault(); if(changedEvent != null) { EventHandler h = new EventHandler(OnPropertyChanged); changedEvent.RemoveEventHandler(c, h); changedEvent.AddEventHandler(c, h); } pi = t.GetProperty(customControls[typeName], BindingFlags.Public | BindingFlags.Instance); } else if(c is TextBoxBase || c is Label) { c.TextChanged -= OnPropertyChanged; c.TextChanged += OnPropertyChanged; pi = t.GetProperty("Text", BindingFlags.Public | BindingFlags.Instance); } else if(c is ComboBox) { ComboBox cbo = (ComboBox)c; cbo.SelectedIndexChanged -= OnPropertyChanged; cbo.SelectedIndexChanged += OnPropertyChanged; if(cbo.DataSource != null) pi = t.GetProperty("SelectedValue", BindingFlags.Public | BindingFlags.Instance); else pi = t.GetProperty("SelectedItem", BindingFlags.Public | BindingFlags.Instance); } else if(c is CheckBox) { CheckBox cb = (CheckBox)c; cb.CheckedChanged -= OnPropertyChanged; cb.CheckedChanged += OnPropertyChanged; pi = t.GetProperty("Checked", BindingFlags.Public | BindingFlags.Instance); } else if((c is DateTimePicker) || (c is UpDownBase) || (c is TrackBar)) { DateTimePicker dtp = c as DateTimePicker; if(dtp != null) { dtp.ValueChanged -= OnPropertyChanged; dtp.ValueChanged += OnPropertyChanged; } else { UpDownBase udc = c as UpDownBase; if(udc != null) { udc.TextChanged -= OnPropertyChanged; udc.TextChanged += OnPropertyChanged; } else { TrackBar tbar = (TrackBar)c; tbar.ValueChanged -= OnPropertyChanged; tbar.ValueChanged += OnPropertyChanged; } } pi = t.GetProperty("Value", BindingFlags.Public | BindingFlags.Instance); } else if(c is CheckedListBox) { CheckedListBox clb = (CheckedListBox)c; clb.ItemCheck -= OnPropertyChanged; clb.ItemCheck += OnPropertyChanged; // Since CheckedListBox is a multi-valued control, the user will have to bind it // in the BindControlValue() method override. They'll have to store it in the // StoreControlValue() method override too. pi = null; } else if(c is ListBox) { ListBox lb = (ListBox)c; lb.SelectedIndexChanged -= OnPropertyChanged; lb.SelectedIndexChanged += OnPropertyChanged; if(lb.DataSource != null) pi = t.GetProperty("SelectedValue", BindingFlags.Public | BindingFlags.Instance); else pi = t.GetProperty("SelectedItem", BindingFlags.Public | BindingFlags.Instance); } else pi = null; // Give the user a chance to handle the control in a custom fashion. If not handled and we // couldn't figure out what to use, ignore it. if(!this.BindControlValue(c) && pi != null) this.Bind(c, pi, boundProperty); } } finally { isBinding = false; } }
private void UpdateControlStatus() { //this.AutoScroll = true; Container = PALWords.Controls; }
private static void RtlApplyToControls(Control.ControlCollection cc) { foreach (Control c in cc) { if (c.Controls.Count > 0) { RtlApplyToControls(c.Controls); } if (c is DateTimePicker) { ((DateTimePicker)c).RightToLeftLayout = true; } else if (c is ListView) { ((ListView)c).RightToLeftLayout = true; } else if (c is MonthCalendar) { ((MonthCalendar)c).RightToLeftLayout = true; } else if (c is ProgressBar) { ((ProgressBar)c).RightToLeftLayout = true; } else if (c is TabControl) { ((TabControl)c).RightToLeftLayout = true; } else if (c is TrackBar) { ((TrackBar)c).RightToLeftLayout = true; } else if (c is TreeView) { ((TreeView)c).RightToLeftLayout = true; } // else if(c is ToolStrip) // RtlApplyToToolStripItems(((ToolStrip)c).Items); /* else if(c is Button) // Also see Label * { * Button btn = (c as Button); * Image img = btn.Image; * if(img != null) * { * Image imgNew = (Image)img.Clone(); * imgNew.RotateFlip(RotateFlipType.RotateNoneFlipX); * btn.Image = imgNew; * } * } * else if(c is Label) // Also see Button * { * Label lbl = (c as Label); * Image img = lbl.Image; * if(img != null) * { * Image imgNew = (Image)img.Clone(); * imgNew.RotateFlip(RotateFlipType.RotateNoneFlipX); * lbl.Image = imgNew; * } * } */ if (IsRtlMoveChildsRequired(c)) { RtlMoveChildControls(c); } } }
/// <summary> /// 保存添加或修改的信息. /// </summary> /// <param name="Sarr">数据表中的所有字段</param> /// <param name="ID1">第一个字段值</param> /// <param name="ID2">第二个字段值</param> /// <param name="Contr">指定控件的数据集</param> /// <param name="BoxName">要搜索的控件名称</param> /// <param name="TableName">数据表名称</param> /// <param name="n">控件的个数</param> /// <param name="m">标识,用于判断是添加还是修改</param> public void Part_SaveClass(string Sarr, string ID1, string ID2, Control.ControlCollection Contr, string BoxName, string TableName, int n, int m) { string tem_Field = "", tem_Value = ""; int p = 2; if (m == 1) //当m为1时,表示添加数据信息 { if (ID1 != "" && ID2 == "") //根据参数值判断添加的字段 { tem_Field = "ID"; tem_Value = "'" + ID1 + "'"; p = 1; } else { tem_Field = "Sut_id,ID"; tem_Value = "'" + ID1 + "','" + ID2 + "'"; } } else if (m == 2) //当m为2时,表示修改数据信息 { if (ID1 != "" && ID2 == "") //根据参数值判断添加的字段 { tem_Value = "ID='" + ID1 + "'"; p = 1; } else { tem_Value = "Sut_ID='" + ID1 + "',ID='" + ID2 + "'"; } } if (m > 0) //生成部份添加、修改语句 { string[] Parr = Sarr.Split(Convert.ToChar(',')); for (int i = p; i < n; i++) { string sID = BoxName + i.ToString(); //通过BoxName参数获取要进行操作的控件名称 foreach (Control C in Contr) //遍历控件集中的相关控件 { if (C.GetType().Name == "TextBox" | C.GetType().Name == "MaskedTextBox" | C.GetType().Name == "ComboBox") { if (C.Name == sID) //如果在控件集中找到相应的组件 { string Ctext = C.Text; if (C.GetType().Name == "MaskedTextBox") //如果当前是MaskedTextBox控件 { Ctext = Date_Format(C.Text); //对当前控件的值进行格式化 } if (m == 1) //组合SQL语句中insert的相关语句 { tem_Field = tem_Field + "," + Parr[i]; if (Ctext == "") { tem_Value = tem_Value + "," + "NULL"; } else { tem_Value = tem_Value + "," + "'" + Ctext + "'"; } } if (m == 2) { //组合SQL语句中update的相关语句 if (Ctext == "") { tem_Value = tem_Value + "," + Parr[i] + "=NULL"; } else { tem_Value = tem_Value + "," + Parr[i] + "='" + Ctext + "'"; } } } } } } ADDs = ""; if (m == 1) //生成SQL的添加语句 { ADDs = "insert into " + TableName + " (" + tem_Field + ") values(" + tem_Value + ")"; } if (m == 2) //生成SQL的修改语句 { if (ID2 == "") //根据ID2参数,判断修改语句的条件 { ADDs = "update " + TableName + " set " + tem_Value + " where ID='" + ID1 + "'"; } else { ADDs = "update " + TableName + " set " + tem_Value + " where ID='" + ID2 + "'"; } } } }
public Screen() { mvarControls = new Control.ControlCollection(this); }
/// <summary> /// 根据控件是否为空组合查询条件. /// </summary> /// <param name="GBox">GroupBox控件的数据集</param> /// <param name="TName">获取信息控件的部份名称</param> /// <param name="TName">查询关系</param> public void Find_Grids(Control.ControlCollection GBox, string TName, string ANDSign) { string sID = ""; //定义局部变量 if (FindValue.Length > 0) { FindValue = FindValue + ANDSign; } foreach (Control C in GBox) //遍历控件集上的所有控件 { if (C.GetType().Name == "TextBox" | C.GetType().Name == "ComboBox") //判断是否要遍历的控件 { if (C.GetType().Name == "ComboBox" && C.Text != "") //当指定控件不为空时 { sID = C.Name; if (sID.IndexOf(TName) > -1) //当TName参数是当前控件名中的部分信息时 { string[] Astr = sID.Split(Convert.ToChar('_')); //用“_”符号分隔当前控件的名称,获取相应的字段名 FindValue = FindValue + "(" + Astr[1] + " = '" + C.Text + "')" + ANDSign; //生成查询条件 } } if (C.GetType().Name == "TextBox" && C.Text != "") //如果当前为TextBox控件,并且控件不为空 { sID = C.Name; //获取当前控件的名称 if (sID.IndexOf(TName) > -1) //判断TName参数值是否为当前控件名的子字符串 { string[] Astr = sID.Split(Convert.ToChar('_')); //以“_”为分隔符,将控件名存入到一维数组中 string m_Sgin = ""; //用于记录逻辑运算符 string mID = ""; //用于记录字段名 if (Astr.Length > 2) //当数组的元素个数大于2时 { mID = Astr[1] + "_" + Astr[2]; //将最后两个元素组成字段名 } else { mID = Astr[1]; //获取当前条件所对应的字段名称 } foreach (Control C1 in GBox) //遍历控件集 { if (C1.GetType().Name == "ComboBox") //判断是否为ComboBox组件 { if ((C1.Name).IndexOf(mID) > -1) //判断当前组件名是否包含条件组件的部分文件名 { if (C1.Text == "") //当查询条件为空时 { break; //退出本次循环 } else { m_Sgin = C1.Text; //将条件值存储到m_Sgin变量中 break; } } } } if (m_Sgin != "") //当该务件不为空时 { FindValue = FindValue + "(" + mID + m_Sgin + C.Text + ")" + ANDSign; //组合SQL语句的查询条件 } } } } } if (FindValue.Length > 0) //当存储查询条的变量不为空时,删除逻辑运算符AND和OR { if (FindValue.IndexOf("AND") > -1) //判断是否用AND连接条件 { FindValue = FindValue.Substring(0, FindValue.Length - 4); } if (FindValue.IndexOf("OR") > -1) //判断是否用OR连接条件 { FindValue = FindValue.Substring(0, FindValue.Length - 3); } } else { FindValue = ""; } }
///<summary> /// Constructs the <see cref="ControlCollectionVWG"/>. This is essentially a wrapper class. ///</summary> ///<param name="col"></param> public ControlCollectionVWG(Control.ControlCollection col) { _col = col; }
public Window() { mvarControls = new Control.ControlCollection(this); CreateHandle(); }