첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.
728x90
반응형
728x170

TestProject.zip
다운로드

▶ MainApplication.xaml

<Application x:Class="TestProject.MainApplication"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:o="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"
    StartupUri="MainWindow.xaml">
    <Application.Resources>
        <DrawingBrush x:Key="BlueWhiteGridDrawingBrushKey"
            o:Freeze="True"
            Viewport="0 0 10 10"
            ViewportUnits="Absolute"
            TileMode="Tile">
            <DrawingBrush.Drawing>
                <DrawingGroup>
                    <DrawingGroup.Children>
                        <GeometryDrawing Brush="White">
                            <GeometryDrawing.Geometry>
                                <RectangleGeometry Rect="0 0 1 1" />
                            </GeometryDrawing.Geometry>
                        </GeometryDrawing>
                        <GeometryDrawing
                            Brush="#ccccff"
                            Geometry="M 0 0 L 1 0 1 0.1 0 0.1 Z" />
                        <GeometryDrawing
                            Brush="#ccccff"
                            Geometry="M 0 0 L 0 1 0.1 1 0.1 0 Z" />
                    </DrawingGroup.Children>
                </DrawingGroup>
            </DrawingBrush.Drawing>
        </DrawingBrush>
        <DrawingBrush x:Key="BlueBlackGridDrawingBrushKey"
            o:Freeze="True"
            Viewport="0 0 10 10"
            ViewportUnits="Absolute"
            TileMode="Tile">
            <DrawingBrush.Drawing>
                <DrawingGroup>
                    <GeometryDrawing Brush="Black">
                        <GeometryDrawing.Geometry>
                            <RectangleGeometry Rect="0 0 1 1" />
                        </GeometryDrawing.Geometry>
                    </GeometryDrawing>
                    <GeometryDrawing
                        Brush="#ccccff"
                        Geometry="M 0 0 L 1 0 1 0.1 0 0.1 Z" />
                    <GeometryDrawing
                        Brush="#ccccff"
                        Geometry="M 0 0 L 0 1 0.1 1 0.1 0 Z" />
                </DrawingGroup>
            </DrawingBrush.Drawing>
        </DrawingBrush>
        <DrawingBrush x:Key="BlueBlueGridDrawingBrushKey"
            o:Freeze="True"
            Viewport="0 0 10 10"
            ViewportUnits="Absolute"
            TileMode="Tile">
            <DrawingBrush.Drawing>
                <DrawingGroup>
                    <DrawingGroup.Children>
                        <GeometryDrawing Brush="#99ccccff">
                            <GeometryDrawing.Geometry>
                                <RectangleGeometry Rect="0 0 1 1" />
                            </GeometryDrawing.Geometry>
                        </GeometryDrawing>
                        <GeometryDrawing
                            Brush="#ccccff"
                            Geometry="M 0 0 L 1 0 1 0.1 0 0.1 Z" />
                        <GeometryDrawing
                            Brush="#ccccff"
                            Geometry="M 0 0 L 0 1 0.1 1 0.1 0 Z" />
                    </DrawingGroup.Children>
                </DrawingGroup>
            </DrawingBrush.Drawing>
        </DrawingBrush>
        <GradientStopCollection x:Key="GlassGradientStopCollectionKey"
            o:Freeze="True">
            <GradientStop Color="WhiteSmoke"  Offset="0.2"  />
            <GradientStop Color="Transparent" Offset="0.4"  />
            <GradientStop Color="WhiteSmoke"  Offset="0.5"  />
            <GradientStop Color="Transparent" Offset="0.75" />
            <GradientStop Color="WhiteSmoke"  Offset="0.9"  />
            <GradientStop Color="Transparent" Offset="1"    />
        </GradientStopCollection>
        <LinearGradientBrush x:Key="GlassLinearGradientBrushKey"
            o:Freeze="True"
            StartPoint="0 0"
            EndPoint="1 1"
            Opacity="0.75"
            GradientStops="{StaticResource GlassGradientStopCollectionKey}" />
        <Style TargetType="{x:Type TextBlock}">
            <Setter Property="TextBlock.HorizontalAlignment" Value="Left"    />
            <Setter Property="TextBlock.MaxWidth"            Value="400"     />
            <Setter Property="TextBlock.FontFamily"          Value="Verdana" />
            <Setter Property="TextBlock.TextWrapping"        Value="Wrap"    />
        </Style>
        <Style x:Key="CodeTextBlockStyleKey" TargetType="{x:Type TextBlock}">
            <Setter Property="HorizontalAlignment" Value="Left"        />
            <Setter Property="MaxWidth"            Value="400"         />
            <Setter Property="Padding"             Value="5"           />
            <Setter Property="Background"          Value="#33cccccc"   />
            <Setter Property="TextWrapping"        Value="Wrap"        />
            <Setter Property="FontFamily"          Value="Courier New" />
        </Style>
        <Style x:Key="HeaderSpanStyleKey" TargetType="{x:Type Span}">
            <Setter Property="FontFamily" Value="Palatino Linotype" />
            <Setter Property="FontWeight" Value="Bold"              />
        </Style>
        <Style TargetType="{x:Type RadioButton}">
            <Setter Property="Background" Value="White" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type RadioButton}">
                        <Grid
                            Width="{TemplateBinding Width}"
                            Height="{TemplateBinding Height}">
                            <Rectangle x:Name="outerRectangle"
                                HorizontalAlignment="Stretch" 
                                VerticalAlignment="Stretch"
                                RadiusX="20"
                                RadiusY="20"
                                Stroke="{TemplateBinding Background}" 
                                StrokeThickness="5"
                                Fill="Transparent" />
                            <Rectangle x:Name="innerRectangle"
                                HorizontalAlignment="Stretch" 
                                VerticalAlignment="Stretch"
                                Stroke="Transparent"
                                StrokeThickness="20" 
                                RadiusX="20"
                                RadiusY="20"
                                Fill="{TemplateBinding Background}" />
                            <Rectangle x:Name="glassCubeRectangle"
                                HorizontalAlignment="Stretch" 
                                VerticalAlignment="Stretch"
                                RadiusX="10"
                                RadiusY="10"
                                StrokeThickness="2"
                                Opacity="0" 
                                Fill="{StaticResource GlassLinearGradientBrushKey}"
                                RenderTransformOrigin="0.5 0.5">
                                <Rectangle.Stroke>
                                    <LinearGradientBrush
                                        StartPoint="0.5 0"
                                        EndPoint="0.5 1">
                                        <LinearGradientBrush.GradientStops>
                                            <GradientStop Offset="0.0" Color="LightBlue" />
                                            <GradientStop Offset="1.0" Color="Gray"      />
                                        </LinearGradientBrush.GradientStops>
                                    </LinearGradientBrush>
                                </Rectangle.Stroke>
                                <Rectangle.RenderTransform>
                                    <ScaleTransform x:Name="glassCubeScaleTransform" />
                                </Rectangle.RenderTransform>
                                <Rectangle.BitmapEffect>
                                    <BevelBitmapEffect />
                                </Rectangle.BitmapEffect>
                            </Rectangle>
                            <DockPanel>
                                <ContentPresenter
                                    Margin="15" 
                                    HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                    VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                    TextBlock.Foreground="Black"
                                    Content="{TemplateBinding Content}" />
                            </DockPanel>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsFocused" Value="true">
                                <Setter
                                    TargetName="glassCubeRectangle"
                                    Property="Rectangle.Opacity"
                                    Value="1" />
                                <Setter
                                    TargetName="innerRectangle"
                                    Property="Rectangle.Opacity"
                                    Value="1" />
                            </Trigger>
                            <EventTrigger RoutedEvent="Mouse.MouseEnter">
                                <EventTrigger.Actions>
                                    <BeginStoryboard Name="mouseEnterBeginStoryboard">
                                        <Storyboard>
                                            <DoubleAnimation
                                                Storyboard.TargetName="glassCubeScaleTransform"
                                                Storyboard.TargetProperty="ScaleX"
                                                From="1"
                                                To="0.9"
                                                Duration="0:0:0.5" />
                                            <DoubleAnimation
                                                Storyboard.TargetName="glassCubeScaleTransform"
                                                Storyboard.TargetProperty="ScaleY"
                                                From="1"
                                                To="0.9"
                                                Duration="0:0:0.5" />
                                            <DoubleAnimation 
                                                Storyboard.TargetName="outerRectangle"
                                                Storyboard.TargetProperty="RadiusX"
                                                From="20"
                                                To="0"
                                                Duration="0:0:0.5" />
                                            <DoubleAnimation 
                                                Storyboard.TargetName="outerRectangle"
                                                Storyboard.TargetProperty="RadiusY"
                                                From="20"
                                                To="0"
                                                Duration="0:0:0.5" />
                                            <DoubleAnimation
                                                Storyboard.TargetName="glassCubeRectangle"
                                                Storyboard.TargetProperty="Opacity"
                                                From="0"
                                                To="1"
                                                Duration="0:0:0.1" />
                                        </Storyboard>
                                    </BeginStoryboard>
                                </EventTrigger.Actions>
                            </EventTrigger>
                            <EventTrigger RoutedEvent="Mouse.MouseLeave">
                                <EventTrigger.Actions>
                                    <BeginStoryboard>
                                        <Storyboard>
                                            <DoubleAnimation 
                                                Storyboard.TargetName="outerRectangle"
                                                Storyboard.TargetProperty="RadiusX"
                                                From="0"
                                                To="20"
                                                Duration="0:0:0.5" />
                                            <DoubleAnimation 
                                                Storyboard.TargetName="outerRectangle"
                                                Storyboard.TargetProperty="RadiusY"
                                                From="0"
                                                To="20"
                                                Duration="0:0:0.5" />
                                            <DoubleAnimation
                                                Storyboard.TargetName="glassCubeRectangle"
                                                Storyboard.TargetProperty="Opacity"
                                                From="1"
                                                To="0"
                                                Duration="0:0:0.1" />
                                        </Storyboard>
                                    </BeginStoryboard>
                                </EventTrigger.Actions>
                            </EventTrigger>
                            <EventTrigger RoutedEvent="RadioButton.Checked">
                                <EventTrigger.Actions>
                                    <BeginStoryboard>
                                        <Storyboard>
                                            <DoubleAnimation
                                                Storyboard.TargetName="glassCubeScaleTransform"
                                                Storyboard.TargetProperty="ScaleX"
                                                AutoReverse="True"
                                                To="0.1"
                                                Duration="0:0:0.1" />
                                            <DoubleAnimation
                                                Storyboard.TargetName="glassCubeScaleTransform"
                                                Storyboard.TargetProperty="ScaleY"
                                                AutoReverse="True"
                                                To="0.1"
                                                Duration="0:0:0.1" />
                                            <DoubleAnimation
                                                Storyboard.TargetName="innerRectangle"
                                                Storyboard.TargetProperty="Opacity"
                                                To="0"
                                                Duration="0:0:0.5" />
                                        </Storyboard>
                                    </BeginStoryboard>
                                </EventTrigger.Actions>
                            </EventTrigger>
                            <EventTrigger RoutedEvent="RadioButton.Unchecked">
                                <EventTrigger.Actions>
                                    <BeginStoryboard>
                                        <Storyboard>
                                            <DoubleAnimation
                                                Storyboard.TargetName="innerRectangle"
                                                Storyboard.TargetProperty="Opacity"
                                                To="1.0"
                                                Duration="0:0:0.5" />
                                        </Storyboard>
                                    </BeginStoryboard>
                                </EventTrigger.Actions>
                            </EventTrigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </Application.Resources>
</Application>

 

728x90

 

▶ MainWindow.xaml

<NavigationWindow x:Class="TestProject.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Width="800"
    Height="600"
    Title="지오메트리 사용하기"
    ShowsNavigationUI="False"
    FontFamily="나눔고딕코딩"
    FontSize="16"
    Source="MainPage.xaml">
</NavigationWindow>

 

300x250

 

▶ MainPage.xaml

<Page x:Class="TestProject.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    FontFamily="나눔고딕코딩"
    FontSize="16">
    <Page.Resources>
        <Storyboard x:Key="ZoomInStoryboardKey"
            Completed="zoomInStoryboard_Completed">
            <DoubleAnimation
                Storyboard.TargetName="axisAngleRotation3D"
                Storyboard.TargetProperty="Angle"
                AutoReverse="False"
                FillBehavior="Stop"
                DecelerationRatio="1"
                From="360"
                To="0"
                BeginTime="0:0:0"
                Duration="0:0:1" />
            <DoubleAnimation
                Storyboard.TargetName="scaleTransform3D"
                Storyboard.TargetProperty="ScaleX"
                AutoReverse="False"
                DecelerationRatio="1"
                From="0"
                To="1"
                Duration="0:0:2" />
            <DoubleAnimation
                Storyboard.TargetName="scaleTransform3D"
                Storyboard.TargetProperty="ScaleY"
                AutoReverse="False"
                DecelerationRatio="1"
                From="0"
                To="1"
                Duration="0:0:2" />
            <DoubleAnimation
                Storyboard.TargetName="scaleTransform3D"
                Storyboard.TargetProperty="ScaleZ"
                AutoReverse="False"
                DecelerationRatio="1"
                From="0"
                To="1"
                Duration="0:0:2" />
        </Storyboard>
    </Page.Resources>
    <Page.Triggers>
        <EventTrigger RoutedEvent="RadioButton.Checked">
            <BeginStoryboard>
                <Storyboard Completed="zoomOutStoryboard_Completed">
                    <DoubleAnimation
                        Storyboard.TargetName="axisAngleRotation3D"
                        Storyboard.TargetProperty="Angle"
                        AutoReverse="False"
                        FillBehavior="Stop"
                        AccelerationRatio="1"
                        From="0"
                        To="360"
                        BeginTime="0:0:1"
                        Duration="0:0:1" />
                    <DoubleAnimation
                        Storyboard.TargetName="scaleTransform3D"
                        Storyboard.TargetProperty="ScaleX"
                        AutoReverse="False"
                        AccelerationRatio="1"
                        From="1"
                        To="0"
                        Duration="0:0:2" />
                    <DoubleAnimation
                        Storyboard.TargetName="scaleTransform3D"
                        Storyboard.TargetProperty="ScaleY"
                        AutoReverse="False"
                        AccelerationRatio="1"
                        From="1"
                        To="0"
                        Duration="0:0:2" />
                    <DoubleAnimation
                        Storyboard.TargetName="scaleTransform3D"
                        Storyboard.TargetProperty="ScaleZ"
                        AutoReverse="False"
                        AccelerationRatio="1"
                        From="1"
                        To="0.1"
                        Duration="0:0:2" />
                </Storyboard>
            </BeginStoryboard>
        </EventTrigger>
    </Page.Triggers>
    <DockPanel>
        <Border DockPanel.Dock="Left"
            Background="{StaticResource BlueBlueGridDrawingBrushKey}">
            <StackPanel
                VerticalAlignment="Stretch"
                Margin="10">
                <RadioButton x:Name="radioButton1"
                    Margin="0 0 0 10">
                    지오메트리 사용
                </RadioButton>
                <RadioButton x:Name="radioButton2"
                    Margin="0 0 0 10">
                    도형 지오메트리
                </RadioButton>
                <RadioButton x:Name="radioButton3"
                    Margin="0 0 0 10">
                    패스 지오메트리
                </RadioButton>
                <RadioButton x:Name="radioButton4"
                    Margin="0 0 0 10">
                    지오메트리 속성 문법
                </RadioButton>
                <RadioButton x:Name="radioButton5">
                    지오메트리 결합
                </RadioButton>
            </StackPanel>
        </Border>
        <Grid Background="Black">
            <Rectangle Fill="{StaticResource BlueBlackGridDrawingBrushKey}">
                <Rectangle.OpacityMask>
                    <RadialGradientBrush>
                        <GradientStop Offset="0.0" Color="#ff000000" />
                        <GradientStop Offset="1.0" Color="#00000000" />
                    </RadialGradientBrush>
                </Rectangle.OpacityMask>
            </Rectangle>
            <Border>
                <Border ClipToBounds="True">
                    <Viewbox 
                        Width="{Binding ElementName=scrollViewer, Path=ActualWidth}"
                        Height="{Binding ElementName=scrollViewer, Path=ActualHeight}"
                        Stretch="Fill">
                        <Viewport3D Name="viewport3D"
                            Opacity="1"
                            IsHitTestVisible="False">
                            <Viewport3D.Camera>
                                <PerspectiveCamera 
                                    LookDirection="0 0 -2" 
                                    UpDirection="0 1 0"  
                                    Position="0 0 5" 
                                    FieldOfView="90" />
                            </Viewport3D.Camera>
                            <ModelVisual3D>
                                <ModelVisual3D.Children>
                                    <ModelVisual3D>
                                        <ModelVisual3D.Content>
                                            <AmbientLight Color="#ffffffff" />
                                        </ModelVisual3D.Content>
                                    </ModelVisual3D>
                                    <ModelVisual3D>
                                        <ModelVisual3D.Children>
                                            <ModelVisual3D>
                                                <ModelVisual3D.Content>
                                                    <GeometryModel3D>
                                                        <GeometryModel3D.Geometry>
                                                            <MeshGeometry3D x:Name="meshGeometry3D"
                                                                TriangleIndices="0 1 2 3 4 5 11 10 9 8 7 6"
                                                                TextureCoordinates="0  0  0 -1 -1 -1 -1 -1 -1 0
                                                                                    0  0 -1 -1 -1  0  0  0  0 0
                                                                                    0 -1 -1 -1"
                                                                Positions="12 -9 0 12 9 0 -12 9 0 -12 9 0 -12 -9 0 12 -9 0" />
                                                        </GeometryModel3D.Geometry>
                                                        <GeometryModel3D.Material>
                                                            <DiffuseMaterial>
                                                                <DiffuseMaterial.Brush>
                                                                    <VisualBrush
                                                                        RenderOptions.CacheInvalidationThresholdMinimum="0"
                                                                        RenderOptions.CachingHint="Cache"
                                                                        Visual="{Binding ElementName=scrollViewer}" />
                                                                </DiffuseMaterial.Brush>
                                                            </DiffuseMaterial>
                                                        </GeometryModel3D.Material>
                                                    </GeometryModel3D>
                                                </ModelVisual3D.Content>
                                                <ModelVisual3D.Transform>
                                                    <Transform3DGroup>
                                                        <RotateTransform3D
                                                            CenterX="0"
                                                            CenterY="0"
                                                            CenterZ="0">
                                                            <RotateTransform3D.Rotation>
                                                                <AxisAngleRotation3D x:Name="axisAngleRotation3D"
                                                                    Axis="0 1 0"
                                                                    Angle="0" />
                                                            </RotateTransform3D.Rotation>
                                                        </RotateTransform3D>
                                                        <ScaleTransform3D x:Name="scaleTransform3D" 
                                                            ScaleX="1"
                                                            ScaleY="1"
                                                            ScaleZ="1" />
                                                    </Transform3DGroup>
                                                </ModelVisual3D.Transform>
                                            </ModelVisual3D>
                                        </ModelVisual3D.Children>
                                    </ModelVisual3D>
                                </ModelVisual3D.Children>
                            </ModelVisual3D>
                        </Viewport3D>
                    </Viewbox>
                </Border>
            </Border>
            <Border Name="scrollViewerBorder">
                <ScrollViewer Name="scrollViewer"
                    Background="White"
                    HorizontalScrollBarVisibility="Auto"
                    VerticalScrollBarVisibility="Auto"
                    HorizontalAlignment="Stretch"
                    VerticalAlignment="Stretch">
                    <Frame Name="frame"
                        Background="White"
                        NavigationUIVisibility="Hidden">
                        <Frame.RenderTransform>
                            <ScaleTransform />
                        </Frame.RenderTransform>
                    </Frame>
                </ScrollViewer>
            </Border>
        </Grid>
    </DockPanel>
</Page>

 

▶ MainPage.xaml.cs

using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media.Media3D;
using System.Windows.Media.Animation;

namespace TestProject
{
    /// <summary>
    /// 메인 페이지
    /// </summary>
    public partial class MainPage : Page
    {
        //////////////////////////////////////////////////////////////////////////////////////////////////// Field
        ////////////////////////////////////////////////////////////////////////////////////////// Private

        #region Field

        /// <summary>
        /// 페이지 배열
        /// </summary>
        private Page[] pageArray;

        /// <summary>
        /// 페이지 인덱스
        /// </summary>
        private int pageIndex;

        #endregion

        //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
        ////////////////////////////////////////////////////////////////////////////////////////// Public

        #region 생성자 - MainPage()

        /// <summary>
        /// 생성자
        /// </summary>
        public MainPage()
        {      
            InitializeComponent();

            this.pageArray = new Page[5];
            
            this.pageArray[0] = new GeometryUsagePage();
            this.pageArray[1] = new ShapeGeometryPage();
            this.pageArray[2] = new PathGeometryPage();
            this.pageArray[3] = new CombiningGeometryPage();
            this.pageArray[4] = new GeometryAttributeSyntaxExample();

            Loaded                     += Page_Loaded;
            this.radioButton1.Checked  += radioButton_Checked;
            this.radioButton2.Checked  += radioButton_Checked;
            this.radioButton3.Checked  += radioButton_Checked;
            this.radioButton4.Checked  += radioButton_Checked;
            this.radioButton5.Checked  += radioButton_Checked;
            this.frame.ContentRendered += frame_ContentRendered;
        }

        #endregion

        //////////////////////////////////////////////////////////////////////////////////////////////////// Method
        ////////////////////////////////////////////////////////////////////////////////////////// Private

        #region 페이지 로드시 처리하기 - Page_Loaded(sender, e)

        /// <summary>
        /// 페이지 로드시 처리하기
        /// </summary>
        /// <param name="sender">이벤트 발생자</param>
        /// <param name="e">이벤트 인자</param>
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            this.radioButton1.IsChecked = true;
        }

        #endregion

        #region 축소 스토리보드 완료시 처리하기 - zoomOutStoryboard_Completed(sender, e)

        /// <summary>
        /// 축소 스토리보드 완료시 처리하기
        /// </summary>
        /// <param name="sender">이벤트 발생자</param>
        /// <param name="e">이벤트 인자</param>
        private void zoomOutStoryboard_Completed(object sender, EventArgs e)
        {
            this.frame.Navigate(this.pageArray[this.pageIndex]);
        }

        #endregion
        #region 프레임 컨텐트 렌더링시 처리하기 - frame_ContentRendered(sender, e)

        /// <summary>
        /// 프레임 컨텐트 렌더링시 처리하기
        /// </summary>
        /// <param name="sender">이벤트 발생자</param>
        /// <param name="e">이벤트 인자</param>
        private void frame_ContentRendered(object sender, EventArgs e)
        {
            Storyboard storyboard = Resources["ZoomInStoryboardKey"] as Storyboard;

            storyboard.Begin(this);
        }

        #endregion
        #region 확대 스토리보드 완료시 처리하기 - zoomInStoryboard_Completed(sender, e)

        /// <summary>
        /// 확대 스토리보드 완료시 처리하기
        /// </summary>
        /// <param name="sender">이벤트 발생자</param>
        /// <param name="e">이벤트 인자</param>
        private void zoomInStoryboard_Completed(object sender, EventArgs e)
        {
            this.scrollViewerBorder.Visibility = Visibility.Visible;
        }

        #endregion
        #region 라디오 버튼 클릭시 처리하기 - radioButton_Checked(sender, e)

        /// <summary>
        /// 라디오 버튼 클릭시 처리하기
        /// </summary>
        /// <param name="sender">이벤트 발생자</param>
        /// <param name="e">이벤트 인자</param>
        private void radioButton_Checked(object sender, RoutedEventArgs e)
        {
            Point3DCollection pointCollection = new Point3DCollection();
         
            double ratio = this.scrollViewer.ActualWidth / this.scrollViewer.ActualHeight;
         
            pointCollection.Add(new Point3D( 5, -5 * ratio, 0));
            pointCollection.Add(new Point3D( 5,  5 * ratio, 0));
            pointCollection.Add(new Point3D(-5,  5 * ratio, 0));
         
            pointCollection.Add(new Point3D(-5,  5 * ratio, 0));
            pointCollection.Add(new Point3D(-5, -5 * ratio, 0));
            pointCollection.Add(new Point3D( 5, -5 * ratio, 0));

            pointCollection.Add(new Point3D(-5,  5 * ratio, 0));
            pointCollection.Add(new Point3D(-5, -5 * ratio, 0));
            pointCollection.Add(new Point3D( 5, -5 * ratio, 0));
         
            pointCollection.Add(new Point3D( 5, -5 * ratio, 0));
            pointCollection.Add(new Point3D( 5,  5 * ratio, 0));
            pointCollection.Add(new Point3D(-5,  5 * ratio, 0));
       
            this.meshGeometry3D.Positions = pointCollection;

            this.viewport3D.Width  = 100;
            this.viewport3D.Height = 100 * ratio;
         
            this.scrollViewerBorder.Visibility = Visibility.Hidden; 
         
            RadioButton radioButton = sender as RadioButton;

            if(radioButton != null)
            {
                if(radioButton.Content.ToString() == "지오메트리 사용")
                {
                    pageIndex = 0;
                }
                else if(radioButton.Content.ToString() == "도형 지오메트리")
                {
                    pageIndex = 1;
                }
                else if(radioButton.Content.ToString() == "패스 지오메트리")
                {
                    pageIndex = 2;
                }
                else if(radioButton.Content.ToString() == "지오메트리 결합")
                {
                     pageIndex = 3;
                }
                else if(radioButton.Content.ToString() == "지오메트리 속성 문법")
                {
                    pageIndex = 4;
                }
            }
        }

        #endregion
    }
}
728x90
반응형
그리드형(광고전용)
Posted by icodebroker

댓글을 달아 주세요