728x90
반응형
728x170
▶ 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="Cursor 클래스 : 리소스 커서 로드하기"
FontFamily="나눔고딕코딩"
FontSize="16">
<Grid>
<Button Name="button"
Width="100"
Height="30"
Content="테스트" />
</Grid>
</Window>
728x90
▶ MainWindow.xaml.cs
using System;
using System.Windows;
using System.Windows.Input;
using System.Windows.Resources;
namespace TestProject
{
/// <summary>
/// 메인 윈도우
/// </summary>
public partial class MainWindow : Window
{
//////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
////////////////////////////////////////////////////////////////////////////////////////// Public
#region 생성자 - MainWindow()
/// <summary>
/// 생성자
/// </summary>
public MainWindow()
{
InitializeComponent();
this.button.Click += button_Click;
}
#endregion
//////////////////////////////////////////////////////////////////////////////////////////////////// Method
////////////////////////////////////////////////////////////////////////////////////////// Private
#region 테스트 버튼 클릭시 처리하기 - button_Click(sender, e)
/// <summary>
/// 테스트 버튼 클릭시 처리하기
/// </summary>
/// <param name="sender">이벤트 발생자</param>
/// <param name="e">이벤트 인자</param>
private void button_Click(object sender, RoutedEventArgs e)
{
Uri uri = new Uri("CURSOR/sample.cur", UriKind.Relative);
StreamResourceInfo streamResourceInfo = Application.GetResourceStream(uri);
Cursor = new Cursor(streamResourceInfo.Stream);
}
#endregion
}
}
728x90
반응형
그리드형(광고전용)
'C# > WPF' 카테고리의 다른 글
[C#/WPF] Polygon 클래스 : 다각형 그리기/편집하기 (0) | 2020.08.09 |
---|---|
[C#/WPF] Keyboard 클래스 : FocusedElement 정적 속성을 사용해 포커스 엘리먼트 구하기 (0) | 2020.08.09 |
[C#/WPF] FocusManager 클래스 : GetFocusedElement 정적 메소드를 사용해 포커스 엘리먼트 구하기 (0) | 2020.08.09 |
[C#/WPF] FrameworkElement 클래스 : MoveFocus 메소드를 사용해 포커스 이동하기 (0) | 2020.08.09 |
[C#/WPF] Button 엘리먼트 : Style 속성 사용하기 (0) | 2020.08.09 |
[C#/WPF] Mouse 클래스 : OverrideCursor 정적 속성을 사용해 커서 설정하기 (0) | 2020.08.09 |
[C#/WPF] Clipboard 클래스 : GetText 정적 메소드를 사용해 HTML 구하기 (0) | 2020.08.08 |
[C#/WPF] UIElement 클래스 : DragEnter/GiveFeedback/DragOver/Drop/DragLeave 이벤트를 사용해 드래그하기 (0) | 2020.08.08 |
[C#/WPF] Thumb 엘리먼트 : DragStarted/DragDelta/DragCompleted 이벤트를 사용해 드래그 하기 (0) | 2020.08.08 |
[C#/WPF] Calendar 클래스 사용하기 (0) | 2020.08.08 |
댓글을 달아 주세요