0

i have a problem with the WPF VisualBrush. Here you find two images from my application. The bigger on is a image which shows a control with text. The smaller one is a extract from the first on who i use a visual brush to make it. My problem is, that when the resolution of my Visual (the content for VisualBrush) would be smaller then the visual brush looks more blurred. I don't no why. I use the following code to declare the visual brush.

 var blendBrush = new VisualBrush
        {
            Visual = Host.Viewer,
            TileMode = TileMode.None,
            AlignmentX = AlignmentX.Left,
            AlignmentY = AlignmentY.Top,
            Stretch = Stretch.None,
            ViewboxUnits = BrushMappingMode.Absolute,
        };

Host.Viewer is the control you see it on the big image. Everytime the control size is changed i update the ViewBox values with the following routine:

var viewBox = new System.Windows.Rect(topLeft, new Size(width, height));
        visualBrush.Viewbox = viewBox;

topLeft is the start coordinates and the width and height values are the size of extract i needed. I hope anyone can help how i can prevent that the control would be blurry!

Thanks Daniel

4

1 回答 1

1

好的,我发现了问题。Host.Viewer在深处包含一个包含图像对象的画布。在 .NET 4.0 及更高版本中,图像可能看起来很模糊。该问题可以解决为设置和UseLayoutRounding = true;Rootparent对象。BitmapScalingMode = BitmapScalingMode.NearestNeighbor;Canvas

于 2014-09-22T13:44:14.723 回答