public HRegion DisplayMaksHRegion() { if (MaskRegion == null || MaskRegion.Area < 10) { return(null); } MaskRegion.SmallestRectangle1(out row1, out col1, out row2, out col2); HRegion gridRegion = new HRegion(); gridRegion.GenGridRegion(10, 10, "points", col2 - col1, row2 - row1); HRegion move = gridRegion.MoveRegion(row1, col1); gridRegion.Dispose(); HRegion dispGridRegion = move.Intersection(MaskRegion); move.Dispose(); return(dispGridRegion); }