private void OnPrintKeyValueChanged(PropertyChangedFromTextBoxEventArgs property) { BarCodeControl c = (BarCodeControl)property.PrintControl; PropertyModel p = property.Property; TextBox textBox = property.TextBox; DependencyObject d = DependencyHelper.FindVisualChildByName(c, "pText"); if (d != null) { Type t = d.GetType(); if (t == typeof(TextBlock)) { TextBlock r = d as TextBlock; string value = (string)Convert.ChangeType(p.Value, typeof(string)); if (CommonRule.HasChinese(p.Value.ToString())) { p.Value = c.PrintKeyValue; textBox.Text = c.PrintKeyValue; return; } r.Text = value; c.PrintKeyValue = r.Text; } } }
private void OnHeightChanged(PropertyChangedFromTextBoxEventArgs property) { PropertyModel p = property.Property; BarCodeControl c = (BarCodeControl)property.PrintControl; c.Height = (double)Convert.ChangeType(p.Value, typeof(double)); }
private void OnPrintKeyValueChanged(PropertyChangedFromTextBoxEventArgs property) { PropertyModel p = property.Property; Bar2DQRControl c = (Bar2DQRControl)property.PrintControl; c.PrintKeyValue = (string)p.Value; }
private void OnAmplificationChangd(PropertyChangedFromTextBoxEventArgs property) { PropertyModel p = property.Property; Bar2DQRControl c = (Bar2DQRControl)property.PrintControl; int e = (int)Convert.ChangeType(p.Value, typeof(int)); c.MinHeight = c.MaxHeight = c.Height = c.MinWidth = c.MaxWidth = c.Width = e * (1 + c.PrintKeyValue.Length); c.CurrentEnlarge = e; }
private void OnDirecChanged(PropertyChangedFromTextBoxEventArgs property) { PropertyModel p = property.Property; BarCodeControl c = (BarCodeControl)property.PrintControl; RotateTransform r = (RotateTransform)c.RenderTransform; if (r != null) { r.CenterX = c.Width / 2; r.CenterY = c.Height / 2; r.Angle = ((int)p.Value) * 90; } }
private void OnpEYChanged(PropertyChangedFromTextBoxEventArgs property) { TextBox textBox = property.TextBox; PropertyModel p = property.Property; RectangleControl c = (RectangleControl)property.PrintControl; double ex = (double)Convert.ChangeType(p.Value, typeof(double)); if (ex < c.MinHeight + Canvas.GetTop(c)) { ex = c.MinHeight + Canvas.GetTop(c); } c.Height = ex - Canvas.GetTop(c); p.Value = ex; if (textBox != null) { textBox.Text = ex.ToString(); } }
private void OnWidthChanged(PropertyChangedFromTextBoxEventArgs property) { TextBox textBox = property.TextBox; PropertyModel p = property.Property; LineOrControl c = (LineOrControl)property.PrintControl; double ex = (double)Convert.ChangeType(p.Value, typeof(double)); if (ex < c.MinWidth) { ex = c.MinWidth; } c.Width = ex; p.Value = ex; if (textBox != null) { textBox.Text = ex.ToString(); } }
private void OnThicknessChanged(PropertyChangedFromTextBoxEventArgs property) { PropertyModel p = property.Property; RectangleControl c = (RectangleControl)property.PrintControl; PropertyModel thickness = GetPropertyItemByName(c.Propertys, p.Name); if (thickness != null) { DependencyObject d = DependencyHelper.FindVisualChildByName(c, thickness.Name); if (d != null) { Type t = d.GetType(); if (t == typeof(Rectangle)) { Rectangle r = d as Rectangle; r.StrokeThickness = (double)Convert.ChangeType(thickness.Value, typeof(double)); } } } }
/// <summary> /// 高度值改变 /// </summary> /// <param name="property"></param> private void OnHeightChanged(PropertyChangedFromTextBoxEventArgs property) { PropertyModel p = property.Property; TextBox textBox = property.TextBox; TextWorldControl c = (TextWorldControl)property.PrintControl; double ex = (double)Convert.ChangeType(p.Value, typeof(double)); if (ex < c.MinHeight) { ex = c.MinHeight; } double h = c.Height; c.Height = ex; c.Width = c.Width * (c.Height / h); p.Value = ex; if (textBox != null) { textBox.Text = ex.ToString(); } }
private void OnSpinChanged(PropertyChangedFromTextBoxEventArgs property) { PropertyModel p = property.Property; TextWorldControl c = (TextWorldControl)property.PrintControl; int flag = (int)p.Value; RotateTransform r = (RotateTransform)c.RenderTransform; if (r != null) { if (flag < 5) { r.CenterX = 0; r.CenterY = c.Height / 2; r.Angle = (flag - 1) * 90; } else { r.CenterX = c.Width / 2; r.CenterY = c.Height / 2; r.Angle = (flag - 5) * 90; } } }
private void DealWithSpecialPrintControl(ContentControlBase c, PropertyModel p, TextBox textBox = null) { if (p.Name == "pX") { Canvas.SetLeft(c, (double)Convert.ChangeType(p.Value, typeof(double))); return; } if (p.Name == "pY") { Canvas.SetTop(c, (double)Convert.ChangeType(p.Value, typeof(double))); return; } if (p.PropertyChanged != null) { PropertyChangedFromTextBoxEventArgs proerty = new PropertyChangedFromTextBoxEventArgs() { PrintControl = c, TextBox = textBox, Property = p }; p.PropertyChanged(proerty); } }
private void OnTextChanged(PropertyChangedFromTextBoxEventArgs property) { PropertyModel p = property.Property; BarCodeControl c = (BarCodeControl)property.PrintControl; DependencyObject d = DependencyHelper.FindVisualChildByName(c, p.Name); if (d != null) { Type t = d.GetType(); if (t == typeof(TextBlock)) { TextBlock r = d as TextBlock; int i = (int)Convert.ChangeType(p.Value, typeof(int)); if (i == 66) { r.Visibility = Visibility.Visible; } else { r.Visibility = Visibility.Collapsed; } } } }
/// <summary> /// 打印值改变 /// </summary> /// <param name="property"></param> private void OnPrintKeyValueChanged(PropertyChangedFromTextBoxEventArgs property) { PropertyModel p = property.Property; PrintKeyValue = (string)Convert.ChangeType(p.Value, typeof(string)); }
private void OnCodeChanged(PropertyChangedFromTextBoxEventArgs property) { //由于不清楚具体类型条码的样式变化,因此这里不作精准性处理 }