using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace pictureview
{
public partial class frmViewer : Form
{
public frmViewer()
{
InitializeComponent();
}


// Show the open file dialog box.
private void btnSelectPicture_Click(object sender, EventArgs e)
{
// Show the open file dialog box.
if (ofdSelectPicture.ShowDialog() == DialogResult.OK)
{
// Load the picture into the picture box.
picShowPicture.Image = Image.FromFile(ofdSelectPicture.FileName);
// Show the name of the file in the form's caption.
this.Text = string.Concat("Picture Viewer(" + ofdSelectPicture.FileName + ")");
}



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

需要兩個Button,一個Picture Box,一個OpenFileDialog

arrow
arrow
    全站熱搜

    戮克 發表在 痞客邦 留言(0) 人氣()