GSI

[C#] Picture Viewer

C# 2007. 12. 5. 10:58 |

사용자 삽입 이미지
1. PictureBox를 추가 한다.
2. Select Picture 버튼을 추가 한다.
3. Quit 버튼을 추가한다.
4. OpenFileDialog 파일 오픈 상자를 위한 컨트롤을 추가 한다.

소스 코드 :

    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void btnSelectPicture_Click(object sender, EventArgs e)
        {
            if (ofdSelectPicture.ShowDialog() == DialogResult.OK)
            {
                picShowPicture.Image = Image.FromFile(ofdSelectPicture.FileName);
                this.Text = string.Concat("Picture Viewer(" + ofdSelectPicture.FileName + ")");
            }
        }

        private void btnQuit_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }

Posted by gsi
: