private void sliderSize_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e) { int size = (int)sliderSize.Value; DrawArea.LineWidth = size; int x = DrawArea.TheLayers.ActiveLayerIndex; int n = DrawArea.TheLayers[x].Graphics.SelectionCount; if (n > 0) { n = DrawArea.TheLayers[x].Graphics.Count; for (int i = 0; i < n; i++) { if (DrawArea.TheLayers[x].Graphics[i].Selected == true) { DrawArea.CurrentPen = TypeOfPen.SetCurrentPen(DrawArea.PenType, DrawArea.LineColor, DrawArea.LineWidth); DrawObject obj = DrawArea.TheLayers[x].Graphics[i]; obj.PenType = DrawArea.PenType; obj.DrawPen = DrawArea.CurrentPen; obj.PenWidth = DrawArea.LineWidth; DrawArea.TheLayers[x].Graphics.Replace(i, obj); } } DrawArea.Refresh(); } }
private void lsbForeground_SelectedColorChanged(object sender, RoutedPropertyChangedEventArgs <System.Windows.Media.Color?> e) { System.Windows.Media.Color ForeColor = (System.Windows.Media.Color)lsbForeground.SelectedColor; DrawArea.LineColor = System.Drawing.Color.FromArgb(ForeColor.A, ForeColor.R, ForeColor.G, ForeColor.B); int x = DrawArea.TheLayers.ActiveLayerIndex; int n = DrawArea.TheLayers[x].Graphics.SelectionCount; if (n > 0) { n = DrawArea.TheLayers[x].Graphics.Count; for (int i = 0; i < n; i++) { if (DrawArea.TheLayers[x].Graphics[i].Selected == true) { DrawArea.CurrentPen = TypeOfPen.SetCurrentPen(DrawArea.PenType, DrawArea.LineColor, DrawArea.LineWidth); DrawObject obj = DrawArea.TheLayers[x].Graphics[i]; obj.Color = DrawArea.LineColor; obj.PenType = DrawArea.PenType; obj.DrawPen = DrawArea.CurrentPen; DrawArea.TheLayers[x].Graphics.Replace(i, obj); } } DrawArea.Refresh(); } }
public DrawPencil(int x1, int y1, int x2, int y2, Color lineColor, int lineWidth, TypeOfPen.PenType p) { pointArray = new ArrayList(); pointArray.Add(new Point(x1, y1)); pointArray.Add(new Point(x2, y2)); PenType = p; Color = lineColor; PenWidth = lineWidth; DrawPen = TypeOfPen.SetCurrentPen(PenType, Color, PenWidth); LoadCursor(); Initialize(); }
public DrawLine(int x1, int y1, int x2, int y2, Color lineColor, int lineWidth, TypeOfPen.PenType p) { startPoint.X = x1; startPoint.Y = y1; endPoint.X = x2; endPoint.Y = y2; Color = lineColor; PenWidth = lineWidth; PenType = p; DrawPen = TypeOfPen.SetCurrentPen(PenType, Color, PenWidth); ZOrder = 0; Initialize(); }
public DrawEllipse(int x, int y, int width, int height, Color lineColor, int lineWidth, TypeOfPen.PenType pType, Color fillColor, Image fillImage, bool filled, bool gradient, bool hatch, bool texture) { Rectangle = new Rectangle(x, y, width, height); Center = new Point(x + (width / 2), y + (height / 2)); PenType = pType; Color = lineColor; PenWidth = lineWidth; PenType = pType; DrawPen = TypeOfPen.SetCurrentPen(PenType, Color, PenWidth); FillColor = fillColor; FillImage = fillImage; Filled = filled; Gradient = gradient; Hatch = hatch; Texture = texture; Initialize(); }
public DrawRectangle(int x, int y, int width, int height, Color lineColor, int lineWidth, TypeOfPen.PenType pType, Color fillColor, Image fillImage, bool filled, bool gradient, bool hatch, bool texture) { Center = new Point(x + (width / 2), y + (height / 2)); rectangle.X = x; rectangle.Y = y; rectangle.Width = width; rectangle.Height = height; PenType = pType; Color = lineColor; PenWidth = lineWidth; DrawPen = TypeOfPen.SetCurrentPen(PenType, Color, PenWidth); FillColor = fillColor; FillImage = fillImage; Gradient = gradient; Filled = filled; Hatch = hatch; Texture = texture; }
private void cbxDashArrow_Checked(object sender, RoutedEventArgs e) { DrawArea.PenType = TypeOfPen.PenType.DashArrow; DrawArea.CurrentPen = TypeOfPen.SetCurrentPen(TypeOfPen.PenType.DashArrow, DrawArea.LineColor, DrawArea.LineWidth); int x = DrawArea.TheLayers.ActiveLayerIndex; int n = DrawArea.TheLayers[x].Graphics.SelectionCount; if (n > 0) { n = DrawArea.TheLayers[x].Graphics.Count; for (int i = 0; i < n; i++) { if (DrawArea.TheLayers[x].Graphics[i].Selected == true) { DrawObject obj = DrawArea.TheLayers[x].Graphics[i]; obj.PenType = TypeOfPen.PenType.DashArrow; obj.DrawPen = DrawArea.CurrentPen; DrawArea.TheLayers[x].Graphics.Replace(i, obj); } } DrawArea.Refresh(); } }
public virtual void LoadFromStream(SerializationInfo info, int orderNumber, int objectData) { int n = info.GetInt32( String.Format(CultureInfo.InvariantCulture, "{0}{1}-{2}", entryColor, orderNumber, objectData)); Color = Color.FromArgb(n); PenWidth = info.GetInt32( String.Format(CultureInfo.InvariantCulture, "{0}{1}-{2}", entryPenWidth, orderNumber, objectData)); PenType = (TypeOfPen.PenType)info.GetValue( String.Format(CultureInfo.InvariantCulture, "{0}{1}-{2}", entryPen, orderNumber, objectData), typeof(TypeOfPen.PenType)); n = info.GetInt32( String.Format(CultureInfo.InvariantCulture, "{0}{1}-{2}", entryFillColor, orderNumber, objectData)); FillColor = Color.FromArgb(n); FillImage = (Bitmap)info.GetValue( String.Format(CultureInfo.InvariantCulture, "{0}{1}-{2}", entryFillImage, orderNumber, objectData), typeof(Bitmap)); Filled = info.GetBoolean( String.Format(CultureInfo.InvariantCulture, "{0}{1}-{2}", entryFilled, orderNumber, objectData)); Gradient = info.GetBoolean( String.Format(CultureInfo.InvariantCulture, "{0}{1}-{2}", entryGradient, orderNumber, objectData)); Hatch = info.GetBoolean( String.Format(CultureInfo.InvariantCulture, "{0}{1}-{2}", entryHatch, orderNumber, objectData)); Texture = info.GetBoolean( String.Format(CultureInfo.InvariantCulture, "{0}{1}-{2}", entryTexture, orderNumber, objectData)); ZOrder = info.GetInt32( String.Format(CultureInfo.InvariantCulture, "{0}{1}-{2}", entryZOrder, orderNumber, objectData)); Rotation = info.GetInt32( String.Format(CultureInfo.InvariantCulture, "{0}{1}-{2}", entryRotation, orderNumber, objectData)); if (PenType != TypeOfPen.PenType.Normal) { DrawPen = TypeOfPen.SetCurrentPen(PenType, Color, PenWidth); } }