Class WmfSelectObject

Class WmfSelectObject

nazivni prostor: Aspose.Imaging.FileFormats.Wmf.Objects Sastav: Aspose.Imaging.dll (25.4.0)

odabranog objekta.

public class WmfSelectObject : WmfObject

Inheritance

object MetaObject WmfObject WmfSelectObject

naslijeđeni članovi

object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()

Constructors

WmfSelectObject(WmfGraphicObject)

Inicijalizira novu primjenu Aspose.Imaging.FileFormats.Wmf.Objects.

public WmfSelectObject(WmfGraphicObject wmfObject)

Parameters

wmfObject WmfGraphicObject

To je WMF objekat.

WmfSelectObject()

Inicijalizira novu primjenu Aspose.Imaging.FileFormats.Wmf.Objects.

public WmfSelectObject()

Examples

Sljedeći primjer pokazuje kako postaviti boju pozadine za WMF. U stvari, on povlači pravokut boje pozadina prije nego što crte sve ostale predmete.

string dir = "c:\\aspose.imaging\\issues\\net\\3280\\";
                                                                                                                                                                    string inputFilePath = dir + "image2.wmf";
                                                                                                                                                                    string outputFilePath = dir + "ChangeBackground_" + "image2.wmf";

                                                                                                                                                                    using (Aspose.Imaging.FileFormats.Emf.MetaImage image = (Aspose.Imaging.FileFormats.Emf.MetaImage)Aspose.Imaging.Image.Load(inputFilePath))
                                                                                                                                                                    {
                                                                                                                                                                        AddBackgroundRectangleWmf((Aspose.Imaging.FileFormats.Wmf.WmfImage)image, Aspose.Imaging.Color.Blue);
                                                                                                                                                                        image.Save(outputFilePath);
                                                                                                                                                                    }

                                                                                                                                                                    /// <summary>
                                                                                                                                                                    /// Helper method to change WMF background. 
                                                                                                                                                                    /// </summary>
                                                                                                                                                                    public static void AddBackgroundRectangleWmf(Aspose.Imaging.FileFormats.Wmf.WmfImage image, Aspose.Imaging.Color color)
                                                                                                                                                                    {
                                                                                                                                                                        image.CacheData();
                                                                                                                                                                        if (image.Records.Count &lt; 1)
                                                                                                                                                                        {
                                                                                                                                                                            return;
                                                                                                                                                                        }

                                                                                                                                                                        //Set Rectangle
                                                                                                                                                                        Aspose.Imaging.FileFormats.Wmf.Objects.WmfRectangle rectangle = new Aspose.Imaging.FileFormats.Wmf.Objects.WmfRectangle();
                                                                                                                                                                        rectangle.Rectangle = image.FrameBounds;

                                                                                                                                                                        //Set Brush
                                                                                                                                                                        Aspose.Imaging.FileFormats.Wmf.Objects.WmfCreateBrushInDirect brush = new Aspose.Imaging.FileFormats.Wmf.Objects.WmfCreateBrushInDirect();
                                                                                                                                                                        brush.LogBrush = new Aspose.Imaging.FileFormats.Emf.Emf.Objects.EmfLogBrushEx();
                                                                                                                                                                        brush.LogBrush.Argb32ColorRef = color.ToArgb();

                                                                                                                                                                        //Select brush
                                                                                                                                                                        Aspose.Imaging.FileFormats.Wmf.Objects.WmfSelectObject selectObject = new Aspose.Imaging.FileFormats.Wmf.Objects.WmfSelectObject(brush);

                                                                                                                                                                        //Remove brush
                                                                                                                                                                        Aspose.Imaging.FileFormats.Wmf.Objects.WmfDeleteObject deleteObject = new Aspose.Imaging.FileFormats.Wmf.Objects.WmfDeleteObject(brush);

                                                                                                                                                                        //Add records
                                                                                                                                                                        image.Records.Insert(0, brush);
                                                                                                                                                                        image.Records.Insert(1, selectObject);
                                                                                                                                                                        image.Records.Insert(2, rectangle);
                                                                                                                                                                        image.Records.Insert(3, deleteObject);
                                                                                                                                                                    }

Properties

ObjectIndex

Pronađite ili postavite indeks objekta.

public int ObjectIndex { get; set; }

Vrijednost nekretnina

int

 Hrvatski