첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.
유용한 소스 코드가 있으면 icodebroker@naver.com으로 보내주시면 감사합니다.
블로그 자료는 자유롭게 사용하세요.

728x90
반응형

■ Viewport2DVisual3D 엘리먼트 : 곡선 형태의 ScrollBar 사용하기

------------------------------------------------------------------------------------------------------------------------


TestProject.zip



MainWindow.xaml

 

 

<Window 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="Viewport2DVisual3D 엘리먼트 : 곡선 형태의 ScrollBar 사용하기"

    FontFamily="나눔고딕코딩"

    FontSize="16">

    <Grid>

        <Viewport3D

            Width="500"

            Height="500">

            <Viewport2DVisual3D>

                <Viewport2DVisual3D.Geometry>

                    <MeshGeometry3D

                        TriangleIndices="

                            0   1   2   1   3   2   2   3   4   3

                            5   4   4   5   6   5   7   6   6   7

                            8   7   9   8   8   9   10  9   11  10

                            10  11  12  11  13  12  12  13  14  13

                            15  14  14  15  16  15  17  16  16  17

                            18  17  19  18  18  19  20  19  21  20

                            20  21  22  21  23  22  22  23  24  23

                            25  24  24  25  26  25  27  26  26  27

                            28  27  29  28  28  29  30  29  31  30

                            30  31  32  31  33  32  32  33  34  33

                            35  34  34  35  36  35  37  36  36  37

                            38  37  39  38  38  39  40  39  41  40

                            40  41  42  41  43  42  42  43  44  43

                            45  44  44  45  46  45  47  46  46  47

                            48  47  49  48  48  49  50  49  51  50

                            50  51  52  51  53  52  52  53  54  53

                            55  54  54  55  56  55  57  56  56  57

                            58  57  59  58  58  59  60  59  61  60

                            60  61  62  61  63  62  62  63  64  63

                            65  64  64  65  66  65  67  66  66  67

                            68  67  69  68  68  69  70  69  71  70

                            70  71  72  71  73  72  72  73  74  73

                            75  74  74  75  76  75  77  76  76  77

                            78  77  79  78  78  79  80  79  81  80

                            80  81  82  81  83  82  82  83  84  83

                            85  84  84  85  86  85  87  86  86  87

                            88  87  89  88  88  89  90  89  91  90

                            90  91  92  91  93  92  92  93  94  93

                            95  94  94  95  96  95  97  96  96  97

                            98  97  99  98  98  99  100 99  101 100

                            100 101 102 101 103 102 102 103 104 103

                            105 104 104 105 106 105 107 106 106 107

                            108 107 109 108 108 109 110 109 111 110

                            110 111 112 111 113 112 112 113 114 113

                            115 114 114 115 116 115 117 116 116 117

                            118 117 119 118 118 119 120 119 121 120

                            120 121 122 121 123 122 122 123 124 123

                            125 124 124 125 126 125 127 126 126 127

                            128 127 129 128 128 129 130 129 131 130

                            130 131 132 131 133 132 132 133 134 133

                            135 134 134 135 136 135 137 136 136 137

                            138 137 139 138 138 139 140 139 141 140

                            140 141 142 141 143 142 142 143 144 143

                            145 144 144 145 146 145 147 146 146 147

                            148 147 149 148 148 149 150 149 151 150

                            150 151 152 151 153 152 152 153 154 153

                            155 154 154 155 156 155 157 156 156 157

                            158 157 159 158 158 159 160 159 161 160

                            160 161 162 161 163 162 162 163 164 163

                            165 164 164 165 166 165 167 166 166 167

                            168 167 169 168 168 169 170 169 171 170

                            170 171 172 171 173 172 172 173 174 173

                            175 174 174 175 176 175 177 176 176 177

                            178 177 179 178 178 179 180 179 181 180

                            180 181 182 181 183 182 182 183 184 183

                            185 184 184 185 186 185 187 186 186 187

                            188 187 189 188 188 189 190 189 191 190

                            190 191 192 191 193 192 192 193 194 193

                            195 194 194 195 196 195 197 196 196 197

                            198 197 199 198 198 199 200 199 201 200"

                        TextureCoordinates="

                            0.00 0 0.00 1 0.01 0 0.01 1 0.02 0

                            0.02 1 0.03 0 0.03 1 0.04 0 0.04 1

                            0.05 0 0.05 1 0.06 0 0.06 1 0.07 0

                            0.07 1 0.08 0 0.08 1 0.09 0 0.09 1

                            0.10 0 0.10 1 0.11 0 0.11 1 0.12 0

                            0.12 1 0.13 0 0.13 1 0.14 0 0.14 1

                            0.15 0 0.15 1 0.16 0 0.16 1 0.17 0

                            0.17 1 0.18 0 0.18 1 0.19 0 0.19 1

                            0.20 0 0.20 1 0.21 0 0.21 1 0.22 0

                            0.22 1 0.23 0 0.23 1 0.24 0 0.24 1

                            0.25 0 0.25 1 0.26 0 0.26 1 0.27 0

                            0.27 1 0.28 0 0.28 1 0.29 0 0.29 1

                            0.30 0 0.30 1 0.31 0 0.31 1 0.32 0

                            0.32 1 0.33 0 0.33 1 0.34 0 0.34 1

                            0.35 0 0.35 1 0.36 0 0.36 1 0.37 0

                            0.37 1 0.38 0 0.38 1 0.39 0 0.39 1

                            0.40 0 0.40 1 0.41 0 0.41 1 0.42 0

                            0.42 1 0.43 0 0.43 1 0.44 0 0.44 1

                            0.45 0 0.45 1 0.46 0 0.46 1 0.47 0

                            0.47 1 0.48 0 0.48 1 0.49 0 0.49 1

                            0.50 0 0.50 1 0.51 0 0.51 1 0.52 0

                            0.52 1 0.53 0 0.53 1 0.54 0 0.54 1

                            0.55 0 0.55 1 0.56 0 0.56 1 0.57 0

                            0.57 1 0.58 0 0.58 1 0.59 0 0.59 1

                            0.60 0 0.60 1 0.61 0 0.61 1 0.62 0

                            0.62 1 0.63 0 0.63 1 0.64 0 0.64 1

                            0.65 0 0.65 1 0.66 0 0.66 1 0.67 0

                            0.67 1 0.68 0 0.68 1 0.69 0 0.69 1

                            0.70 0 0.70 1 0.71 0 0.71 1 0.72 0

                            0.72 1 0.73 0 0.73 1 0.74 0 0.74 1

                            0.75 0 0.75 1 0.76 0 0.76 1 0.77 0

                            0.77 1 0.78 0 0.78 1 0.79 0 0.79 1

                            0.80 0 0.80 1 0.81 0 0.81 1 0.82 0

                            0.82 1 0.83 0 0.83 1 0.84 0 0.84 1

                            0.85 0 0.85 1 0.86 0 0.86 1 0.87 0

                            0.87 1 0.88 0 0.88 1 0.89 0 0.89 1

                            0.90 0 0.90 1 0.91 0 0.91 1 0.92 0

                            0.92 1 0.93 0 0.93 1 0.94 0 0.94 1

                            0.95 0 0.95 1 0.96 0 0.96 1 0.97 0

                            0.97 1 0.98 0 0.98 1 0.99 0 0.99 1

                            1.00 0 1.00 1"

                        Positions="

                            -1.000 0.000  0      -1.250 0.000  0      -1.000 -0.031 0      -1.249

                            -0.039 0      -0.998 -0.063 0      -1.248 -0.078 0      -0.996 -0.094

                            0      -1.244 -0.118 0      -0.992 -0.125 0      -1.240 -0.157 0

                            -0.988 -0.156 0      -1.235 -0.196 0      -0.982 -0.187 0      -1.228

                            -0.234 0      -0.976 -0.218 0      -1.220 -0.273 0      -0.969 -0.249

                            0      -1.211 -0.311 0      -0.960 -0.279 0      -1.200 -0.349 0

                            -0.951 -0.309 0      -1.189 -0.386 0      -0.941 -0.339 0      -1.176

                            -0.423 0      -0.930 -0.368 0      -1.162 -0.460 0      -0.918 -0.397

                            0      -1.147 -0.496 0      -0.905 -0.426 0      -1.131 -0.532 0

                            -0.891 -0.454 0      -1.114 -0.567 0      -0.876 -0.482 0      -1.095

                            -0.602 0      -0.861 -0.509 0      -1.076 -0.636 0      -0.844 -0.536

                            0      -1.055 -0.670 0      -0.827 -0.562 0      -1.034 -0.703 0

                            -0.809 -0.588 0      -1.011 -0.735 0      -0.790 -0.613 0      -0.988

                            -0.766 0      -0.771 -0.637 0      -0.963 -0.797 0      -0.750 -0.661

                            0      -0.938 -0.827 0      -0.729 -0.685 0      -0.911 -0.856 0

                            -0.707 -0.707 0      -0.884 -0.884 0      -0.685 -0.729 0      -0.856

                            -0.911 0      -0.661 -0.750 0      -0.827 -0.938 0      -0.637 -0.771

                            0      -0.797 -0.963 0      -0.613 -0.790 0      -0.766 -0.988 0

                            -0.588 -0.809 0      -0.735 -1.011 0      -0.562 -0.827 0      -0.703

                            -1.034 0      -0.536 -0.844 0      -0.670 -1.055 0      -0.509 -0.861

                            0      -0.636 -1.076 0      -0.482 -0.876 0      -0.602 -1.095 0

                            -0.454 -0.891 0      -0.567 -1.114 0      -0.426 -0.905 0      -0.532

                            -1.131 0      -0.397 -0.918 0      -0.496 -1.147 0      -0.368 -0.930

                            0      -0.460 -1.162 0      -0.339 -0.941 0      -0.423 -1.176 0

                            -0.309 -0.951 0      -0.386 -1.189 0      -0.279 -0.960 0      -0.349

                            -1.200 0      -0.249 -0.969 0      -0.311 -1.211 0      -0.218 -0.976

                            0      -0.273 -1.220 0      -0.187 -0.982 0      -0.234 -1.228 0

                            -0.156 -0.988 0      -0.196 -1.235 0      -0.125 -0.992 0      -0.157

                            -1.240 0      -0.094 -0.996 0      -0.118 -1.244 0      -0.063 -0.998

                            0      -0.078 -1.248 0      -0.031 -1.000 0      -0.039 -1.249 0

                            0.000  -1.000 0      0.000  -1.250 0      0.031  -1.000 0      0.039

                            -1.249 0      0.063  -0.998 0      0.078  -1.248 0      0.094  -0.996

                            0      0.118  -1.244 0      0.125  -0.992 0      0.157  -1.240 0

                            0.156  -0.988 0      0.196  -1.235 0      0.187  -0.982 0      0.234

                            -1.228 0      0.218  -0.976 0      0.273  -1.220 0      0.249  -0.969

                            0      0.311  -1.211 0      0.279  -0.960 0      0.349  -1.200 0

                            0.309  -0.951 0      0.386  -1.189 0      0.339  -0.941 0      0.423

                            -1.176 0      0.368  -0.930 0      0.460  -1.162 0      0.397  -0.918

                            0      0.496  -1.147 0      0.426  -0.905 0      0.532  -1.131 0

                            0.454  -0.891 0      0.567  -1.114 0      0.482  -0.876 0      0.602

                            -1.095 0      0.509  -0.861 0      0.636  -1.076 0      0.536  -0.844

                            0      0.670  -1.055 0      0.562  -0.827 0      0.703  -1.034 0

                            0.588  -0.809 0      0.735  -1.011 0      0.613  -0.790 0      0.766

                            -0.988 0      0.637  -0.771 0      0.797  -0.963 0      0.661  -0.750

                            0      0.827  -0.938 0      0.685  -0.729 0      0.856  -0.911 0

                            0.707  -0.707 0      0.884  -0.884 0      0.729  -0.685 0      0.911

                            -0.856 0      0.750  -0.661 0      0.938  -0.827 0      0.771  -0.637

                            0      0.963  -0.797 0      0.790  -0.613 0      0.988  -0.766 0

                            0.809  -0.588 0      1.011  -0.735 0      0.827  -0.562 0      1.034

                            -0.703 0      0.844  -0.536 0      1.055  -0.670 0      0.861  -0.509

                            0      1.076  -0.636 0      0.876  -0.482 0      1.095  -0.602 0

                            0.891  -0.454 0      1.114  -0.567 0      0.905  -0.426 0      1.131

                            -0.532 0      0.918  -0.397 0      1.147  -0.496 0      0.930  -0.368

                            0      1.162  -0.460 0      0.941  -0.339 0      1.176  -0.423 0

                            0.951  -0.309 0      1.189  -0.386 0      0.960  -0.279 0      1.200

                            -0.349 0      0.969  -0.249 0      1.211  -0.311 0      0.976  -0.218

                            0      1.220  -0.273 0      0.982  -0.187 0      1.228  -0.234 0

                            0.988  -0.156 0      1.235  -0.196 0      0.992  -0.125 0      1.240

                            -0.157 0      0.996  -0.094 0      1.244  -0.118 0      0.998  -0.063

                            0      1.248  -0.078 0      1.000  -0.031 0      1.249  -0.039 0

                            1.000  0.000  0      1.250  0.000  0" />

                </Viewport2DVisual3D.Geometry>

                <Viewport2DVisual3D.Material>

                    <DiffuseMaterial Viewport2DVisual3D.IsVisualHostMaterial="True" />

                </Viewport2DVisual3D.Material>

                <ScrollBar Name="scrollBar"

                    Width="200"

                    Orientation="Horizontal"

                    Maximum="10" />

            </Viewport2DVisual3D>

            <ModelVisual3D>

                <ModelVisual3D.Content>

                    <AmbientLight Color="White" />

                </ModelVisual3D.Content>

            </ModelVisual3D>

            <Viewport3D.Camera>

                <PerspectiveCamera Position="0 0 4" />

            </Viewport3D.Camera>

        </Viewport3D>

        <TextBlock

            Margin="0 100 0 0"

            VerticalAlignment="Top"

            HorizontalAlignment="Center"

            FontSize="30"

            Foreground="SteelBlue"

            Text="{Binding ElementName=scrollBar, Path=Value}" />

    </Grid>

</Window>

 

------------------------------------------------------------------------------------------------------------------------

728x90
반응형
Posted by 사용자 icodebroker

댓글을 달아 주세요