private void _btnOk_Click(object sender, System.EventArgs e) { Type = (HalfToneCommandType)Constants.GetValueFromName( typeof(HalfToneCommandType), (string)_cbType.SelectedItem, _initialType); Angle = (int)_numAngle.Value * 100; Dimension = (int)_numDimension.Value; _initialType = Type; _initialAngle = Angle; _initialDimension = Dimension; }
private void HalftoneDialog_Load(object sender, System.EventArgs e) { if (_firstTimer) { _firstTimer = false; HalfToneCommand command = new HalfToneCommand(); _initialType = command.Type; _initialAngle = command.Angle; _initialDimension = command.Dimension; } Type = _initialType; Angle = _initialAngle / 100; Dimension = _initialDimension; Tools.FillComboBoxWithEnum(_cbType, typeof(HalfToneCommandType), Type, new object[] { HalfToneCommandType.UserDefined }); UpdateMyControls(); }
private void UpdateMyControls( ) { HalfToneCommandType t = (HalfToneCommandType)Constants.GetValueFromName( typeof(HalfToneCommandType), (string)_cbType.SelectedItem, _initialType); bool noAngle = t == HalfToneCommandType.Rectangular || t == HalfToneCommandType.Circular || t == HalfToneCommandType.Random; _numAngle.Enabled = !noAngle; bool noDimension = t == HalfToneCommandType.View || t == HalfToneCommandType.Print; _numDimension.Enabled = !noDimension; }