form1.cs
来自「微软(Microsoft)出版社C井练习文件及解答」· CS 代码 · 共 107 行
CS
107 行
#region Using directives
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Windows.Forms;
#endregion
namespace PrimitiveDataTypes
{
partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void type_SelectedIndexChanged(object sender, System.EventArgs e)
{
switch (type.Text)
{
case "int":
showIntValue();
break;
case "long":
showLongValue();
break;
case "float":
showFloatValue();
break;
case "double":
showDoubleValue();
break;
case "decimal":
showDecimalValue();
break;
case "string":
showStringValue();
break;
case "char":
showCharValue();
break;
case "bool":
showBoolValue();
break;
}
}
private void showIntValue()
{
value.Text = "to do";
}
private void showLongValue()
{
long var;
var = 42L;
value.Text = "42L";
}
private void showFloatValue()
{
float var;
var = 0.42F;
value.Text = "0.42F";
}
private void showDoubleValue()
{
value.Text = "to do";
}
private void showDecimalValue()
{
decimal var;
var = 0.42M;
value.Text = "0.42M";
}
private void showStringValue()
{
string var;
var = "42";
value.Text = "\"42\"";
}
private void showCharValue()
{
char var;
var = '4';
value.Text = "'4'";
}
private void showBoolValue()
{
value.Text = "to do";
}
private void quit_Click(object sender, System.EventArgs e)
{
Application.Exit();
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?