private void List_RowEnter(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex != -1) { try { DataRow[] rows = this.TControls.Select("IsKey =1", ""); foreach (DataRow row in rows) { if (row["Control_Name"] != null && row["Control_Name"].ToString() != "" && row["Control_Name"] != DBNull.Value) { HTextBox co = this.Controls[row["Control_Name"].ToString()] as HTextBox; //hemaily 5Oct2013 if (co.DataType.ToString() != "DateTime") { co.Text = List.Rows[e.RowIndex].Cells[row["Column_name"].ToString()].Value.ToString(); } else { co.Text = Convert.ToDateTime(List.Rows[e.RowIndex].Cells[row["Column_name"].ToString()].Value).ToShortDateString(); } } } this.Controls[NextCodeControl].Text = List.Rows[e.RowIndex].Cells[((HTextBox)this.Controls[NextCodeControl]).FieldName].Value.ToString(); GetRecord(); this.updateButtonsStatus(); } catch (Exception ex) { } } }
void updateHSV() { H = TruncateFloat(hue * 240, 0, 239); S = TruncateFloat(sat * 240, 0, 240); L = TruncateFloat(lig * 240, 0, 240); HTextBox.GetBindingExpression(TextBox.TextProperty).UpdateTarget(); STextBox.GetBindingExpression(TextBox.TextProperty).UpdateTarget(); LTextBox.GetBindingExpression(TextBox.TextProperty).UpdateTarget(); }
private void HTextBox_TextChanged(object sender, TextChangedEventArgs e) { if (!HSVfreez) { RGBfreez = true; if (H >= 240) { H = 239; HTextBox.GetBindingExpression(TextBox.TextProperty).UpdateTarget(); } hue = H / 240.0f; ChangeHSV(); updateRGB(); buttonColor.Background = new SolidColorBrush(Color.FromRgb(R, G, B)); RGBfreez = false; } }
public frmSmallSearch(HTextBox textboxSearch) { InitializeComponent(); ht = textboxSearch; if (ht._SearchTable != null) { sql = "Select "; string[] column = ht._SearchFields.Split('&'); foreach (string a in column) { field.Add(a.Split(':')[0], a.Split(':')[1]); sql += " " + a.Split(':')[0] + ","; } sql = sql.Remove(sql.Length - 1); sql += " from " + ht._SearchTable + " where 1=1 "; //----------------- #region SearchFilter ABUBAKR 10 Sept 2013 if (txtSearchfor.Text.Trim() != "" && ht._SearchFilter != null && ht._SearchFilter != "") { sql += " and " + ht._SearchFilter; } #endregion string NotActivesql = @" SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE (TABLE_NAME = '" + ht._SearchTable + @"') and COLUMN_NAME = 'NotActive' "; DataTable dt = DataLayer.executeDataTable(NotActivesql); if (dt.Rows.Count != 0) { sql += " and isnull( NotActive ,0) =0"; } dt = DataLayer.executeDataTable(sql); grid.DataSource = dt; foreach (DataGridViewColumn col in grid.Columns) { col.HeaderText = field[col.Name]; } } }
void SetCross(Point p) { CrossTranslate.X = p.X / image1.ActualWidth; CrossTranslate.Y = p.Y / image1.ActualWidth; if (!HSVfreez) { RGBfreez = true; hue = (float)CrossTranslate.X; sat = 1 - (float)CrossTranslate.Y; if (hue < 0.001) { hue = 0.001f; } if (sat < 0.001) { sat = 0.001f; } if (hue >= 1) { hue = 0.999f; } if (sat >= 1) { sat = 0.999f; } H = (byte)(hue * 240); S = (byte)(sat * 240); HSVfreez = true; HTextBox.GetBindingExpression(TextBox.TextProperty).UpdateTarget(); STextBox.GetBindingExpression(TextBox.TextProperty).UpdateTarget(); HSVfreez = false; ChangeHSV(); updateRGB(); buttonColor.Background = new SolidColorBrush(Color.FromRgb(R, G, B)); GradientStop.Color = GetMaxColor(); RGBfreez = false; } }