PNG图像在WPF代码中增加相机距离时变为透明

时间:2013-05-11 12:53:00

标签: wpf wpftoolkit wpf-4.0

我已将png Image设置为Rectangle的画笔背景,并将矩形设置为Vieport3D组。

但是当我试图增加相机的距离时,图像变得透明。但是这个问题在XP中只面对windows7才能正常工作

PointCollection pc = new PointCollection();
        Uri url = new Uri(@"Model/somefile.png", UriKind.Relative);

        BitmapImage bmpimg = new BitmapImage();
        bmpimg.BeginInit();
        bmpimg.UriSource = url;
        bmpimg.CacheOption = BitmapCacheOption.OnLoad;
        bmpimg.EndInit();


        ImageBrush BrushView = new ImageBrush(bmpimg);
        BrushView.TileMode = TileMode.Tile;
        BrushView.Stretch = Stretch.Fill;
        Material MaterialView = new DiffuseMaterial(BrushView);
        MeshGeometry3D mesh_light = new MeshGeometry3D();

        double Zdeep = -40;
        double x = -110;
        double y = -45;
        double xEnd = 110;
        double yEnd = 90;


        // Draw rectangle and set Image to Mash geometry 
        //pc.makeRectangle(mesh_light, new Point3D(x, y, Zdeep), new Point3D(x + xEnd, y, Zdeep), new Point3D(x + xEnd, yEnd, Zdeep), new Point3D(x, yEnd, Zdeep), new Point(0, 0), new Point(0, 1), new Point(1, 1), new Point(1, 0));
        pc.makeRectangle(mesh_light, new Point3D(x, yEnd, Zdeep), new Point3D(x, y, Zdeep), new Point3D(xEnd, y, Zdeep), new Point3D( xEnd, yEnd, Zdeep), new Point(0, 0), new Point(0, 1), new Point(1, 1), new Point(1, 0));
        GeometryModel3D LightGeometry = new GeometryModel3D(mesh_light, MaterialView);
        group.Children.Add(LightGeometry);

这里当我设置双Zdeep = 0;它看起来很好,但如果我使用双Zdeep = -40;这个值然后图像变得透明

0 个答案:

没有答案