Lab Report 04 21200324

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Báo cáo thực hành – Kỹ thuật lập trình nâng cao

Họ và tên: Trần Quang Nhựt

MSSV: 21200324

Lớp: 21DTV_DienTu

Lab 04. Làm quen với thiết kế giao diện

Bài 1:

Code
<StackPanel Orientation="Vertical" VerticalAlignment="Center"
Height="370"

Background="#FFD3A6A6">

<TextBox x:Name="NameTextBox" PlaceholderText="Nhập IQ" Width="200"


Margin="0

30 0 30" Foreground="#FFF32121" Background="#66E82323"

PlaceholderForeground="#FF2653B4" FontWeight="Bold" />

<Button x:Name="ClickMeButton" Content="Ấn để xem mức độ thông minh!"

Width="250" Height="50" Click="ClickMeButton_Click"


HorizontalAlignment="Center"

FocusVisualPrimaryBrush="#FF9DDC16" Foreground="#FFDEB21B"
Background="#332130C9"

BorderBrush="#FFDE1414"/>

<TextBlock x:Name="DisplayTextBlock" Width="400" Height="50"


Margin="0 30 0

0" Foreground="#FF0A252B" VerticalAlignment="Center"


HorizontalAlignment="Center"

TextAlignment="Center"/>

</StackPanel>

Hình ảnh chụp kết quả

1
Báo cáo thực hành – Kỹ thuật lập trình nâng cao

Bài 2

Code ClickMeButton_Click

private void ClickMeButton_Click(object sender,


RoutedEventArgs e)

string _text;

int iq = Int16.Parse(NameTextBox.Text);

if (iq < 85) _text = "Thấp";

else if (iq >= 85 && iq < 115) _text = "Bình thường";

else if (iq >= 115 && iq < 130) _text = "Thông minh";

else if (iq >= 130 && iq < 145) _text = "Rất thông minh";

else _text = "Thiên tài";

DisplayTextBlock.Text = _text;

ClickMeButton.Background = new
SolidColorBrush(Windows.UI.Colors.Red);

Hình ảnh chụp kết quả

You might also like