silverlight 뒤집기 코드
12493 단어 windowsMicrosoftUPsilverlightBlend
using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
namespace slapp002
{
public enum enumDirection { Up, Down, Left, Right };
public class cShow3DPlane
{
public cShow3DPlane()
{
m_IsMoveOverIn = true;
m_IsMoveOverOut = true;
m_MoveSpeed = 2;
sbTimeIn = new Storyboard();
sbTimeOut = new Storyboard();
SetTime(10, 10);
sbTimeIn.Completed += new EventHandler(sbTimeIn_Completed);
sbTimeOut.Completed += new EventHandler(sbTimeOut_Completed);
}
private int m_TimeSpeed1, m_TimeSpeed2, m_MoveSpeed, m_PlaneSpeed, m_InEnd, m_OutEnd;
private double m_InLocalZ, m_OutLocalZ;
private PlaneProjection m_pInPlane, m_pOutPlane;
private Storyboard sbTimeIn, sbTimeOut;
private enumDirection m_Direction;
private bool m_IsMoveOverIn, m_IsMoveOverOut;
// planeProjection
private void InitPlaneData()
{
m_pInPlane.RotationX = 0;
m_pInPlane.RotationY = 0;
m_pInPlane.RotationZ = 0;
m_pInPlane.CenterOfRotationX = 0.5;
m_pInPlane.CenterOfRotationY = 0.5;
m_pInPlane.CenterOfRotationZ = 0;
m_pOutPlane.RotationX = 0;
m_pOutPlane.RotationY = 0;
m_pOutPlane.RotationZ = 0;
m_pOutPlane.CenterOfRotationX = 0.5;
m_pOutPlane.CenterOfRotationY = 0.5;
m_pOutPlane.CenterOfRotationZ = 0;
m_pOutPlane.LocalOffsetZ = m_OutLocalZ;
m_pOutPlane.GlobalOffsetZ = -m_OutLocalZ;
m_pInPlane.LocalOffsetZ = m_InLocalZ;
m_pInPlane.GlobalOffsetZ = -m_InLocalZ;
switch (m_Direction)
{
case enumDirection.Up:
m_pInPlane.RotationX = -90;
m_InEnd = 0;
m_pOutPlane.RotationX = 0;
m_OutEnd = 90;
m_PlaneSpeed = m_MoveSpeed;
break;
case enumDirection.Down:
m_pInPlane.RotationX = 90;
m_InEnd = 0;
m_pOutPlane.RotationX = 0;
m_OutEnd = -90;
m_PlaneSpeed = -m_MoveSpeed;
break;
case enumDirection.Left:
m_pInPlane.RotationY = 90;
m_InEnd = 0;
m_pOutPlane.RotationY = 0;
m_OutEnd = -90;
m_PlaneSpeed = -m_MoveSpeed;
break;
case enumDirection.Right:
m_pInPlane.RotationY = -90;
m_InEnd = 0;
m_pOutPlane.RotationY = 0;
m_OutEnd = 90;
m_PlaneSpeed = m_MoveSpeed;
break;
}
}
public void Begin()
{
m_IsMoveOverIn = false;
m_IsMoveOverOut = false;
sbTimeIn.Begin();
sbTimeOut.Begin();
}
//
public void SetInOutPlane(Grid gridIn, Grid gridOut, enumDirection eDirection)
{
m_pInPlane = new PlaneProjection();
m_pOutPlane = new PlaneProjection();
gridIn.Projection = m_pInPlane;
gridOut.Projection = m_pOutPlane;
if (eDirection == enumDirection.Left || eDirection == enumDirection.Right)
{
m_InLocalZ = gridIn.ActualWidth / 2;
m_OutLocalZ = gridOut.ActualWidth / 2;
}
else
{
m_InLocalZ = gridIn.ActualHeight / 2;
m_OutLocalZ = gridOut.ActualHeight / 2;
}
m_Direction = eDirection;
InitPlaneData();
}
//
public void SetInOutPlane(System.Windows.Controls.Control controlIn, System.Windows.Controls.Control controlOut, enumDirection eDirection)
{
m_pInPlane = new PlaneProjection();
m_pOutPlane = new PlaneProjection();
controlIn.Projection = m_pInPlane;
controlOut.Projection = m_pOutPlane;
if (eDirection == enumDirection.Left || eDirection == enumDirection.Right)
{
m_InLocalZ = controlIn.ActualWidth / 2;
m_OutLocalZ = controlOut.ActualWidth / 2;
}
else
{
m_InLocalZ = controlIn.ActualHeight / 2;
m_OutLocalZ = controlOut.ActualHeight / 2;
}
m_Direction = eDirection;
InitPlaneData();
}
public bool MoveOver()
{
if (!m_IsMoveOverIn || !m_IsMoveOverOut)
return false;
else return true;
}
//
public void SetTime(int timeSpeed1, int timeSpeed2)
{
m_TimeSpeed1 = timeSpeed1;
m_TimeSpeed2 = timeSpeed2;
sbTimeIn.Duration = new Duration(TimeSpan.FromMilliseconds(m_TimeSpeed1));
sbTimeOut.Duration = new Duration(TimeSpan.FromMilliseconds(m_TimeSpeed2));
}
//
void sbTimeOut_Completed(object sender, EventArgs e)
{
//throw new NotImplementedException();
if (m_Direction == enumDirection.Left || m_Direction == enumDirection.Right)
{
m_pOutPlane.RotationY += m_PlaneSpeed;
if (m_pOutPlane.RotationY == m_OutEnd) m_IsMoveOverOut = true;
}
if (m_Direction == enumDirection.Up || m_Direction == enumDirection.Down)
{
m_pOutPlane.RotationX += m_PlaneSpeed;
if (m_pOutPlane.RotationX == m_OutEnd) m_IsMoveOverOut = true;
}
if (!m_IsMoveOverOut) sbTimeOut.Begin();
else
{
m_pOutPlane.LocalOffsetZ = 0;
m_pOutPlane.GlobalOffsetZ = 0;
}
}
//
void sbTimeIn_Completed(object sender, EventArgs e)
{
//throw new NotImplementedException();
if (m_Direction == enumDirection.Left || m_Direction == enumDirection.Right)
{
m_pInPlane.RotationY += m_PlaneSpeed;
if (m_pInPlane.RotationY == m_InEnd) m_IsMoveOverIn = true;
}
if (m_Direction == enumDirection.Up || m_Direction == enumDirection.Down)
{
m_pInPlane.RotationX += m_PlaneSpeed;
if (m_pInPlane.RotationX == m_InEnd) m_IsMoveOverIn = true;
}
if (!m_IsMoveOverIn) sbTimeIn.Begin();
else
{
m_pInPlane.LocalOffsetZ = 0;
m_pInPlane.GlobalOffsetZ = 0;
}
}
}
}
using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.DataVisualization.Charting;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
namespace slapp002
{
public partial class MainPage : UserControl
{
private cShow3DPlane c3d = new cShow3DPlane();
private Grid gridCur = new Grid();
public MainPage()
{
// Required to initialize variables
InitializeComponent();
}
private void rightbt_Click(object sender, System.Windows.RoutedEventArgs e)
{
if (c3d.MoveOver())
{
c3d.SetInOutPlane(linechart, colchart, enumDirection.Right);
//gridCur = gridUp;
c3d.Begin();
}
}
private void upbt_Click(object sender, System.Windows.RoutedEventArgs e)
{
if (c3d.MoveOver())
{
c3d.SetInOutPlane(linechart, colchart, enumDirection.Up);
//gridCur = gridUp;
c3d.Begin();
}
}
private void leftbt_Click(object sender, System.Windows.RoutedEventArgs e)
{
if (c3d.MoveOver())
{
c3d.SetInOutPlane(linechart, colchart, enumDirection.Left);
//gridCur = gridUp;
c3d.Begin();
}
}
private void downbt_Click(object sender, System.Windows.RoutedEventArgs e)
{
if (c3d.MoveOver())
{
c3d.SetInOutPlane(linechart, colchart, enumDirection.Down);
//gridCur = gridUp;
c3d.Begin();
}
}
private void UserControl_Loaded(object sender, System.Windows.RoutedEventArgs e)
{
}
}
}
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:slapp002_Control="clr-namespace:slapp002.Control" xmlns:local="clr-namespace:slapp002" mc:Ignorable="d"
x:Class="slapp002.MainPage"
Width="640" Height="480" Loaded="UserControl_Loaded">
<Grid x:Name="LayoutRoot" Background="White" >
<Grid.RowDefinitions>
<RowDefinition Height="0.152*"/>
<RowDefinition Height="0.848*"/>
</Grid.RowDefinitions>
<Button Content=" " x:Name="upbt" Height="26" Margin="265,8,289,0" VerticalAlignment="Top" Click="upbt_Click"/>
<Button Content=" " x:Name="leftbt" Margin="162,29,0,18" HorizontalAlignment="Left" Width="86" Click="leftbt_Click"/>
<Button Content=" " x:Name="rightbt" Margin="0,29,163,18" HorizontalAlignment="Right" Width="86" Click="rightbt_Click"/>
<Button Content=" " x:Name="downbt" Margin="265,0,289,0" Height="26" VerticalAlignment="Bottom" Click="downbt_Click"/>
<slapp002_Control:ColumnChartControl Name="colchart" Margin="0,0,0,0" Grid.Row="1"/>
<local:LineChartControl Margin="0" Name="linechart" Grid.Row="1"/>
</Grid>
</UserControl>
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
제한된 크기의 디렉토리를 만드는 방법오늘 저는 장치에 공간이 없을 때 백업 중에 응용 프로그램이 어떻게 작동하는지 테스트(및 수정)하는 작업이 있습니다. 결과적으로 "남은 공간 없음"오류로 백업이 실패하면 새 파일이 없어야 합니다. 지금까지 문제를 재...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.