void SetTriangle(float Y) { TriangleTransform.Y = Y; if (!HSVfreez) { RGBfreez = true; lig = (1 - Y / 189); if (lig < 0.001) { lig = 0.001f; } if (lig >= 1) { lig = 0.999f; } L = (byte)(lig * 240); HSVfreez = true; LTextBox.GetBindingExpression(TextBox.TextProperty).UpdateTarget(); HSVfreez = false; ChangeHSV(); updateRGB(); buttonColor.Background = new SolidColorBrush(Color.FromRgb(R, G, B)); RGBfreez = false; } }
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 LTextBox_TextChanged(object sender, TextChangedEventArgs e) { if (!HSVfreez) { RGBfreez = true; if (L > 240) { L = 240; LTextBox.GetBindingExpression(TextBox.TextProperty).UpdateTarget(); } lig = L / 240.0f; ChangeHSV(); updateRGB(); buttonColor.Background = new SolidColorBrush(Color.FromRgb(R, G, B)); RGBfreez = false; } }
public Panel addJb(int rowNo, DataTable dtList) { Panel panelDemo = new Panel(); panelDemo.Name = "jb" + rowNo.ToString(); panelDemo.Location = new Point(0, 0); //panelDemo.Dock = DockStyle.Fill; panelDemo.AutoSize = true; CheckBox check_tem = new CheckBox(); check_tem.Width = 0; int x = 5, y = 0; for (int i = 0; i < dtList.Rows.Count; i++) { x = x + check_tem.Width + 5; if (i == 5) { LTextBox ltextbox = new LTextBox(); ltextbox.Name = "text_" + rowNo.ToString() + "_" + "EXZL"; ltextbox.Location = new Point(x, y); ltextbox.LineType = LTextBox.BorderType.Bottom; ltextbox.LineColor = Color.Black; ltextbox.Width = 150; panelDemo.Controls.Add(ltextbox); // 增加 录入框 换行 x = 5; y = y + 30; } else if (i == 11) { LTextBox ltextbox = new LTextBox(); ltextbox.Name = "text_" + rowNo.ToString() + "_" + "zybqt"; ltextbox.Location = new Point(x, y); ltextbox.LineColor = Color.Black; ltextbox.LineType = LTextBox.BorderType.Bottom; ltextbox.Width = 150; panelDemo.Controls.Add(ltextbox); // 增加 录入框 换行 x = 5; y = y + 30; } CheckBox check = new CheckBox(); check.AutoSize = true; check.Name = "chk_" + rowNo.ToString() + "_" + dtList.Rows[i]["value"].ToString(); check.Text = dtList.Rows[i]["name"].ToString(); check.Tag = dtList.Rows[i]["value"].ToString(); //check.BackColor = Color.Red; check.Location = new Point(x, y); check_tem = check; panelDemo.Controls.Add(check); } x = x + check_tem.Width + 5; LTextBox ltextbox1 = new LTextBox(); ltextbox1.Name = "text_" + rowNo.ToString() + "_" + "JBQT"; ltextbox1.Location = new Point(x, y); ltextbox1.LineColor = Color.Black; ltextbox1.LineType = LTextBox.BorderType.Bottom; ltextbox1.Width = 150; panelDemo.Controls.Add(ltextbox1); //确诊时间 x = 5; y = y + 30; Label label = new Label(); label.Text = "确诊时间"; label.Location = new Point(x, y); label.AutoSize = true; panelDemo.Controls.Add(label); x = x + label.Width + 5; DateTimePicker datetimepicker = new DateTimePicker(); datetimepicker.Location = new Point(x, y); datetimepicker.Name = "dtp_" + rowNo.ToString() + "_" + "D_ZDRQ"; datetimepicker.Width = 150; panelDemo.Controls.Add(datetimepicker); return(panelDemo); }