bc... []

Tab.cs ( File view )

  • By maninwest 2015-02-10
  • View(s):24
  • Download(s):0
  • Point(s): 1
			using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Media3D;
using Bornander.Wpf.Meshes;

namespace Bornander.UI.TabCarousel
{

    class Tab
    {

        private readonly Material visualHostMaterial;
        private readonly MeshGeometry3D boxMesh;
        private readonly MeshGeometry3D visualMesh;

        private Viewport2DVisual3D front;
        private ModelVisual3D back;

        private FrameworkElement element;

        private double depth;

        public ModelVisual3D Model {
 get; private set; 
}

        public Tab(FrameworkElement element, Color color, double depth)
        {

            this.element = element;
            this.depth = depth;

            visualHostMaterial = new DiffuseMaterial(Brushes.White);
            visualHostMaterial.SetValue(Viewport2DVisual3D.IsVisualHostMaterialProperty, true);

            boxMesh = Box.CreateBoxMesh(1, 1, depth, Box.Side.Right | Box.Side.Left | Box.Side.Top | Box.Side.Bottom | Box.Side.Back);
            visualMesh = Box.CreateBoxMesh(1, 1, depth, Box.Side.Front);


            front = new Viewport2DVisual3D 
            {
 
                Geometry = visualMesh, 
                Visual = element, 
                Material = visualHostMaterial 
            
};


            back = new ModelVisual3D
            {

                Content = new GeometryModel3D
                {

                    Geometry = boxMesh,
                    Material = new DiffuseMaterial(Brushes.CadetBlue),
                
}
            
};

            Model = new ModelVisual3D();

            Model.Children.Add(back);
            Model.Children.Add(front);
        
}

        public void UpdateTransform(int index, double angle, double radius)
        {

            TranslateTransform3D translaslation = new TranslateTransform3D(0, 0, radius - depth / 2.0);
            RotateTransform3D rotation = new RotateTransform3D(new AxisAngleRotation3D(new Vector3D(0, 1, 0), -index * angle));

            ScaleTransform3D scale = element != null ? new ScaleTransform3D(1.0, double.IsNaN(element.Height) ? 1.0 : element.Height / element.Width, 1.0) : new ScaleTransform3D(1, 1, 1);
            
            Transform3DGroup transform = new Transform3DGroup();

            transform.Children.Add(scale);
            transform.Children.Add(translaslation);
            transform.Children.Add(rotation);

            Model.Transform = transform;
        
}

        public FrameworkElement Element
        {

            get {
 return element; 
}
            set
            {

                element = value;
                front.Visual = element;
            
}
        
}
    
}

}
			
...
Expand> <Close

Want complete source code? Download it here

Point(s): 1

Download
0 lines left, continue to read

File list

Tips: You can preview the content of files by clicking file names^_^
Name Size Date
Bornander.UI.TabCarousel.sln1.97 kB2009-12-26 13:54
01.96 kB
App.xaml313.00 B2009-12-26 13:42
App.xaml.cs331.00 B2009-12-26 13:38
Bornander.UI.TabCarousel.Test.csproj4.69 kB2010-01-01 20:45
Bornander.UI.TabCarousel.Test.csproj.user74.00 B2009-12-26 13:45
01.96 kB
LoginPanel.xaml1.98 kB2010-01-01 20:45
LoginPanel.xaml.cs200.00 B2010-01-01 20:45
MainWindow.xaml3.03 kB2010-01-01 21:24
MainWindow.xaml.cs2.98 kB2010-01-01 21:25
01.96 kB
AssemblyInfo.cs2.27 kB2009-12-26 13:38
Resources.Designer.cs2.82 kB2009-12-26 13:38
Resources.resx5.48 kB2009-12-26 13:38
Settings.Designer.cs1.09 kB2009-12-26 13:38
Settings.settings201.00 B2009-12-26 13:38
01.96 kB
Bornander.UI.TabCarousel.csproj3.46 kB2009-12-26 15:04
Carousel.xaml1.03 kB2009-12-28 19:39
Carousel.xaml.cs11.61 kB2009-12-28 20:57
01.96 kB
AssemblyInfo.cs1.43 kB2009-12-26 13:45
Tab.cs2.77 kB2009-12-28 20:34
01.96 kB
Bornander.Wpf.Meshes.csproj2.85 kB2009-12-26 14:15
Box.cs3.81 kB2009-12-26 14:47
Plane.cs1.65 kB2009-12-26 14:49
01.96 kB
AssemblyInfo.cs1.42 kB2009-12-26 13:51
...

Tab.cs (22.50 kB)

Need 1 point
Your Point(s)

Your Point isn't enough.

Get point immediately by PayPal

More(Debit card / Credit card / PayPal Credit / Online Banking)

Submit your source codes. Get more point

LOGIN

Don't have an account? Register now
Need any help?
Mail to: support@codeforge.com

切换到中文版?

CodeForge Chinese Version
CodeForge English Version

Where are you going?

^_^"Oops ...

Sorry!This guy is mysterious, its blog hasn't been opened, try another, please!
OK

Warm tip!

CodeForge to FavoriteFavorite by Ctrl+D