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

Image2.png
0.01MB

▶ 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="로딩 패널 표시하기"
    Background="Gold"
    FontFamily="나눔고딕코딩"
    FontSize="16">
    <Grid>
        <Grid
            HorizontalAlignment="Center"
            VerticalAlignment="Center">
            <Image Name="image"
                HorizontalAlignment="Center"
                VerticalAlignment="Center"
                Width="150"
                Height="150"
                Stretch="Fill"
                Source="IMAGE/loading.png" />
            <Label
                HorizontalAlignment="Center"
                VerticalAlignment="Center"
                Content="Loading" />
        </Grid>
    </Grid>
</Window>

 

728x90

 

▶ MainWindow.xaml.cs

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

namespace TestProject
{
    /// <summary>
    /// 메인 윈도우
    /// </summary>
    public partial class MainWindow : Window
    {
        //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
        ////////////////////////////////////////////////////////////////////////////////////////// Public

        #region 생성자 - MainWindow()

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

            DoubleAnimation doubleAnimation = new DoubleAnimation();

            doubleAnimation.RepeatBehavior = RepeatBehavior.Forever;
            doubleAnimation.Duration       = new Duration(TimeSpan.FromSeconds(1));
            doubleAnimation.From           = 0;
            doubleAnimation.To             = 360;
 
            RotateTransform rotateTransform = new RotateTransform();

            rotateTransform.CenterX += this.image.Width  / 2;
            rotateTransform.CenterY += this.image.Height / 2;
 
            this.image.RenderTransform = rotateTransform;

            rotateTransform.BeginAnimation(RotateTransform.AngleProperty, doubleAnimation); 
        }

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

댓글을 달아 주세요