WPF Model3DGroup-5-

索引サイト




<MaterialGroup x:Key="Material_book1_mat31">
<DiffuseMaterial>
<DiffuseMaterial.Brush>
<VisualBrush TileMode="Tile" Opacity="{Binding ElementName=sliderBook2P1,Path=Value}">
<VisualBrush.Visual>
<StackPanel>
<StackPanel.Background>
<DrawingBrush>
<DrawingBrush.Drawing>
<GeometryDrawing>
<GeometryDrawing.Brush>
<RadialGradientBrush>
<GradientStop Color="MediumBlue" Offset="0.0"/>
<GradientStop Color="White" Offset="1.0" />
</RadialGradientBrush>
</GeometryDrawing.Brush>
<GeometryDrawing.Geometry>
<GeometryGroup>
<RectangleGeometry Rect="0,0,50,50"/>
<RectangleGeometry Rect="50,50,50,50"/>
</GeometryGroup>
</GeometryDrawing.Geometry>
</GeometryDrawing>
</DrawingBrush.Drawing>
</DrawingBrush>
</StackPanel.Background>
<TextBlock FontSize="12" Margin="3">Ⅰ</TextBlock>
</StackPanel>
</VisualBrush.Visual>
</VisualBrush>
</DiffuseMaterial.Brush>
</DiffuseMaterial>
</MaterialGroup>




using System.Windows.Threading;
using System.Windows.Media.Animation;

namespace WpfApplication1
{
///


/// MainWindow.xaml の相互作用ロジック
///

public partial class MainWindow : Window
{
private DispatcherTimer z_timer = new DispatcherTimer();
private int zp_idx = 0;

public MainWindow()
{
InitializeComponent();
Public_Param z_tantou = new Public_Param();
z_tantou.name = "TantouName";

z_timer = new System.Windows.Threading.DispatcherTimer();
z_timer.Tick += new EventHandler(z_timer_Tick);
z_timer.Interval = new TimeSpan(0, 0, 1);
}
private void button1_Click(object sender, RoutedEventArgs e)
{
Button z_button = (Button)e.Source;
zp_idx = Convert.ToInt16(z_button.Tag);

buttonReset_Click(sender, e);
//DoEvents();
z_timer.Start();
}
private void z_timer_Tick(object sender, EventArgs e)
{
shuffleStart();
z_timer.Stop();
}
private void shuffleStart()
{
int idx = zp_idx;
int ss = 4;

DoubleAnimation sliderAnime0 = new DoubleAnimation(slider1.Minimum, new TimeSpan(0, 0, ss));
slider1.BeginAnimation(Slider.ValueProperty, sliderAnime0);
switch (idx)
{
case 1:
sliderBook2P0.BeginAnimation(Slider.ValueProperty, new DoubleAnimation(sliderBook2P0.Minimum, new TimeSpan(0, 0, ss)));
sliderBook2P1.BeginAnimation(Slider.ValueProperty, new DoubleAnimation(sliderBook2P1.Maximum, new TimeSpan(0, 0, ss)));
sliderBook2P2.BeginAnimation(Slider.ValueProperty, new DoubleAnimation(sliderBook2P2.Minimum, new TimeSpan(0, 0, ss)));
sliderBook2P3.BeginAnimation(Slider.ValueProperty, new DoubleAnimation(sliderBook2P3.Minimum, new TimeSpan(0, 0, ss)));
sliderBook2P4.BeginAnimation(Slider.ValueProperty, new DoubleAnimation(sliderBook2P4.Minimum, new TimeSpan(0, 0, ss)));
sliderBook2P5.BeginAnimation(Slider.ValueProperty, new DoubleAnimation(sliderBook2P5.Minimum, new TimeSpan(0, 0, ss)));
break;
case 2:
sliderBook2P0.BeginAnimation(Slider.ValueProperty, new DoubleAnimation(sliderBook2P0.Minimum, new TimeSpan(0, 0, ss)));
sliderBook2P1.BeginAnimation(Slider.ValueProperty, new DoubleAnimation(sliderBook2P1.Minimum, new TimeSpan(0, 0, ss)));
sliderBook2P2.BeginAnimation(Slider.ValueProperty, new DoubleAnimation(sliderBook2P2.Maximum, new TimeSpan(0, 0, ss)));
sliderBook2P3.BeginAnimation(Slider.ValueProperty, new DoubleAnimation(sliderBook2P3.Minimum, new TimeSpan(0, 0, ss)));
sliderBook2P4.BeginAnimation(Slider.ValueProperty, new DoubleAnimation(sliderBook2P4.Minimum, new TimeSpan(0, 0, ss)));
sliderBook2P5.BeginAnimation(Slider.ValueProperty, new DoubleAnimation(sliderBook2P5.Minimum, new TimeSpan(0, 0, ss)));
break;
case 3:
sliderBook2P0.BeginAnimation(Slider.ValueProperty, new DoubleAnimation(sliderBook2P0.Minimum, new TimeSpan(0, 0, ss)));
sliderBook2P1.BeginAnimation(Slider.ValueProperty, new DoubleAnimation(sliderBook2P1.Minimum, new TimeSpan(0, 0, ss)));
sliderBook2P2.BeginAnimation(Slider.ValueProperty, new DoubleAnimation(sliderBook2P2.Minimum, new TimeSpan(0, 0, ss)));
sliderBook2P3.BeginAnimation(Slider.ValueProperty, new DoubleAnimation(sliderBook2P3.Maximum, new TimeSpan(0, 0, ss)));
sliderBook2P4.BeginAnimation(Slider.ValueProperty, new DoubleAnimation(sliderBook2P4.Minimum, new TimeSpan(0, 0, ss)));
sliderBook2P5.BeginAnimation(Slider.ValueProperty, new DoubleAnimation(sliderBook2P5.Minimum, new TimeSpan(0, 0, ss)));
break;
case 4:
sliderBook2P0.BeginAnimation(Slider.ValueProperty, new DoubleAnimation(sliderBook2P0.Minimum, new TimeSpan(0, 0, ss)));
sliderBook2P1.BeginAnimation(Slider.ValueProperty, new DoubleAnimation(sliderBook2P1.Minimum, new TimeSpan(0, 0, ss)));
sliderBook2P2.BeginAnimation(Slider.ValueProperty, new DoubleAnimation(sliderBook2P2.Minimum, new TimeSpan(0, 0, ss)));
sliderBook2P3.BeginAnimation(Slider.ValueProperty, new DoubleAnimation(sliderBook2P3.Minimum, new TimeSpan(0, 0, ss)));
sliderBook2P4.BeginAnimation(Slider.ValueProperty, new DoubleAnimation(sliderBook2P4.Maximum, new TimeSpan(0, 0, ss)));
sliderBook2P5.BeginAnimation(Slider.ValueProperty, new DoubleAnimation(sliderBook2P5.Minimum, new TimeSpan(0, 0, ss)));
break;
case 5:
sliderBook2P0.BeginAnimation(Slider.ValueProperty, new DoubleAnimation(sliderBook2P0.Minimum, new TimeSpan(0, 0, ss)));
sliderBook2P1.BeginAnimation(Slider.ValueProperty, new DoubleAnimation(sliderBook2P1.Minimum, new TimeSpan(0, 0, ss)));
sliderBook2P2.BeginAnimation(Slider.ValueProperty, new DoubleAnimation(sliderBook2P2.Minimum, new TimeSpan(0, 0, ss)));
sliderBook2P3.BeginAnimation(Slider.ValueProperty, new DoubleAnimation(sliderBook2P3.Minimum, new TimeSpan(0, 0, ss)));
sliderBook2P4.BeginAnimation(Slider.ValueProperty, new DoubleAnimation(sliderBook2P4.Minimum, new TimeSpan(0, 0, ss)));
sliderBook2P5.BeginAnimation(Slider.ValueProperty, new DoubleAnimation(sliderBook2P5.Maximum, new TimeSpan(0, 0, ss)));
break;
}
}
private void buttonReset_Click(object sender, RoutedEventArgs e)
{
DoubleAnimation sliderAnime0 = new DoubleAnimation(slider1.Maximum, new TimeSpan(0, 0, 0));
slider1.BeginAnimation(Slider.ValueProperty, sliderAnime0);

sliderBook2P0.BeginAnimation(Slider.ValueProperty, new DoubleAnimation(sliderBook2P0.Maximum, new TimeSpan(0, 0, 0)));
sliderBook2P1.BeginAnimation(Slider.ValueProperty, new DoubleAnimation(sliderBook2P1.Maximum, new TimeSpan(0, 0, 0)));
sliderBook2P2.BeginAnimation(Slider.ValueProperty, new DoubleAnimation(sliderBook2P2.Maximum, new TimeSpan(0, 0, 0)));
sliderBook2P3.BeginAnimation(Slider.ValueProperty, new DoubleAnimation(sliderBook2P3.Maximum, new TimeSpan(0, 0, 0)));
sliderBook2P4.BeginAnimation(Slider.ValueProperty, new DoubleAnimation(sliderBook2P4.Maximum, new TimeSpan(0, 0, 0)));
sliderBook2P5.BeginAnimation(Slider.ValueProperty, new DoubleAnimation(sliderBook2P5.Maximum, new TimeSpan(0, 0, 0)));
}
private void buttonAxis_Click(object sender, RoutedEventArgs e)
{
textBoxAxis.Text = sliderAxisX.Value + " " + sliderAxisY.Value + " " + sliderAxisZ.Value;
}
public void DoEvents()
{
DispatcherFrame frame = new DispatcherFrame();
Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Background,
new DispatcherOperationCallback(ExitFrames), frame);
Dispatcher.PushFrame(frame);
}
public object ExitFrames(object f)
{
((DispatcherFrame)f).Continue = false;
return null;
}
}
}



AX