반응형

1. xaml

계산기 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 Content="0"

x:Name="resultLabel"

Grid.ColumnSpan="4"

Grid.Row="0"

HorizontalContentAlignment="Right"

VerticalContentAlignment="Bottom"

FontSize="100"/>

<Button Grid.Column="0"

Grid.Row="1"

Content="AC"

FontSize="30"

Margin="5,5,5,5"/>

<Button Grid.Column="1"

Grid.Row="1"

Content="+/-"

FontSize="30"

Margin="5,5,5,5"/>

<Button Grid.Column="2"

Grid.Row="1"

Content="%"

FontSize="30"

Margin="5,5,5,5"/>

<Button Grid.Column="3"

Grid.Row="1"

Content="/"

Background="Green"

Margin="5,5,5,5"

FontSize="30"/>

<Button Grid.Column="0"

Grid.Row="2"

Content="7"

Foreground="white"

Background="Gray"

Margin="5,5,5,5"

FontSize="30"/>

<Button Grid.Column="1"

Grid.Row="2"

Content="8"

Foreground="white"

Background="Gray"

FontSize="30"

Margin="5,5,5,5"/>

<Button Grid.Column="2"

Grid.Row="2"

Content="9"

Foreground="white"

Background="Gray"

Margin="5,5,5,5"

FontSize="30"/>

<Button Grid.Column="3"

Grid.Row="2"

Content="*"

Background="Green"

Margin="5,5,5,5"

FontSize="30"/>

<Button Grid.Column="0"

Grid.Row="3"

Content="4"

Foreground="white"

Background="Gray"

Margin="5,5,5,5"

FontSize="30"/>

<Button Grid.Column="1"

Grid.Row="3"

Content="5"

Foreground="white"

Background="Gray"

Margin="5,5,5,5"

FontSize="30"/>

<Button Grid.Column="2"

Grid.Row="3"

Content="6"

Foreground="white"

Background="Gray"

Margin="5,5,5,5"

FontSize="30"/>

<Button Grid.Column="3"

Grid.Row="3"

Content="-"

Background="Green"

Margin="5,5,5,5"

FontSize="30"/>

<Button Grid.Column="0"

Grid.Row="4"

Content="1"

Foreground="white"

Background="Gray"

Margin="5,5,5,5"

FontSize="30"/>

<Button Grid.Column="1"

Grid.Row="4"

Content="2"

Foreground="white"

Background="Gray"

Margin="5,5,5,5"

FontSize="30"/>

<Button Grid.Column="2"

Grid.Row="4"

Content="3"

Foreground="white"

Background="Gray"

Margin="5,5,5,5"

FontSize="30"/>

<Button Grid.Column="3"

Grid.Row="4"

Content="+"

Background="Green"

Margin="5,5,5,5"

FontSize="30"/>

<Button Grid.Column="0"

Grid.Row="5"

Content="0"

Margin="5,5,5,-13"

Grid.ColumnSpan="2"

Foreground="white"

Background="Gray"

FontSize="30"/>

<Button Grid.Column="2"

Grid.Row="5"

Content="."

Foreground="white"

Background="Gray"

FontSize="30"

Margin="5,5,5,-13"/>

<Button Grid.Column="3"

Grid.Row="5"

Content="="

Background="Green"

Margin="5,5,5,-13"

FontSize="30"/>

</Grid>

</Window>

 

2. 수정해야 할 사항

   1) 코드가 너무 하드해서, 각 버튼별로 정리가 필요함

   2) 다음 게시 전까지 코드를 정리하여 올릴 예정

반응형
  • 네이버 블러그 공유하기
  • 네이버 밴드에 공유하기
  • 페이스북 공유하기
  • 카카오스토리 공유하기