퇴근5분전

간단하게 바둑판으로 그려줌.
테이블형태의 데이타를 프린트 출력하거나 이미지로 그려낼때 사용하면 좋음.

int _Width = 100;

for( int loop = 0; loop < 5; loop++)
{
    for(int loop2 = 0; loop2 < 4; loop2++)
    {
       graphics.DrawRectangle(Pens.Yellow, (loop * _Width), (loop2 * _Width), _Width, _Width);
    }
}

사용자 삽입 이미지

'# 2) .Net ( Vs 2005 )' 카테고리의 다른 글

Vs 2008 처리...  (0) 2009.10.20

Vs2005 에서 보면 왼쪽 도구모음 컨트롤을 만들어본것임.

사용자 삽입 이미지


우선 BoxItem을 유저 컨트롤로 만듬

사용자 삽입 이미지
{ 구성 }
   판넬, 픽쳐박스, 라벨

BoxItem을 담을 Box를 만듬.
사용자 삽입 이미지

데이타가 추가되면
Box에 판넬에 BoxItem을 추가해줌.


--> BoxItem 클릭에 대해서는 BoxItem에 클릭 이벤트를 델리게이트를 통해
Box에 처리를 미뤄줌.

'# 2) .Net ( Vs 2005 ) > WinForm' 카테고리의 다른 글

판넬 슬라이드 애니메이션  (0) 2009.05.01
데이타베이스 브라우져 ver3  (0) 2009.05.01
다각형 내부 클릭 체크.  (0) 2009.05.01
프로시져 생성기  (0) 2009.05.01
이미지뷰어!  (0) 2009.05.01

사용자 삽입 이미지

훈스 닷넷에서 질문올라온것을 살짝 작성해본 것임.

// 소스!
public partial class Form1 : Form
    {
        string DirectoryPath = string.Empty;
        int Index = 0;

        public Form1()
        {
            InitializeComponent();
        }

        #region  이전
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            이전();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            이전();
        }

        void 이전()
        {
            검색(-1);
        }
        #endregion
        #region  다음

        private void button2_Click(object sender, EventArgs e)
        {
            다음();
        }

        private void toolStripButton2_Click(object sender, EventArgs e)
        {
            다음();
        }
        void 다음()
        {
            검색(+1);
        }
        #endregion


        void 검색(int  ImageIndex )
        {        
            this.Index += ImageIndex;

            if (Index < 0)
                Index = 0;
            else if (Index > listBox1.Items.Count - 1)
                Index = listBox1.Items.Count - 1;


            if (this.listBox1.Items.Count > 0 )
            {               
                this.pictureBox1.ImageLocation = string.Format("{0}\\{1}",DirectoryPath, listBox1.Items[Index].ToString());
                this.listBox1.SelectedIndex = this.Index;
            }
        }

        private void button3_Click(object sender, EventArgs e)
        {// 디렉토리 설정 및 파일리스트 로딩.

            if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
            {
                this.textBox1.Text = DirectoryPath = folderBrowserDialog1.SelectedPath;

                string[] fileNames = System.IO.Directory.GetFiles(DirectoryPath);

                listBox1.Items.Clear();

                foreach (string fileName in fileNames)
                {
                    listBox1.Items.Add(fileName.Replace(DirectoryPath, ""));
                }
            }
    

        }

        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.Index = listBox1.SelectedIndex - 1 ;
            검색(+1);
        }

    }



'# 2) .Net ( Vs 2005 ) > WinForm' 카테고리의 다른 글

판넬 슬라이드 애니메이션  (0) 2009.05.01
데이타베이스 브라우져 ver3  (0) 2009.05.01
다각형 내부 클릭 체크.  (0) 2009.05.01
프로시져 생성기  (0) 2009.05.01
유저컨트롤-[도구모음]  (0) 2009.05.01