CustomDialog
http://dis.dankook.ac.kr/lectures/hci09/entry/CustomDialog
MDI
Mouse, Menu, Dialog
lecture10
Aridity Index
건조지수(Aridity Index)를 구하고, 기후의 상태를 알려주는 프로그램을 작성한다
![사용자 삽입 이미지](http://dis.dankook.ac.kr/lectures/hci12/attach/1/4534340817.jpg)
(1) 사용자에게 연강수량(Precipitation)과 연평균기온(Temperature)를 입력 받는다. 연강수량의 단위는 mm이고, 연평균기온의 단위는 oC이다.
(2) 건조지수를 다음 공식으로 계산하고 결과를 화면에 출력한다.
건조지수 AI = Precipitation/ (Temperature + 10)
(3) 다음 기준에 따라 기후의 상태를 판단해서 화면에 출력한다.
AI >= 60 => Perhumid
30 <= AI < 60 => Humid
20 <= AI < 30 => SubHumid
15 <= AI < 20 => SemiArid
5 <= AI < 15 => Arid
AI < 5 => ExtremelyArid
StandardWeightCalculator
표준체중계산기
-label, button, radiobutton, textbox
![사용자 삽입 이미지](http://dis.dankook.ac.kr/lectures/hci11/attach/1/3311263942.jpg)
TRACE
TRACE macro
-윈도우 응용프로그램 개발시 Visual Studio IDE의 Output Window (출력창)에 Debug하는 내용을 출력하고자 할 때 System.Diagnostics.Trace.WriteLine(…..)을 사용
-기존의 C# Console 응용프로그램에서 System.Console.WriteLine(….)와 동일
-기존의 MFC 윈도우 프로그래밍에서 TRACE 매크로와 비슷 (C의 printf와 동일한 형식 지원)
-기존의 WIN32 윈도우 프로그래밍에서 OutputDebugString 함수와 같은 기능 (C의 printf와 동일한 형식 지원)
HW3 class
————————————————————————-
Program.cs
Main()
– WeatherInfoFileManager.Import(디렉토리, 파일확장자명, ref wList)
while (종료하지않는다면) {
-LINQ 쿼리 (사용자 입력은 쿼리방식 지정)
-WeatherInfoFileManager.Export(쿼리파일명, ref queriedList)
-WeatherInfoManger Sort 후(사용자 입력은 Sort방식 지정)
-WeatherInfoFileManager.Export(소스된파일명, ref sortedList)
}
————————————————————————-
WeatherInfo: IComparable<WeatherInfo>, IEquatable<WeatherInfo>
– 년,월,일,기온,… WindChillTemperature & HeatIndex 추가
————————————————————————-
WeatherInfoComparer.cs (여러개의 컴패어러 클래스들 포함)
-class WeatherYearComparer : IComparer<WeatherInfo>
-class WeatherMonthComparer : IComparer<WeatherInfo>
….
————————————————————————-
WeatherInfoManager
–public List<WeatherInfo> wList = new List<WeatherInfo>();
-public void Sort(SortMode mode) { // 내부구현 필요 }
-public void Print()
-LINQ 사용해서 특정날짜나 특정 기준에 맞는 쿼리를 함
————————————————————————-
WeatherInfoFileManager
-public static void Import(string path, string ext, ref List<WeatherInfo> tList)
string[] files = Directory.GetFiles(path, ext);
-public static void Import(string filename, ref List<WeatherInfo> tList)
-public static void Export(string filename, ref IList<WeatherInfo> tList)
Integer Number Only Textbox
private void textBox1_KeyPress(object
sender, KeyPressEventArgs e)
{
int value = 0;
e.Handled = !int.TryParse(e.KeyChar.ToString(), out value);
}
private void
textBox2_KeyPress(object sender, KeyPressEventArgs e)
{
if (!System.Text.RegularExpressions.Regex.IsMatch(e.KeyChar.ToString(), “\\d+”))
e.Handled = true;
}
// NumberTextBoxLib custom control (inherited from TextBox)
public
partial class NumberTextBox : TextBox
{
public NumberTextBox()
{
InitializeComponent();
}
protected override void OnKeyPress(KeyPressEventArgs e)
{
base.OnKeyPress(e);
int value = 0;
e.Handled = !int.TryParse(e.KeyChar.ToString(), out value);
}
}
C# Windows Forms Controls
Label, Button 사용예
http://dis.dankook.ac.kr/lectures/hci09/entry/Controls
Buttons
http://dis.dankook.ac.kr/lectures/hci09/entry/Buttons
GroupBox
http://dis.dankook.ac.kr/lectures/hci09/entry/GroupBox
TextBox
http://dis.dankook.ac.kr/lectures/hci09/entry/TextBox
LinkedLabel
http://dis.dankook.ac.kr/lectures/hci09/entry/Linked-Label
ListBox
http://dis.dankook.ac.kr/lectures/hci09/entry/ListBox
Poll
http://dis.dankook.ac.kr/lectures/hci09/entry/Poll
PictureBox
http://dis.dankook.ac.kr/lectures/hci09/entry/Picture-Timer
TabControl
http://dis.dankook.ac.kr/lectures/hci09/entry/Tab-Control
TreeControl
http://dis.dankook.ac.kr/lectures/hci09/entry/Tree-Control
ListView
http://dis.dankook.ac.kr/lectures/hci09/entry/ListView
Textbox (Number Only)
http://dis.dankook.ac.kr/lectures/hci09/entry/Number-Only-Textbox