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="MessageBox 클래스 : Show 정적 메소드를 사용해 최상위 메시지 박스 표시하기"
FontFamily="나눔고딕코딩"
FontSize="16">
<Grid>
<Button Name="showButton"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Width="160"
Height="30"
Content="메시지 박스 표시" />
</Grid>
</Window>
728x90
▶ MainWindow.xaml.cs
using System.Windows;
namespace TestProject
{
/// <summary>
/// 메인 윈도우
/// </summary>
public partial class MainWindow : Window
{
//////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
////////////////////////////////////////////////////////////////////////////////////////// Public
#region 생성자 - MainWindow()
/// <summary>
/// 생성자
/// </summary>
public MainWindow()
{
InitializeComponent();
this.showButton.Click += showButton_Click;
}
#endregion
//////////////////////////////////////////////////////////////////////////////////////////////////// Method
////////////////////////////////////////////////////////////////////////////////////////// Private
#region 메시지 박스 표시 버튼 클릭시 처리하기 - showButton_Click(sender, e)
/// <summary>
/// 메시지 박스 표시 버튼 클릭시 처리하기
/// </summary>
/// <param name="sender">이벤트 발생자</param>
/// <param name="e">이벤트 인자</param>
private void showButton_Click(object sender, RoutedEventArgs e)
{
MessageBox.Show
(
"최상위 메시지 박스를 표시합니다.",
"INFORMATION",
MessageBoxButton.OK,
MessageBoxImage.Information,
MessageBoxResult.OK,
MessageBoxOptions.DefaultDesktopOnly
);
}
#endregion
}
}
728x90
반응형
그리드형(광고전용)
'C# > WPF' 카테고리의 다른 글
[C#/WPF] ControlTemplate 엘리먼트 : Button 엘리먼트 정의하기 (0) | 2022.05.25 |
---|---|
[C#/WPF] ContentPresenter 엘리먼트 : RecognizesAccessKey 속성을 사용해 액세스 키 사용 여부 설정하기 (0) | 2022.05.25 |
[C#/WPF] ContentControl 클래스 : 원형 파급 효과 애니메이션 컨트롤 만들기 (0) | 2022.05.25 |
[C#/WPF] WebBrowser 엘리먼트 : 스크립트 오류 억제하기 (0) | 2022.05.24 |
[C#/WPF] InputMethod 엘리먼트 : PreferredImeState/PreferredImeConversionMode 첨부 속성을 사용해 한글 모드에서 입력 시작하기 (0) | 2022.05.24 |
[C#/WPF] 환형 진행바 애니메이션 만들기 (0) | 2022.05.07 |
[C#/WPF] Storyboard 엘리먼트 : 슬라이딩 패널 만들기 (0) | 2022.02.04 |
[C#/WPF] 투명 윈도우 마우스 따라다니기 (0) | 2022.01.29 |
[C#/WPF] Visual 클래스 : PointToScreen 메소드를 사용해 마우스 화면 좌표 구하기 (0) | 2022.01.29 |
[C#/WPF] Button 엘리먼트 : FocusVisualStyle 속성을 사용해 포커스 비주얼 스타일 설정하기 (0) | 2022.01.28 |
댓글을 달아 주세요