private void btnScanline_Click(object sender, EventArgs e) { if (shapes[choosingShape].type != Shape.shapeType.CIRCLE && shapes[choosingShape].type != Shape.shapeType.ELLIPSE && shapes[choosingShape].controlPoints.Count < 3) { return; } if (choosingShape >= 0 && shapes[choosingShape].fillColor != userColor) { Thread thread = new Thread ( () => ScanlineFiller.Fill(shapes[choosingShape], userColor, ref isShapesChanged) ); thread.IsBackground = true; thread.Start(); } }
private void drawBoard_MouseUp(object sender, MouseEventArgs e) { //Sự kiện "nhả chuột", kết thúc quá trình vẽ if (userType != Shape.shapeType.POLYGON) { isDrawing = false; } if (isTransforming == true) { //Nếu hình có tô màu => tô màu lại if (shapes[choosingShape].fillColor != Color.Black && shapes[choosingShape].fillPoints.Count == 0) { shapes[choosingShape].fillPoints.Clear(); if (shapes[choosingShape].controlPoints.Count < 3) { Thread thread = new Thread ( () => FloodFiller.Fill(shapes[choosingShape], shapes[choosingShape].fillColor, ref isShapesChanged) ); thread.IsBackground = true; thread.Start(); } else { Thread thread = new Thread ( () => ScanlineFiller.Fill(shapes[choosingShape], shapes[choosingShape].fillColor, ref isShapesChanged) ); thread.IsBackground = true; thread.Start(); } } backupShape = shapes[choosingShape].Clone(); isTransforming = false; } }