填充的部分代码
currRectangle = txtUserViewCtrl.RasterImageEditView.SourceRectangle;
txtUserViewCtrl.RasterImageEditView.BeginUpdate();
var t = new Transformer(txtUserViewCtrl.RasterImageEditView.Transform);
currRectangle = Rectangle.Round(t.RectangleToLogical(currRectangle));
currRectangle=ConvertRect(txtUserViewCtrl.RasterImageEditView.Image.RectangleToImage(RasterViewPerspective.TopLeft, ConvertRect(currRectangle)));
RectangleF imageRectangle = new RectangleF(PointF.Empty, new SizeF(txtUserViewCtrl.RasterImageEditView.ImageSize.Width, txtUserViewCtrl.RasterImageEditView.ImageSize.Height));
using (var container = new RasterImageGdiPlusGraphicsContainer(txtUserViewCtrl.RasterImageEditView.Image))
{
using (var path = new GraphicsPath())
{
path.AddRectangle(currRectangle);
using (Brush brush = new SolidBrush(Color.White))
{
container.Graphics.FillPath(brush, path);
}
path.Dispose();
}
container.Dispose();
}
txtUserViewCtrl.RasterImageEditView.EndUpdate();
public static Rectangle ConvertRect(LeadRect rc)
{
return Rectangle.FromLTRB(rc.Left, rc.Top, rc.Right, rc.Bottom);
}
下面图是框选 填充的结果,就是填充不完整
|