ComponentOne 프로젝트에 컨트롤 추가하고, 빌드하기
ComponentOne 프로젝트에 컨트롤 추가하고, 빌드하기
ComponentOne 프로젝트에 컨트롤 추가하고, 빌드하기


1.
본문에서는 새 프로젝트를 생성하고, ComponentOne 컨트롤을 도구상자로 불러온 후, 컨트롤을 폼 또는 프로젝트에 추가하는 과정을 설명하고 있습니다.

2.
도구상자에 컨트롤 추가하기

3.
ComponentOne 컨트롤들은 WinForms 에디션을 설치하는 동안 자동으로 비주얼 스튜디오 도구상자에 추가됩니다.
비고)
ComponentOne 컨트롤들은 WinForms 에디션을 설치는 ComponentOne 사이트에서 다운로드받을수 있습니다.

4.
도구모음에 컨트롤 추가하기

5.
컨트롤을 폼에서 사용후에 빌드하기

6. 
빌드가 안되면, 참조에 추가해서 다시 빌드하기




using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    public static void Main()
    {
        CalcManage nm = new CalcManage();
nm.running();
    }
}

class CalcManage
{
    public void running()
    {
        string[] arr = {""};
List<string> list = new List<string>(arr.ToList());

        list.Add("10.1.191.117");
list.Add("10.1.191.118");
list.Add("10.1.191.119");
list.Add("10.1.191.116");
list.Add("10.1.191.115");
list.Add("10.1.191.114");
list.Add("10.1.191.113");

        arr = list.ToArray();
        
foreach(var e in arr)
        {
            Console.WriteLine(e);
        }
/*------------------------------------------*/
display_packet(list, arr);
    }
    void display_packet(List<string> list, string[] arr)
    {
        foreach(var e in arr)
        {
            Console.WriteLine(e);
        }
    }

}

결과

10.1.191.117
10.1.191.118
10.1.191.119
10.1.191.116
10.1.191.115
10.1.191.114
10.1.191.113

10.1.191.117
10.1.191.118
10.1.191.119
10.1.191.116
10.1.191.115
10.1.191.114
10.1.191.113


/*
csc /reference:Newtonsoft.Json.Net20.dll,ServiceStack.dll,ServiceStack.Interfaces.dll,ServiceStack.ServiceInterface.dll /out:frm01.exe frm01.cs dbmsfrm9801.cs
csc /out:frm01.exe frm01.cs dbmsfrm9801.cs
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;//Marshal
using System.Timers;

class Program
{
    public static void Main(string[] args)
    {
        Application.Run(new CommonLibManage());
    }
}
class dbmsfrm9801 : Form
{
public IntPtr localHandle = IntPtr.Zero;
public IntPtr ____localHandle
{
get{ return localHandle;  }
set{ localHandle = value; }
}

public dbmsfrm9801()
{
localHandle = Handle;

this.Text = "[" + localHandle.ToString() + "]";
}
protected override bool ProcessCmdKey(ref Message m, Keys keyData)
{
const int WM_KEYDOWN = 0x0100;
if(m.Msg==WM_KEYDOWN)
{
switch(keyData.ToString())
{
case "Escape":
Close();
break;
}
}

return base.ProcessCmdKey(ref m, keyData);
}
}
class CommonLibManage : Form
{
public CommonLibManage()
{
//
}
protected override bool ProcessCmdKey(ref Message m, Keys keyData)
{
const int WM_KEYDOWN = 0x0100;
if(m.Msg==WM_KEYDOWN)
{
switch(keyData.ToString())
{
case "Return":
dbmsfrm9801 frm = new dbmsfrm9801();
Console.WriteLine(frm.____localHandle.ToString());
frm.Show();
break;
case "Escape":
Application.Exit();
break;
}
}

return base.ProcessCmdKey(ref m, keyData);
}
}

 



class WindowsManageFrm : Form
{
    System.Windows.Forms.ListBox listBox1 = null;
    System.Windows.Forms.ListBox listBox2 = null;

    void init()
    {
        this.listBox1 = new System.Windows.Forms.ListBox();
        this.listBox2 = new System.Windows.Forms.ListBox();
        this.SuspendLayout();
        this.Controls.Add(this.listBox1);
        this.Controls.Add(this.listBox2);
        this.ResumeLayout(false);

        this.listBox2.Items.Add("KKKKKKK");
        this.listBox2.Items.Add("MMMMMMMMMMMMMMM");
        this.listBox2.Items.Add("KKKKKKK");
    }
    protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
    {
const int WM_KEYDOWN = 0x0100, WM_SYSKEYDOWN = 0x0104;
if ((msg.Msg == WM_KEYDOWN) || (msg.Msg == WM_SYSKEYDOWN))
{
         switch (keyData.ToString())
         {
case "Return" :
Console.WriteLine(this.listBox2.SelectedItem.ToString());
break;
case "Escape" :
DialogResult dialogResult = MessageBox.Show("Quit!!", "Inform",
                    MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
if (dialogResult == DialogResult.OK) Application.Exit();
break;
         default:
             break;
        }
    }

}

비고)
// 0->ID, 1->Handle, 2->Seq
string[] split = recv.id.Split('.');

ex40.cs
0.00MB
ex41.cs
0.00MB







//IntPtr.ToString 메서드

using System;
using System.Windows.Forms;

class Program
{
public static void Main()
{
Application.Run(new APMCommManage());
#if(false)
APMCommManage nm = new APMCommManage();
nm.running();
#endif
}
}
class DBMS2022FRM : Form
{
public DBMS2022FRM()
{
this.Text = "DBMS2022FRM";
}
protected override bool ProcessCmdKey(ref Message m, Keys keyData)
{
const int WM_KEYDOWN=0x0100;

if(m.Msg==WM_KEYDOWN)
{
switch(keyData.ToString())
{
case "Return":
break;
case "Right":
break;
case "Left":
break;
case "Space":
break;
case "Escape":
this.Close();
break;
default:
break;
}
}
return base.ProcessCmdKey(ref m, keyData);
}
}
class APMCommManage : Form
{
IntPtr currentHandle = IntPtr.Zero;

public APMCommManage()
        {
            currentHandle = Handle;
        }
protected override void WndProc(ref Message m)
{
const int WM_PAINT=0x000f;

base.WndProc(ref m);

switch(m.Msg)
{
case WM_PAINT:
break;
default:
break;
}
}
protected override bool ProcessCmdKey(ref Message m, Keys keyData)
{
const int WM_KEYDOWN=0x0100;

if(m.Msg==WM_KEYDOWN)
{
switch(keyData.ToString())
{
case "Return":
Console.WriteLine("HANDLE:" + "[" + currentHandle.ToString() + "]");
break;
case "Right":
break;
case "Left":
break;
case "Space":
DBMS2022FRM dbms2022frm  = new DBMS2022FRM();
dbms2022frm.ShowDialog();
break;
case "Escape":
Application.Exit();
break;
default:
break;
}
}
return base.ProcessCmdKey(ref m, keyData);
}
}

/*
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe frm_01.cs
*/


 

 

Newtonsoft.Json.Net20.dll 을 이용한 파싱 sample

 

form_2.cs
0.00MB

/*
c# 프로그램 전체 종료*/

1. Console

Environment.Exit(0);

2. Windows Form

Application.Exit();

/*c# *.DLL IDE에 추가하기*/

새로운 using 구문을 사용하기 위해서 예를들어서 using System.Data.SQLite;


DLL을 함께 추가해줘야 한다. 

1. Visual Studio(IDE)에서

2. Project 트리에서

3. 참조

4. 참조추가

5. 찾아보기로 해당 DLL을 클릭후에 확인(full path)

빌드후에 정상적으로 실행이 되는지 확인한다.

SQLite을 설치한 후에 C# 프로젝트에서 System.Data.SQLite.dll를 참조한 후 using System.Data.SQLite; 네임스페이스를 참조하면, SQLite의 .NET 클래스들 (예: SQLiteConnection, SQLiteCommand, SQLiteDataReader 등)을 사용할 수 있다.

+ Recent posts