public static bool IsAnyOfTheseTypes(this operatorType ct, params operatorType[] types) { foreach (var type in types) { if (type == (ct & type)) { return(true); } } return(false); }
private void OnMouseLeftButtonUp(object sender, MouseButtonEventArgs e) { if (mOperatorType == operatorType.Add) { FinishOther(); } else if (mOperatorType == operatorType.Move) { canvas1.UpdateLayout(); } mShapeName = shapeName.Empty; mOperatorType = operatorType.Empty; }
private void mTextBox_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { mSelectShape = e.Source; TextBox mTextBox = e.Source as TextBox; //mMouseDownPoint = new Point(Canvas.GetLeft(mTextBox), Canvas.GetTop(mTextBox)); //mMouseDownPoint = e.MouseDevice.NonRelativePosition; mPointCollection.Add(mMouseDownPoint); //mMouseDownPoint=e.MouseDevice.GetPosition(sender As TextBox ); //mTextBox.FontSize = 12; //mTextBox.FontStyle = FontStyles.Italic; //mTextBox.Foreground = new SolidColorBrush(Colors.Red); mOperatorType = operatorType.Empty; }
private void OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { mMouseDownPoint = e.GetPosition(canvas1); mPointCollection.Clear(); /*只记录选中的绘图元素*/ switch ((Int32)Enum.Parse(typeof(shapeName), e.Source.GetType().Name)) { case (Int32)shapeName.Ellipse: mSelectShape = e.Source; break; case (Int32)shapeName.Rectangle: mSelectShape = e.Source; break; case (Int32)shapeName.Line: Line mLine = e.Source as Line; mPointCollection.Add(new Point(mLine.X1, mLine.Y1)); mPointCollection.Add(new Point(mLine.X2, mLine.Y2)); mSelectShape = e.Source; mOperatorType = operatorType.Move; break; case (Int32)shapeName.Polyline: mPointCollection = (e.Source as Polyline).Points.Clone(); mSelectShape = e.Source; mOperatorType = operatorType.Move; break; case (Int32)shapeName.TextBox: /*输入框额外处理*/ break; default: mSelectShape = null; if (InitOther() > 0) { mOperatorType = operatorType.Add; } break; } }
public ParsedOperator(string Data, tokenType TokenType, operatorType OperatorType) : base(Data, TokenType) { this.OperatorType = OperatorType; }