팡이네

윈도우에 등록된 확장자를 가진 파일을 열고자 할 때 사용한다.

간단하게
1
Process.Start(filePath);
또는
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
private void OpenFile(string filePath)
{
    try
    {
        System.Diagnostics.ProcessStartInfo info = new System.Diagnostics.ProcessStartInfo();
        info.RedirectStandardOutput = true;
        info.UseShellExecute = false;
        info.CreateNoWindow = true;
        info.FileName = "cmd";
        info.Arguments = "/c \"" + filePath + "\""; //실행 후 cmd.exe를 종료한다.
 
        System.Diagnostics.Process proc = new System.Diagnostics.Process();
        proc.StartInfo = info;
        proc.Start();
 
        //string result = proc.StandardOutput.ReadToEnd();
        //MessageBox.Show(result);
    }
    catch (Exception ex)
    {
        MessageBox.Show(ex.Message);
    }
}

ComponentOne의 FlexGrid에서 Cell에 이미지 버튼을 표현하는 방법
아래의 방법은 일종의 이미지 버튼을 흉내내는 방법이다.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//이벤트 핸들러 추가
grdMain.MouseMove += new MouseEventHandler(grdMain_MouseMove);
grdMain.MouseDown += new MouseEventHandler(grdMain_MouseDown);
 
//커서 변경
private void grdMain_MouseMove(object sender, MouseEventArgs e)
{
    if (grdMain.MouseRow > 0)
    {
        if (grdMain.MouseCol == grdMain.Cols["ViewInfo"].Index)
            this.Cursor = Cursors.Hand;
        else
            this.Cursor = Cursors.Default;
    }
}
 
//마우스 클릭
private void grdMain_MouseDown(object sender, MouseEventArgs e)
{
    if (grdMain.MouseRow > 0)
    {
        if (grdMain.MouseCol == grdMain.Cols["ViewInfo"].Index)
        {
            Row row = grdMain.Rows[grdMain.MouseRow];
            string seqNo = row["SeqNo"].ToString();
 
            ViewInfo(seqNo);
        }
    }
}
 
//그리드 바인딩 후 아래와 같은 방법으로 이미지를 표시한다.
//전체 Row에 같은 이미지를 표시하고자 할 경우 아래와 같이 구현한다.
private void LoadCellImage()
{
    Hashtable ht = new Hashtable();
    ht.Add("", 특정 이미지);
    Column LinkCol = grdMain.Cols["ViewInfo"];
    LinkCol.ImageMap = ht;
    LinkCol.ImageAndText = false;
    LinkCol.ImageAlign = ImageAlignEnum.CenterCenter;
}
 
//해당 Row의 상태에 따라 다른 이미지를 표시하려면 아래의 메소드처럼 구현한다.
private void LoadCellImage()
{
    Hashtable ht = new Hashtable();
 
    //그리드 제목이 있을 경우 grdMain.Rows.Fixed부터 처리
    for (int i = grdMain.Rows.Fixed; i < grdMain.Rows.Count; i++)
    {
        Row row = grdMain.Rows[i];
        if (row["Exist"].ToString() == "Y")
        {
            ht.Add(row["SeqNo"].ToString(), 특정 이미지1);
        }
        else
        {
            ht.Add(row["SeqNo"].ToString(), 특정 이미지2);
        }
    }
 
    Column LinkCol = grdMain.Cols["SeqNo"];
    LinkCol.ImageMap = ht;
    LinkCol.ImageAndText = false;
    LinkCol.ImageAlign = ImageAlignEnum.CenterCenter;
}

1
2
3
4
5
6
7
8
9
10
11
아래처럼 DateTime.ParseExact를 이용한다.
 
DateTime date = DateTime.ParseExact("20111027"
        , "yyyyMMdd"
        , new System.Globalization.CultureInfo("ko-KR"));
 
또는
 
DateTime date = DateTime.ParseExact("2011-10-27", "yyyy-MM-dd", null);
 
null을 입력하여 현재 CultureInfo를 사용한다.