我正在尝试绘制一个具有在另一个类中定义的属性的矩形。
我的问题是,如何在main / form1.cs的图片框中绘制它。
我在C#中对OOP感到很挣扎。
请帮助我。
形状类别:
public Layer DrawRectangle(Layer.Type RectangleType, int Width, int Height, int StrokeThickness, int CornerRadius)
{
this.draw.pboxGraphics.Clear(Color.White);
float width = (Width * this.draw.value) - StrokeThickness;
float height = (Height * this.draw.value) - StrokeThickness;
float x = (this.draw.centerPoint.X - (width / 2f)) - 0.5f;
this.layerSize = new SizeF(width, height);
this.layerLocation = new PointF(x, ((this.draw.centerPoint.Y - (height / 2f)) - 0.5f) + this.draw.offset);
Pen pen = new Pen(Brushes.Red) {Width = StrokeThickness};
RectangleF rect = new RectangleF(this.layerLocation, this.layerSize);
this.draw.pboxGraphics.SmoothingMode = SmoothingMode.AntiAlias;
return new Layer(RectangleType, this.layerSize, new PointF(this.layerLocation.X, this.layerLocation.Y - this.draw.offset), Width, Height, this.activeWidth, this.activeHeight, StrokeThickness,bothScale,widthScale, heightScale,widthScaleRatio,heightScaleRatio);
}