Article | 60001021 |
Type | Wish |
Product | Engine |
Version | 6016 |
Date Added | 12/3/2009 |
Fixed | Yes [12/4/2009] |
Submitted by | Rahul Singh |
Keywords |
vdImageDef
imagedef = doc.Images.Add(@"C:\Documents and Settings\Administrator\Desktop\Temp\jblake.jpg"); // use an image here from your disk vdRect curve = new vdRect();curve.SetUnRegisterDocument(doc);
curve.setDocumentDefaults();
curve.InsertionPoint =
new gPoint(-2, -2);curve.Width = 5;
curve.Height = 1.2;
//curve.Rotation = Globals.HALF_PI / 2.0d; //get the sample points in entity Coordinate System gPoints pts = curve.GetSamplePoints(0, 0); //get the bounding box in entity Coordinate System Box box = pts.GetBox(); //Set the rectangle to be solid fillcurve.HatchProperties =
new vdHatchProperties(VectorDraw.Professional.Constants.VdConstFill.VdFillModeSolid); //select a new color for the rectangle whitch is used to fill the region vdColor col = new vdColor(vdColor.ColorType.ByColor); col.SystemColor = Color.Blue; //attach material image to the filled color.col.MaterialImage = imagedef;
//select the material matrix used to tranform the texture image Matrix mat = new Matrix(); //set the texture image scaling in order the texture bitmap to be 1 Drawing Unit widthmat.ScaleMatrix(1.0d, (
double)imagedef.Height / (double)imagedef.Width, 1.0d); //In order to stretch and fit the image in the rectangle use the following scale instead. // mat.ScaleMatrix(box.Width, box.Height, 1.0d); //Set the rotation 45 degrees in counterclockwise direction //mat.RotateZMatrix(Globals.HALF_PI / 2.0d); //set the origin of the texture to be LowerLeft corner of rectangle in rectangle Entitiy CSmat.TranslateMatrix(box.Max );
//finally we set the Material matrix for the selected fill color.col.MaterialMatrix = mat.GetInvertion();
curve.PenColor = col;
//finally add the entitity to ActiveLayout entities collectiondoc.ActiveLayOut.Entities.AddItem(curve);
//update the drawing are of the rectanglecurve.Invalidate();