維克斯討論區
一個簡單的圖片關賞工具~Visual C#
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
[ 訪客無法瀏覽此圖片或下載點,請先註冊或登入會員。] 今天牛刀小試一下~
|