[.Net] Zlib Wrapper

.Net/.Net 2012. 5. 22. 11:08

링크 : http://www.componentace.com/zlib_.NET.htm 

링크 : http://zlibnetwrapper.sourceforge.net/ 

'.Net > .Net' 카테고리의 다른 글

[.Net] pinvoke.net  (0) 2013.01.07
[.Net] Windows 서비스 응용 프로그램  (0) 2012.12.07
[.Net] Inter-Process Communication  (0) 2012.04.17
[.Net] IPC  (0) 2012.04.16
[.Net] 관리코드에서 메모리 누수 및 방지  (0) 2012.04.11
posted by 뚱2

[.Net] Inter-Process Communication

.Net/.Net 2012. 4. 17. 20:00

1. Ipc클래스 이용

링크 : http://anoriginalidea.wordpress.com/2007/08/09/simple-inter-process-communication-in-vbnet/


2. 표준 입출력 이용

링크 : http://vervain.tistory.com/75#comment5317331 

'.Net > .Net' 카테고리의 다른 글

[.Net] Windows 서비스 응용 프로그램  (0) 2012.12.07
[.Net] Zlib Wrapper  (0) 2012.05.22
[.Net] IPC  (0) 2012.04.16
[.Net] 관리코드에서 메모리 누수 및 방지  (0) 2012.04.11
[.Net] 가비지 수집 모니터링  (0) 2012.04.11
posted by 뚱2

[.Net] IPC

.Net/.Net 2012. 4. 16. 14:24

링크 : http://msdn.microsoft.com/ko-kr/library/system.runtime.remoting.channels.ipc(v=vs.90).aspx

posted by 뚱2

링크 : http://msdn.microsoft.com/ko-kr/magazine/cc163491.aspx 


메모리 릭 찾기

Windbg : http://www.codeproject.com/Articles/31382/Memory-Leak-Detection-Using-Windbg 

NET : http://www.codeproject.com/Articles/19490/Memory-Leak-Detection-in-NET


posted by 뚱2

CLR Profiler : http://www.microsoft.com/download/en/details.aspx?id=13382 

http://www.microsoft.com/downloads/ko-kr/details.aspx?familyid=fd02c7d6-5306-41f2-a1be-b7dcb74c9c0b 







* PerfMon.exe 

    위치 : C:\Windows\System32\PerfMon.exe




posted by 뚱2

링크 : http://msdn.microsoft.com/ko-kr/magazine/cc163528.aspx 


프로세스의 메모리 사용 조사 : http://msdn.microsoft.com/ko-kr/library/cc438089(v=vs.71).aspx

posted by 뚱2

[C#] Assembly Version Loading

.Net/C# 2012. 4. 6. 19:35

현재 어셈블리 버전을 읽는 방법 이다.




// AssemblyInfo.cs
// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 버전이 자동으로
// 지정되도록 할 수 있습니다.
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.5.*")]
[assembly: AssemblyFileVersion("0.5.*")]

// Test.cs
// 현재 실행 프로그램의 어셈플리를 로딩한다.
string msg = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
MessageBox.Show("Version=" + msg);

참고로 버전은 Major.Minor.Build.Revision 입니다.

'.Net > C#' 카테고리의 다른 글

[C#] DllImportAttribut  멤버  (0) 2013.01.04
[C#] Visual C# 메소드를 비동기로 호출하는 방법  (0) 2012.04.14
[C#] VS 2008 서식 자동 해제  (0) 2012.04.06
[C#] log4net  (0) 2012.04.03
[C#] vshosting.exe 가 뭘까요?  (0) 2012.03.26
posted by 뚱2

[C#] vshosting.exe 가 뭘까요?

.Net/C# 2012. 3. 26. 14:27
WinForm으로 프로그램을 생성하면은 출력 디렉토리에 XXX.vshosting.exe 파일이 생성됩니다.
이게 궁금해서 찾아보니 잘 설명된 블로그가 있어서 링크 걸어둡니다.

링크 : http://blog.naver.com/saltynut?Redirect=Log&logNo=120017351107 

'.Net > C#' 카테고리의 다른 글

[C#] VS 2008 서식 자동 해제  (0) 2012.04.06
[C#] log4net  (0) 2012.04.03
[C#] Dynamic Method Call With Out Parameter  (0) 2012.03.22
[즐겨찾기] C# TreeView MultiSelect  (0) 2012.03.15
[C#] internal 지정자  (0) 2012.03.12
posted by 뚱2

[C#] .Net Control.Invoke

.Net/.Net 2012. 3. 18. 20:17
MFC로만 응용프로그램을 만들어오다 이번에 프로젝트로 C# WinForm으로 응용프로그램을 만들게 되었다.
다른걸 떠나서 생산성 하나는 끝내준다.

각설하고 기본적으로 UI컨트롤은 메세지 루프로 이벤트를 받기때문에 메인 윈도우에서 생성해줘야 한다.
물론 별도 스레드를 만들고 메세지 루프도 만들어주면 가능하기는 한데 이건 된다 이거지 이렇게 사용해본적도
없고 본적도 없다.

백그라운드 작업을 할때 별도의 스레드에서 작업을 하고 메인 스레드에서 프로그레스 바를 이용해서 상태값을
변경해주는 방법을 종종 사용하는데 이게 네이티브 응용프로그램에서는 메세지로 컨트롤 했는데 
.Net쪽에서는 Controls.Invoke를 사용해서 해결한다는걸 삽질끝에 알았다.

Invoke 설명 : http://msdn.microsoft.com/ko-kr/library/system.windows.forms.control.invoke.aspx



위 이미지 같이 각 파일의 복사 나 이동의 상태를 알려주고 아래 프로그래스 바는 전체 파일 단위의 상태를 알려준다.

form code
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Security.AccessControl;
using System.Threading;

namespace TestExplorer
{
    public partial class FileProgressForm : Form
    {
        public enum ACTION_TYPE {COPY, MOVE}
        delegate void SetProgressValueDelegate(int value);
        delegate void SetLabelTextDelegate(string text);
        delegate void DoEndDelegate();

        private string sourcePath = "";
        private string targetPath = "";
        private byte[] buffer = new byte[1024*100];// 100Kb
        private Thread thread = null;
        private ACTION_TYPE action = ACTION_TYPE.COPY;
        private bool isThreadEnd = false;

        public string SourcePath
        {
            get { return sourcePath;  }
            set { sourcePath = value; }
        }

        public string TargetPath
        {
            get { return targetPath; }
            set { targetPath = value; }
        }

        public ACTION_TYPE Action
        {
            get { return (action); }
            set { action = value;  }
        }

        public FileProgressForm()
        {
            InitializeComponent();
        }

        private void FileProgressForm_Load(object sender, EventArgs e)
        {
        }

        private void DoEnd()
        {
            this.isThreadEnd = true;
            this.DialogResult = DialogResult.OK;
        }

        private void FileProgressForm_Shown(object sender, EventArgs e)
        {
            // 파일 읽기 작업을 시작한다.
            if (File.Exists(this.sourcePath) == false
                && Directory.Exists(this.targetPath) == false)
            {
                MessageBox.Show("원본 폴더나, 파일을 선택해 주세요.");
                this.DialogResult = DialogResult.Cancel;
                return;
            }

            if (Directory.Exists(this.targetPath) == false)
            {
                MessageBox.Show("대상 폴더를 선택해 주세요.");
                this.DialogResult = DialogResult.Cancel;
                return;
            }

            if (this.sourcePath.Equals(this.targetPath) == true)
            {
                MessageBox.Show("원본과 대상이 일치합니다.");
                this.DialogResult = DialogResult.Cancel;
                return;
            }

            thread = new Thread(new ThreadStart(WorkThread));
            thread.Start();
        }

        // 복사 작업을 한다.
        private void WorkThread()
        {
            FileInfo[] arrfileInfo = null;

            if (File.Exists(sourcePath) == true)
            {
                arrfileInfo = new FileInfo[] { new FileInfo(sourcePath) };
            }
            else if (Directory.Exists(sourcePath) == true)
            {
                DirectoryInfo dirInfo = new DirectoryInfo(sourcePath);
                arrfileInfo = dirInfo.GetFiles();
            }

            if (arrfileInfo != null)
            {
                int count = arrfileInfo.Length;
                long total_current = 0;
                long total_total = 0;

                // 총 파일 용량을 가져온다.
                foreach (FileInfo i in arrfileInfo)
                {
                    if ((i.Attributes & FileAttributes.Hidden) != FileAttributes.Hidden)
                    {
                        total_total += i.Length;
                    }
                }

                // 복사할 파일을 순회한다.
                foreach (FileInfo i in arrfileInfo)
                {
                    if ((i.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden)
                    {
                        continue;
                    }

                    FileStream rs = null, ws = null;
                    try
                    {
                        rs = new FileStream(i.FullName, FileMode.Open);
                        ws = new FileStream(targetPath + "\\" + i.Name, FileMode.Create);

                        // 익명 메서드
                        this.Invoke((SetLabelTextDelegate)delegate(string text)
                        {
                            this.label_filename.Text = text;
                        },
                        new object[] {i.Name});


                        int readSize = 0;
                        long current_current = 0;
                        long current_total = i.Length;

                        while ((readSize = rs.Read(buffer, 0, buffer.Length)) != 0)
                        {
                            current_current += readSize;
                            total_current += readSize;
                            // 현재 프로그래스 바
                            int percent = (int)((double)current_current / (double)current_total * 100);

                            Console.WriteLine("cur={0}, total={1}, percent={2}", current_current, current_total, percent);

                            //익명 메서드
                            this.Invoke((SetProgressValueDelegate)delegate(int value)
                            {
                                this.progressCur.Value = value;
                                this.lableCurPercent.Text = String.Format("{0}%", value);
                            },
                            new object[] {percent});

                            // 토탈 프로그래스 바
                            percent = (int)((double)total_current / (double)total_total * 100);
                            
                            //익명 메서드
                            this.Invoke((SetProgressValueDelegate)delegate(int value)
                            {
                                this.progressTotal.Value = value;
                                this.labelTotalPercent.Text = String.Format("{0}%", value);
                            },
                            new object[] { percent });


                            ws.Write(buffer, 0, readSize);
                        }//while ((readSize = rs.Read(buffer, 0, buffer.Length)) != 0)

                        //익명 메서드
                        this.Invoke((SetProgressValueDelegate)delegate(int value)
                        {
                            this.progressCur.Value = value;
                            this.lableCurPercent.Text = String.Format("{0}%", value);
                        },
                        new object[] { 100 });
                    }
                    catch (Exception ex)
                    {
                    }
                    finally
                    {
                        try { rs.Close(); }
                        catch (Exception ex) { }
                        try { ws.Close(); }
                        catch (Exception ex) { }
                    }

                    if (this.action == ACTION_TYPE.MOVE)
                    {
                        File.Delete(i.FullName);
                    }
                }//foreach (FileInfo i in arrfileInfo)

                //익명 메서드
                this.Invoke((SetProgressValueDelegate)delegate(int value)
                {
                    this.progressTotal.Value = value;
                    this.labelTotalPercent.Text = String.Format("{0}%", value);
                },
                new object[] { 100 });

                //TODO: 500 밀리세컨 슬립한다.
                Thread.Sleep(500);
            }//if (arrfileInfo != null)
            this.Invoke((DoEndDelegate)delegate()
            {
                this.DoEnd();
            });
        }//private void WorkThread(object arg)

        private void FileProgressForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (thread != null && thread.IsAlive == true && isThreadEnd == false )
            {
                MessageBox.Show("작업 중입니다.");
                e.Cancel = true;
            }
        }
    }
}


designer code
namespace TestExplorer
{
    partial class FileProgressForm
    {
        /// 
        /// Required designer variable.
        /// 
        private System.ComponentModel.IContainer components = null;

        /// 
        /// Clean up any resources being used.
        /// 
        /// true if managed resources should be disposed; otherwise, false.
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// 
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// 
        private void InitializeComponent()
        {
            this.progressCur = new System.Windows.Forms.ProgressBar();
            this.progressTotal = new System.Windows.Forms.ProgressBar();
            this.label1 = new System.Windows.Forms.Label();
            this.label2 = new System.Windows.Forms.Label();
            this.labelTotalPercent = new System.Windows.Forms.Label();
            this.lableCurPercent = new System.Windows.Forms.Label();
            this.label_filename = new System.Windows.Forms.Label();
            this.SuspendLayout();
            // 
            // progressCur
            // 
            this.progressCur.Location = new System.Drawing.Point(13, 49);
            this.progressCur.Name = "progressCur";
            this.progressCur.Size = new System.Drawing.Size(366, 32);
            this.progressCur.Step = 1;
            this.progressCur.TabIndex = 0;
            // 
            // progressTotal
            // 
            this.progressTotal.Location = new System.Drawing.Point(12, 107);
            this.progressTotal.Name = "progressTotal";
            this.progressTotal.Size = new System.Drawing.Size(366, 32);
            this.progressTotal.Step = 1;
            this.progressTotal.TabIndex = 1;
            // 
            // label1
            // 
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(13, 32);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(65, 12);
            this.label1.TabIndex = 2;
            this.label1.Text = "현재 파일 :";
            // 
            // label2
            // 
            this.label2.AutoSize = true;
            this.label2.Location = new System.Drawing.Point(13, 91);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(65, 12);
            this.label2.TabIndex = 3;
            this.label2.Text = "전체 파일 :";
            // 
            // labelTotalPercent
            // 
            this.labelTotalPercent.AutoSize = true;
            this.labelTotalPercent.Location = new System.Drawing.Point(87, 91);
            this.labelTotalPercent.Name = "labelTotalPercent";
            this.labelTotalPercent.Size = new System.Drawing.Size(21, 12);
            this.labelTotalPercent.TabIndex = 4;
            this.labelTotalPercent.Text = "0%";
            // 
            // lableCurPercent
            // 
            this.lableCurPercent.AutoSize = true;
            this.lableCurPercent.Location = new System.Drawing.Point(87, 32);
            this.lableCurPercent.Name = "lableCurPercent";
            this.lableCurPercent.Size = new System.Drawing.Size(21, 12);
            this.lableCurPercent.TabIndex = 5;
            this.lableCurPercent.Text = "0%";
            // 
            // label_filename
            // 
            this.label_filename.AutoSize = true;
            this.label_filename.Location = new System.Drawing.Point(13, 9);
            this.label_filename.Name = "label_filename";
            this.label_filename.Size = new System.Drawing.Size(75, 12);
            this.label_filename.TabIndex = 7;
            this.label_filename.Text = "(현재파일명)";
            // 
            // FileProgressForm
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(391, 151);
            this.Controls.Add(this.label_filename);
            this.Controls.Add(this.lableCurPercent);
            this.Controls.Add(this.labelTotalPercent);
            this.Controls.Add(this.label2);
            this.Controls.Add(this.label1);
            this.Controls.Add(this.progressTotal);
            this.Controls.Add(this.progressCur);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "FileProgressForm";
            this.Text = "파일전송";
            this.Load += new System.EventHandler(this.FileProgressForm_Load);
            this.Shown += new System.EventHandler(this.FileProgressForm_Shown);
            this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FileProgressForm_FormClosing);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.ProgressBar progressCur;
        private System.Windows.Forms.ProgressBar progressTotal;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.Label labelTotalPercent;
        private System.Windows.Forms.Label lableCurPercent;
        private System.Windows.Forms.Label label_filename;
    }
}

 
posted by 뚱2

'.Net > Spring.Net' 카테고리의 다른 글

[Spring.Net] Spring.Net 개발가이드  (0) 2012.12.10
posted by 뚱2
간단한 파일 탐색기를 구현했다.
Drag And Drop도 구현
Ctrl+마우스 DnD : 복사, 마우스 DnD : 이동


탐색기 갱신의 약간의 버그와 소스코드가 드러운데
나중을 위해서 그냥 저장... 

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

using System.IO;


namespace TestExplorer

{

    public partial class MainForm : Form

    {

        private TreeNode sourceNode = null;


        public MainForm()

        {

            InitializeComponent();

        }


        private void LoadDrive()

        {

            DriveInfo[] drivers = DriveInfo.GetDrives();

            foreach (DriveInfo i in drivers)

            {

                if ( (i.DriveType & DriveType.Fixed) == DriveType.Fixed )

                {

                    TreeNode newNode1 = this.treeView1.Nodes.Add(i.Name);

                    TreeNode newNode2 = this.treeView2.Nodes.Add(i.Name);

                    DirectoryInfo di = new DirectoryInfo(i.Name);

                    try

                    {

                        if (di.GetFileSystemInfos().Count() > 0)

                        {

                            newNode1.Nodes.Add("temp");

                            newNode2.Nodes.Add("temp");

                        }

                    }

                    catch (Exception e)

                    {

                    }

                }

            }

        }


        private void RefreshNode(TreeNode sourceNode, TreeNode targetNode)

        {

        }


        private void Form1_Load(object sender, EventArgs e)

        {

            LoadDrive();

        }


        private void treeView1_BeforeExpand(object sender, TreeViewCancelEventArgs e)

        {

            // root는 제외

            //MessageBox.Show(e.Node.Text);

            e.Node.Nodes.Clear();

            string fullPath = e.Node.FullPath;

            DirectoryInfo di = new DirectoryInfo(fullPath);

            FileSystemInfo[] arrFsi = di.GetFileSystemInfos();

            e.Node.TreeView.BeginUpdate();

            foreach (FileSystemInfo i in arrFsi)

            {

                if ( (i.Attributes & FileAttributes.Hidden) != FileAttributes.Hidden )

                {

                    TreeNode newNode = e.Node.Nodes.Add(i.Name);

                    DirectoryInfo newDI = new DirectoryInfo(i.FullName);

                    try

                    {

                        if (newDI.GetFileSystemInfos().Count() > 0)

                        {

                            newNode.Nodes.Add("temp");

                        }

                    }

                    catch (Exception ex)

                    {

                    }

                }

            }

            e.Node.TreeView.EndUpdate();

        }


        private void treeView1_MouseDown(object sender, MouseEventArgs e)

        {

            System.Console.WriteLine("treeView1_MouseDown");

            TreeViewHitTestInfo hitInfo = this.treeView1.HitTest(e.Location);

            if (hitInfo != null && hitInfo.Node != null)

            {

                TreeNode node = hitInfo.Node;

                System.Console.WriteLine(node.FullPath);


                // 현재 노드를 선택해준다.

                node.TreeView.SelectedNode = node;

            }

        }


        private void treeView1_QueryContinueDrag(object sender, QueryContinueDragEventArgs e)

        {

            System.Console.WriteLine("treeView1_QueryContinueDrag");

            if (e.EscapePressed)

            {

                e.Action = DragAction.Cancel;

            }

        }


        private void treeView2_DragEnter(object sender, DragEventArgs e)

        {

            System.Console.WriteLine("treeView2_DragEnter");

        }


        private void treeView2_DragOver(object sender, DragEventArgs e)

        {

            System.Console.WriteLine("treeView2_DragOver");

            if (e.Data.GetDataPresent(DataFormats.StringFormat))

            {

                if ((e.KeyState & 8) == 8)

                {

                    e.Effect = DragDropEffects.Copy;

                }

                else

                {

                    e.Effect = DragDropEffects.Move;

                }

            }

        }


        private void treeView2_DragDrop(object sender, DragEventArgs e)

        {

            System.Console.WriteLine("treeView2_DragDrop");

            if (e.Data.GetDataPresent(DataFormats.StringFormat))

            {

                string sourcePath = (string)e.Data.GetData(DataFormats.StringFormat);

                Point pt = new Point(MousePosition.X, MousePosition.Y);

                pt = this.treeView2.PointToClient(pt);

                TreeViewHitTestInfo hitInfo = this.treeView2.HitTest(pt);

                if (hitInfo != null && hitInfo.Node != null)

                {

                    string targetPath = hitInfo.Node.FullPath;


                    // 폴더 복사

                    if (Directory.Exists(sourcePath) == true

                         && Directory.Exists(targetPath) == true)

                    {

                        FileProgressForm form = new FileProgressForm();

                        form.SourcePath = sourcePath;

                        form.TargetPath = targetPath;


                        if (e.Effect == DragDropEffects.Move)

                        {

                            form.Action = FileProgressForm.ACTION_TYPE.MOVE;

                        }

                        else if (e.Effect == DragDropEffects.Copy)

                        {

                            form.Action = FileProgressForm.ACTION_TYPE.COPY;

                        }

                        DialogResult result = form.ShowDialog();

                        if (result == DialogResult.OK)

                        {

                            TreeView tree = hitInfo.Node.TreeView;

                            hitInfo.Node.TreeView.TopNode.Collapse();

                            hitInfo.Node.TreeView.TopNode.Expand();

                            hitInfo.Node.Collapse();

                            hitInfo.Node.Expand();

                            sourceNode.TreeView.TopNode.Collapse();

                            sourceNode.TreeView.TopNode.Expand();

                            sourceNode.Collapse();

                            sourceNode.Expand();

                        }

                        else if (result == DialogResult.Cancel)

                        {

                        }

                    }

                    // 파일 복사

                    else if (File.Exists(sourcePath) == true

                        && Directory.Exists(targetPath) == true)

                    {

                        FileProgressForm form = new FileProgressForm();

                        form.SourcePath = sourcePath;

                        form.TargetPath = targetPath;


                        if (e.Effect == DragDropEffects.Move)

                        {

                            form.Action = FileProgressForm.ACTION_TYPE.MOVE;

                        }

                        else if (e.Effect == DragDropEffects.Copy)

                        {

                            form.Action = FileProgressForm.ACTION_TYPE.COPY;

                        }

                        DialogResult result = form.ShowDialog();

                        if (result == DialogResult.OK)

                        {

                            TreeView tree = hitInfo.Node.TreeView;

                            hitInfo.Node.TreeView.TopNode.Collapse();

                            hitInfo.Node.TreeView.TopNode.Expand();

                            hitInfo.Node.Collapse();

                            hitInfo.Node.Expand();

                            sourceNode.TreeView.TopNode.Collapse();

                            sourceNode.TreeView.TopNode.Expand();

                            sourceNode.Collapse();

                            sourceNode.Expand();

                        }

                        else if (result == DialogResult.Cancel)

                        {

                        }

                    }

                    else

                    {

                        MessageBox.Show("파일이 존재하지 않거나, 복사하려는 곳이 폴더가 아닙니다.");

                    }

                }

            }

        }


        private void Main_Shown(object sender, EventArgs e)

        {

            //DialogResult result = MessageBox.Show("정식 버전을 구입하세요", "확인", MessageBoxButtons.YesNo);


            //if (result == DialogResult.No)

            //{

            //    this.Close();

            //}

            //else

            //{

            //    MessageBox.Show("정식 버전을 구입해 주셔서 감사합니다.");

            //}

        }


        private void treeView1_ItemDrag(object sender, ItemDragEventArgs e)

        {

            TreeNode node = e.Item as TreeNode;

            if (node != null )

            {

                System.Console.WriteLine(node.FullPath);


                string fullPath = node.FullPath;

                sourceNode = node;

                Console.WriteLine("treeView1_ItemDrag=" + fullPath);

                // DoDragDrop 시작

                DragDropEffects effects = DoDragDrop(fullPath, DragDropEffects.Copy | DragDropEffects.Move);


                // 트리 부모 노드를 갱신해 준다.

                if (effects == DragDropEffects.Move)

                {

                }

            }

        }


        private void treeView2_NodeMouseHover(object sender, TreeNodeMouseHoverEventArgs e)

        {

        }

    }

}


designer code 

namespace TestExplorer

{

    partial class MainForm

    {

        /// 


        /// 필수 디자이너 변수입니다.

        /// 


        private System.ComponentModel.IContainer components = null;


        /// 


        /// 사용 중인 모든 리소스를 정리합니다.

        /// 


        /// 관리되는 리소스를 삭제해야 하면 true이고, 그렇지 않으면 false입니다.

        protected override void Dispose(bool disposing)

        {

            if (disposing && (components != null))

            {

                components.Dispose();

            }

            base.Dispose(disposing);

        }


        #region Windows Form 디자이너에서 생성한 코드


        /// 


        /// 디자이너 지원에 필요한 메서드입니다.

        /// 이 메서드의 내용을 코드 편집기로 수정하지 마십시오.

        /// 


        private void InitializeComponent()

        {

            this.splitContainer1 = new System.Windows.Forms.SplitContainer();

            this.treeView1 = new System.Windows.Forms.TreeView();

            this.treeView2 = new System.Windows.Forms.TreeView();

            this.splitContainer1.Panel1.SuspendLayout();

            this.splitContainer1.Panel2.SuspendLayout();

            this.splitContainer1.SuspendLayout();

            this.SuspendLayout();

            // 

            // splitContainer1

            // 

            this.splitContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)

                        | System.Windows.Forms.AnchorStyles.Left)

                        | System.Windows.Forms.AnchorStyles.Right)));

            this.splitContainer1.Location = new System.Drawing.Point(13, 13);

            this.splitContainer1.Name = "splitContainer1";

            // 

            // splitContainer1.Panel1

            // 

            this.splitContainer1.Panel1.Controls.Add(this.treeView1);

            // 

            // splitContainer1.Panel2

            // 

            this.splitContainer1.Panel2.Controls.Add(this.treeView2);

            this.splitContainer1.Size = new System.Drawing.Size(659, 387);

            this.splitContainer1.SplitterDistance = 327;

            this.splitContainer1.TabIndex = 2;

            // 

            // treeView1

            // 

            this.treeView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)

                        | System.Windows.Forms.AnchorStyles.Left)

                        | System.Windows.Forms.AnchorStyles.Right)));

            this.treeView1.HotTracking = true;

            this.treeView1.Location = new System.Drawing.Point(3, 3);

            this.treeView1.Name = "treeView1";

            this.treeView1.Size = new System.Drawing.Size(321, 381);

            this.treeView1.TabIndex = 4;

            this.treeView1.QueryContinueDrag += new System.Windows.Forms.QueryContinueDragEventHandler(this.treeView1_QueryContinueDrag);

            this.treeView1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.treeView1_MouseDown);

            this.treeView1.BeforeExpand += new System.Windows.Forms.TreeViewCancelEventHandler(this.treeView1_BeforeExpand);

            this.treeView1.ItemDrag += new System.Windows.Forms.ItemDragEventHandler(this.treeView1_ItemDrag);

            // 

            // treeView2

            // 

            this.treeView2.AllowDrop = true;

            this.treeView2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)

                        | System.Windows.Forms.AnchorStyles.Left)

                        | System.Windows.Forms.AnchorStyles.Right)));

            this.treeView2.HotTracking = true;

            this.treeView2.Location = new System.Drawing.Point(3, 3);

            this.treeView2.Name = "treeView2";

            this.treeView2.Size = new System.Drawing.Size(322, 381);

            this.treeView2.TabIndex = 3;

            this.treeView2.BeforeExpand += new System.Windows.Forms.TreeViewCancelEventHandler(this.treeView1_BeforeExpand);

            this.treeView2.NodeMouseHover += new System.Windows.Forms.TreeNodeMouseHoverEventHandler(this.treeView2_NodeMouseHover);

            this.treeView2.DragDrop += new System.Windows.Forms.DragEventHandler(this.treeView2_DragDrop);

            this.treeView2.DragEnter += new System.Windows.Forms.DragEventHandler(this.treeView2_DragEnter);

            this.treeView2.DragOver += new System.Windows.Forms.DragEventHandler(this.treeView2_DragOver);

            // 

            // MainForm

            // 

            this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);

            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;

            this.ClientSize = new System.Drawing.Size(684, 412);

            this.Controls.Add(this.splitContainer1);

            this.Name = "MainForm";

            this.Text = "TestExplorer";

            this.Load += new System.EventHandler(this.Form1_Load);

            this.Shown += new System.EventHandler(this.Main_Shown);

            this.splitContainer1.Panel1.ResumeLayout(false);

            this.splitContainer1.Panel2.ResumeLayout(false);

            this.splitContainer1.ResumeLayout(false);

            this.ResumeLayout(false);


        }


        #endregion


        private System.Windows.Forms.SplitContainer splitContainer1;

        private System.Windows.Forms.TreeView treeView2;

        private System.Windows.Forms.TreeView treeView1;


    }

}


posted by 뚱2

'.Net > C#' 카테고리의 다른 글

[C#] log4net  (0) 2012.04.03
[C#] vshosting.exe 가 뭘까요?  (0) 2012.03.26
[C#] Dynamic Method Call With Out Parameter  (0) 2012.03.22
[C#] internal 지정자  (0) 2012.03.12
[즐겨찾기] 무료서적 Inside C# 2nd  (0) 2012.03.10
posted by 뚱2

[SourceGrid] 즐겨찾기

.Net/SourceGrid 2012. 3. 14. 14:35
링크 : http://sourcegrid.codeplex.com/ 
문서 : http://sourcegrid.codeplex.com/documentation 

이번에 프로젝트를 위해서 무료 그리드를 찾던중 발견한 그리드 몰랐는데 역사가 오래되었다.
개발툴을 만드는 용도기 때문에 기본 기능으로 충분할 것 같다.

 
posted by 뚱2

[.Net] System.CodeDom namespace

.Net/.Net 2012. 3. 9. 13:10
posted by 뚱2

[즐겨찾기] .Net Install

.Net/.Net 2012. 3. 8. 10:30
posted by 뚱2