Thank you very much for your answer, Lyubo. Do you say "please make sure the ShapeNode.Locked property is set to false" refers to setting imageNode.Locked and overlayNode.Locked to false? Also, I do n’t quite understand what you said about “The visual effect of covering the background node in NodeModfied handler is invalid to update the transparent layer”. Is there any sample code? cs: private void ImageManipulation(string path) { var myImage = new BitmapImage(new Uri(path, UriKind.Relative)); var imageWidthPx = myImage.PixelWidth * GetScreenDpi() / myImage.DpiX; var imageHeightPx = myImage.PixelHeight * GetScreenDpi() / myImage.DpiY; var imageWidth = GraphicsUnit.Pixel.Convert(imageWidthPx, diagram.MeasureUnit); var imageHeight = GraphicsUnit.Pixel.Convert(imageHeightPx, diagram.MeasureUnit);
imageNode = diagram.Factory.CreateShapeNode(0, 0, imageWidth, imageHeight); imageNode.Image = myImage; imageNode.Shape = Shapes.Rectangle; imageNode.CustomDraw = CustomDraw.Additional; imageNode.ImageAlign = ImageAlign.Fit; //overlayNode = diagram.Factory.CreateShapeNode(0, 0, 150, 150); var overlayNodeWidth = 100; var overlayNodeHeight = 100;
overlayNode = diagram.Factory.CreateShapeNode(imageNode.Bounds.Right - overlayNodeWidth, imageNode.Bounds.Bottom - overlayNodeHeight, overlayNodeWidth, overlayNodeHeight); overlayNode.Shape = Shapes.Rectangle; overlayNode.Brush = Brushes.Transparent; overlayNode.StrokeThickness = 0.8; overlayNode.Stroke = new SolidColorBrush(Color.FromArgb(120, 12, 236, 13)); overlayNode.Locked = true; overlayNode.AttachTo(imageNode, AttachToNode.BottomRight); }
|