private void DelImg() { ShapeRange orSh = app.ActiveSelectionRange; ShapeRange img = new ShapeRange(); ShapeRange unColor = new ShapeRange(); orSh.UngroupAll(); foreach (Shape sh in orSh) { if (sh.Type == cdrShapeType.cdrBitmapShape) { img.Add(sh); } else if (sh.Fill.Type == cdrFillType.cdrNoFill && sh.Outline.Type == cdrOutlineType.cdrNoOutline) { unColor.Add(sh); } } img.Delete(); if (unColor.Count > 0) { MessageBoxResult result = MessageBox.Show("Phát hiện viền bế ẩn, bạn có muốn tự động xóa?", "Cảnh báo!", MessageBoxButton.YesNo, MessageBoxImage.Warning); if (result == MessageBoxResult.Yes) { unColor.Delete(); } } }
private void btnDelOutline_Click(object sender, RoutedEventArgs e) { if (checkActive()) { MessageBox.Show(err, "Lỗi", MessageBoxButton.OK, MessageBoxImage.Error); return; } try { ShapeRange orSh = app.ActiveSelectionRange; ShapeRange img = new ShapeRange(); orSh.UngroupAll(); foreach (Shape sh in orSh) { if (sh.Name == "txtOutline") { img.Add(sh); } } img.Delete(); } catch (Exception ex) { MessageBox.Show(ex.Message + "\n" + ex.Source, "Lỗi"); } }