Programa onde usamos muitos comandos para a visualização de imagens, timer, menistrip, folderbrowserdialog, statuslabel.
namespace _11_10_16_VisualizadorImagens
{
public partial class frm_VisualizadorImagens : Form
{
public frm_VisualizadorImagens()
{
InitializeComponent();
}
private void groupBox1_Enter(object sender, EventArgs e)
{
}
private void sairToolStripMenuItem_Click(object sender, EventArgs e)
{
Close();
}
private void abrirFiguraToolStripMenuItem_Click(object sender, EventArgs e)
{
if (folderBrowserDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK) ;
{
string folder, pattern, filename, pathname;
folder = folderBrowserDialog1.SelectedPath;
Globals.CurrentPictureFolder = folder;
this.sbarFolderLabel.Text = folder;
if (radJPEG.Checked == true)
{
pattern = "*.jpg";
}
else if (radBPM.Checked == true)
{
pattern = "*.bpm";
}
else
{
pattern = "*.*";
}
string[] files = null;
files = System.IO.Directory.GetFiles(folder, pattern);
lstFileName.Items.Clear();
foreach (string pathname_loopVariable in files)
{
pathname = pathname_loopVariable;
filename = System.IO.Path.GetFileName(pathname);
lstFileName.Items.Add(filename);
}
}
}
private void menuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
{
}
private void picImage_Click(object sender, EventArgs e)
{
}
private void frm_VisualizadorImagens_Load(object sender, EventArgs e)
{
radJPEG.Checked = true;
folderBrowserDialog1.RootFolder = Environment.SpecialFolder.Desktop;
folderBrowserDialog1.Description = "Please location folder containing pictures to view...";
this.sbarClockLabel.Text = System.DateTime.Now.ToString("hh:mm tt, MM-dd-yyyy");
this.timer1.Interval = 3000;
this.timer1.Enabled = true;
}
public void lstFileName_SelectedIndexChanged(object sender, EventArgs e)
{
string filename = null;
string folder = null;
string pathname = null;
filename = lstFileName.SelectedItem.ToString();
folder = Globals.CurrentPictureFolder;
pathname = System.IO.Path.Combine(folder, filename);
picImage.Image = System.Drawing.Image.FromFile(pathname);
}
private void statusStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
{
}
}
}
Nenhum comentário:
Postar um comentário