1. xaml
1-(1) xaml 소스 코드
<Window x:Class="cal.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:cal"
mc:Ignorable="d"
Title="MainWindow" Height="628.153" Width="406.745">
<Grid HorizontalAlignment="Left" Width="404" Margin="0,0,-5,-1">
<Grid.RowDefinitions>
<RowDefinition Height="200"/>
<RowDefinition Height="75"/>
<RowDefinition Height="75"/>
<RowDefinition Height="75"/>
<RowDefinition Height="75"/>
<RowDefinition Height="75"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100"/>
<ColumnDefinition Width="100"/>
<ColumnDefinition Width="100"/>
<ColumnDefinition Width="100"/>
</Grid.ColumnDefinitions>
<Label x:Name="resultLabel"
Content="0"
Grid.ColumnSpan="4"
Grid.Row="0"
HorizontalContentAlignment="Right"
VerticalContentAlignment="Bottom"
FontSize="100"/>
<!-- 숫자 버튼 0 -->
<Button x:Name="ZeroButton"
Grid.Column="0"
Grid.Row="5"
Content="0"
Margin="5,5,5,-13"
Grid.ColumnSpan="2"
Foreground="white"
Background="Gray"
FontSize="30"/>
<!-- 숫자 버튼 1 -->
<Button x:Name="OneButton"
Grid.Column="0"
Grid.Row="4"
Content="1"
Foreground="white"
Background="Gray"
Margin="5,5,5,5"
FontSize="30"/>
<!-- 숫자 버튼 2 -->
<Button x:Name="TwoButton"
Grid.Column="1"
Grid.Row="4"
Content="2"
Foreground="white"
Background="Gray"
Margin="5,5,5,5"
FontSize="30"/>
<!-- 숫자 버튼 3 -->
<Button x:Name="ThreeButton"
Grid.Column="2"
Grid.Row="4"
Content="3"
Foreground="white"
Background="Gray"
Margin="5,5,5,5"
FontSize="30"/>
<!-- 숫자 버튼 4 -->
<Button x:Name="FourButton"
Grid.Column="0"
Grid.Row="3"
Content="4"
Foreground="white"
Background="Gray"
Margin="5,5,5,5"
FontSize="30"/>
<!-- 숫자 버튼 5 -->
<Button x:Name="FiveButton"
Grid.Column="1"
Grid.Row="3"
Content="5"
Foreground="white"
Background="Gray"
Margin="5,5,5,5"
FontSize="30"/>
<!-- 숫자 버튼 6 -->
<Button x:Name="SixButton"
Grid.Column="2"
Grid.Row="3"
Content="6"
Foreground="white"
Background="Gray"
Margin="5,5,5,5"
FontSize="30"/>
<!-- 숫자 버튼 7 -->
<Button x:Name="SevenButton"
Grid.Column="0"
Grid.Row="2"
Content="7"
Foreground="white"
Background="Gray"
Margin="5,5,5,5"
FontSize="30"
Click="Button_Click"/>
<!-- 숫자 버튼 8 -->
<Button x:Name="EightButton"
Grid.Column="1"
Grid.Row="2"
Content="8"
Foreground="white"
Background="Gray"
FontSize="30"
Margin="5,5,5,5"/>
<!-- 숫자 버튼 9 -->
<Button x:Name="NineButton"
Grid.Column="2"
Grid.Row="2"
Content="9"
Foreground="white"
Background="Gray"
Margin="5,5,5,5"
FontSize="30"/>
<!--연산버튼 AC-->
<Button x:Name="AcButton"
Grid.Column="0"
Grid.Row="1"
Content="AC"
FontSize="30"
Margin="5,5,5,5" Click="AcButton_Click"/>
<!-- 연산버튼 Plus/Minus -->
<Button x:Name="PlusMinusButton"
Grid.Column="1"
Grid.Row="1"
Content="+/-"
FontSize="30"
Margin="5,5,5,5"/>
<!-- 연산버튼 Percent -->
<Button x:Name="PercentButton"
Grid.Column="2"
Grid.Row="1"
Content="%"
FontSize="30"
Margin="5,5,5,5"/>
<!-- 연산버튼 Devide -->
<Button x:Name="DevideButton"
Grid.Column="3"
Grid.Row="1"
Content="/"
Background="Green"
Margin="5,5,5,5"
FontSize="30"/>
<!-- 연산버튼 Multiple -->
<Button x:Name="MultipleButton"
Grid.Column="3"
Grid.Row="2"
Content="*"
Background="Green"
Margin="5,5,5,5"
FontSize="30"/>
<!-- 연산버튼 Minus -->
<Button x:Name="MinusButton"
Grid.Column="3"
Grid.Row="3"
Content="-"
Background="Green"
Margin="5,5,5,5"
FontSize="30"/>
<!-- 연산버튼 Plus -->
<Button x:Name="PlusButton"
Grid.Column="3"
Grid.Row="4"
Content="+"
Background="Green"
Margin="5,5,5,5"
FontSize="30"/>
<!-- 연산버튼 Dot -->
<Button x:Name="DotButton"
Grid.Column="2"
Grid.Row="5"
Content="."
Foreground="white"
Background="Gray"
FontSize="30"
Margin="5,5,5,-13"/>
<!-- 연산버튼 Equl -->
<Button x:Name="EqulButton"
Grid.Column="3"
Grid.Row="5"
Content="="
Background="Green"
Margin="5,5,5,-13"
FontSize="30"/>
</Grid>
</Window>
2. 수정한 사항
1) 어제 작업한 것에 코드를 깔끔하게 정리
2) 7버튼에 대한 이벤트 함수 생성
3) AC 버튼에 대한 이벤트 함수 생성
'Language > C# WPF Programming' 카테고리의 다른 글
C# WPF 프로그래밍 탭 컨트롤(Tab Control) 구현하기 (0) | 2019.04.18 |
---|---|
C# WPF 프로그래밍 메뉴(Menu) 아이템 컨트롤 구현하기 (0) | 2019.04.17 |
C# WPF 프로그래밍 아이템 컨트롤 리스트 박스(list box)구현 (0) | 2019.04.16 |
C# WPF 프로그래밍 계산기 프로그램 만들기(Calculator) - 3(xaml 코드 수정 및 이벤트 함수 수정) (0) | 2019.04.12 |
C# WPF 프로그래밍 계산기 프로그램 만들기(Calculator) - 1(xaml 구현) (0) | 2019.04.10 |
C# WPF 프로그래밍 label과 TextBlock (0) | 2019.04.09 |
C# WPF 프로그래밍 Radio Button 이벤트 (0) | 2019.04.08 |
C# WPF 프로그래밍 토글 버튼 이벤트 컨트롤 (1) | 2019.04.05 |
최근댓글