imageinfodialog.cs
来自「这是一个小型的相片管理器」· CS 代码 · 共 436 行
CS
436 行
/*
Copyright (C) 2005 tommazzo
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Virtual Photo Organzier (VPO) version 1.*, Copyright (C) 2005 by tommazzo
Virtual Photo Organzier (VPO) comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it under certain conditions.
*/
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using VirtualPhotoOrganizer.Photo;
using TXML;
namespace VirtualPhotoOrganizer.Dialogs
{
/// <summary>
/// Zusammenfassung f黵 ImageInfoDialog.
/// </summary>
internal class ImageInfoDialog : System.Windows.Forms.Form
{
// the PhotoInfo object required for displaying the photo info
private PhotoInfo PInfo;
// language strings
private string LsPhotoInfo;
private string LsPixels;
private System.Windows.Forms.Label lbLName;
private System.Windows.Forms.Label lbLPath;
private System.Windows.Forms.Label lbLTitle;
private System.Windows.Forms.Label lbLThumb;
private System.Windows.Forms.Label lbLTaken;
private System.Windows.Forms.Label lbLType;
private System.Windows.Forms.Label lbLSize;
private System.Windows.Forms.Label lbLWidth;
private System.Windows.Forms.Label lbLHeight;
private System.Windows.Forms.Label lbLHRes;
private System.Windows.Forms.Label lbName;
private System.Windows.Forms.Label lbPath;
private System.Windows.Forms.Label lbTitle;
private System.Windows.Forms.Label lbThumb;
private System.Windows.Forms.Label lbTaken;
private System.Windows.Forms.Label lbType;
private System.Windows.Forms.Label lbSize;
private System.Windows.Forms.Label lbWidth;
private System.Windows.Forms.Label lbHeight;
private System.Windows.Forms.Label lbHRes;
private System.Windows.Forms.Label lbVRes;
private System.Windows.Forms.Button bOK;
private System.Windows.Forms.Label lbLVRes;
/// <summary>
/// Erforderliche Designervariable.
/// </summary>
private System.ComponentModel.Container components = null;
public ImageInfoDialog(Album a, int photoIndex) {
//
// Erforderlich f黵 die Windows Form-Designerunterst黷zung
//
InitializeComponent();
PInfo = new PhotoInfo(a, photoIndex);
// LoadLanguageStrings();
ReadPhotoData();
}
/// <summary>
/// Die verwendeten Ressourcen bereinigen.
/// </summary>
protected override void Dispose(bool disposing) {
if (disposing) {
if (components != null) {
components.Dispose();
}
}
base.Dispose(disposing);
}
private void LoadLanguageStrings() {
const string MN = "PhotoInfoDialog";
string LsTitle;
string LsName;
string LsPath;
string LsThumb;
string LsTime;
string LsType;
string LsSize;
string LsWidth;
string LsHeight;
string LsHRes;
string LsVRes;
try {
TXmlReader reader = Util.XmlHandler.OpenLangFile();
LsPhotoInfo = reader.GetString(MN, "DlgTitle", "Photo-Information:");
LsPixels = reader.GetString(MN, "Pixels", "Pixels");
LsTitle = reader.GetString(MN, "Title", "Title:");
LsName = reader.GetString(MN, "Name", "Name:");
LsPath = reader.GetString(MN, "Path", "Path:");
LsThumb = reader.GetString(MN, "Thumb", "Thumbnail:");
LsTime = reader.GetString(MN, "Taken", "Time taken:");
LsType = reader.GetString(MN, "Type", "Image-Type:");
LsSize = reader.GetString(MN, "Size", "Size:");
LsWidth = reader.GetString(MN, "Width", "Width:");
LsHeight = reader.GetString(MN, "Height", "Height:");
LsHRes = reader.GetString(MN, "HRes", "Horiz. Resolution:");
LsVRes = reader.GetString(MN, "VRes", "Vert. Resolution:");
reader.Close();
}
catch {
LsPhotoInfo = "Photo-Information:";
LsPixels = "Pixels";
LsTitle = "Title:";
LsName = "Name:";
LsPath = "Path:";
LsThumb = "Thumbnail:";
LsTime = "Time taken:";
LsType = "Image-Type:";
LsSize = "Size:";
LsWidth = "Width:";
LsHeight = "Height:";
LsHRes = "Horiz. Resolution:";
LsVRes = "Vert. Resolution:";
}
lbLName.Text = LsName;
lbLTitle.Text = LsTitle;
lbLPath.Text = LsPath;
lbLThumb.Text = LsThumb;
lbLSize.Text = LsSize;
lbLTaken.Text = LsTime;
lbLType.Text = LsType;
lbLWidth.Text = LsWidth;
lbLHeight.Text = LsHeight;
lbLHRes.Text = LsHRes;
lbLVRes.Text = LsVRes;
}
private void ReadPhotoData() {
this.Text = LsPhotoInfo + " " + PInfo.PhotoTitle;
lbName.Text = PInfo.PhotoName;
lbPath.Text = PInfo.PhotoPath;
lbTitle.Text = PInfo.PhotoTitle;
lbThumb.Text = PInfo.Thumbnail;
lbTaken.Text = PInfo.TimeTaken.ToString();
lbSize.Text = PInfo.FileSizeStr;
lbType.Text = PInfo.ImageType;
lbWidth.Text = PInfo.ImageWidth.ToString() + " " + LsPixels;
lbHeight.Text = PInfo.ImageHeight.ToString() + " " + LsPixels;
lbHRes.Text = PInfo.HorizontalResolution.ToString() + "DPI";
lbVRes.Text = PInfo.VerticalResolution.ToString() + "DPI";
}
#region Vom Windows Form-Designer generierter Code
/// <summary>
/// Erforderliche Methode f黵 die Designerunterst黷zung.
/// Der Inhalt der Methode darf nicht mit dem Code-Editor ge鋘dert werden.
/// </summary>
private void InitializeComponent() {
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ImageInfoDialog));
this.lbLName = new System.Windows.Forms.Label();
this.lbLPath = new System.Windows.Forms.Label();
this.lbLTitle = new System.Windows.Forms.Label();
this.lbLThumb = new System.Windows.Forms.Label();
this.lbLTaken = new System.Windows.Forms.Label();
this.lbLType = new System.Windows.Forms.Label();
this.lbLSize = new System.Windows.Forms.Label();
this.lbLWidth = new System.Windows.Forms.Label();
this.lbLHeight = new System.Windows.Forms.Label();
this.lbLHRes = new System.Windows.Forms.Label();
this.lbLVRes = new System.Windows.Forms.Label();
this.lbName = new System.Windows.Forms.Label();
this.lbPath = new System.Windows.Forms.Label();
this.lbTitle = new System.Windows.Forms.Label();
this.lbThumb = new System.Windows.Forms.Label();
this.lbTaken = new System.Windows.Forms.Label();
this.lbType = new System.Windows.Forms.Label();
this.lbSize = new System.Windows.Forms.Label();
this.lbWidth = new System.Windows.Forms.Label();
this.lbHeight = new System.Windows.Forms.Label();
this.lbHRes = new System.Windows.Forms.Label();
this.lbVRes = new System.Windows.Forms.Label();
this.bOK = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// lbLName
//
this.lbLName.Location = new System.Drawing.Point(24, 32);
this.lbLName.Name = "lbLName";
this.lbLName.Size = new System.Drawing.Size(100, 16);
this.lbLName.TabIndex = 0;
this.lbLName.Text = "Name:";
//
// lbLPath
//
this.lbLPath.Location = new System.Drawing.Point(24, 72);
this.lbLPath.Name = "lbLPath";
this.lbLPath.Size = new System.Drawing.Size(100, 16);
this.lbLPath.TabIndex = 1;
this.lbLPath.Text = "Path";
//
// lbLTitle
//
this.lbLTitle.Location = new System.Drawing.Point(24, 152);
this.lbLTitle.Name = "lbLTitle";
this.lbLTitle.Size = new System.Drawing.Size(100, 16);
this.lbLTitle.TabIndex = 2;
this.lbLTitle.Text = "Title:";
//
// lbLThumb
//
this.lbLThumb.Location = new System.Drawing.Point(24, 184);
this.lbLThumb.Name = "lbLThumb";
this.lbLThumb.Size = new System.Drawing.Size(100, 16);
this.lbLThumb.TabIndex = 3;
this.lbLThumb.Text = "Thumbnail:";
//
// lbLTaken
//
this.lbLTaken.Location = new System.Drawing.Point(24, 240);
this.lbLTaken.Name = "lbLTaken";
this.lbLTaken.Size = new System.Drawing.Size(100, 32);
this.lbLTaken.TabIndex = 4;
this.lbLTaken.Text = "Time taken:";
//
// lbLType
//
this.lbLType.Location = new System.Drawing.Point(24, 272);
this.lbLType.Name = "lbLType";
this.lbLType.Size = new System.Drawing.Size(100, 16);
this.lbLType.TabIndex = 5;
this.lbLType.Text = "Image-Type:";
//
// lbLSize
//
this.lbLSize.Location = new System.Drawing.Point(24, 304);
this.lbLSize.Name = "lbLSize";
this.lbLSize.Size = new System.Drawing.Size(100, 16);
this.lbLSize.TabIndex = 6;
this.lbLSize.Text = "Size:";
//
// lbLWidth
//
this.lbLWidth.Location = new System.Drawing.Point(24, 336);
this.lbLWidth.Name = "lbLWidth";
this.lbLWidth.Size = new System.Drawing.Size(100, 16);
this.lbLWidth.TabIndex = 7;
this.lbLWidth.Text = "Width:";
//
// lbLHeight
//
this.lbLHeight.Location = new System.Drawing.Point(24, 368);
this.lbLHeight.Name = "lbLHeight";
this.lbLHeight.Size = new System.Drawing.Size(100, 16);
this.lbLHeight.TabIndex = 8;
this.lbLHeight.Text = "Height";
//
// lbLHRes
//
this.lbLHRes.Location = new System.Drawing.Point(24, 400);
this.lbLHRes.Name = "lbLHRes";
this.lbLHRes.Size = new System.Drawing.Size(100, 16);
this.lbLHRes.TabIndex = 9;
this.lbLHRes.Text = "Horiz. Resolution";
//
// lbLVRes
//
this.lbLVRes.Location = new System.Drawing.Point(24, 432);
this.lbLVRes.Name = "lbLVRes";
this.lbLVRes.Size = new System.Drawing.Size(100, 16);
this.lbLVRes.TabIndex = 10;
this.lbLVRes.Text = "Vert. Resolution";
//
// lbName
//
this.lbName.Location = new System.Drawing.Point(136, 32);
this.lbName.Name = "lbName";
this.lbName.Size = new System.Drawing.Size(272, 24);
this.lbName.TabIndex = 11;
this.lbName.Text = "lbName";
//
// lbPath
//
this.lbPath.Location = new System.Drawing.Point(136, 64);
this.lbPath.Name = "lbPath";
this.lbPath.Size = new System.Drawing.Size(272, 72);
this.lbPath.TabIndex = 12;
this.lbPath.Text = "lbPath";
//
// lbTitle
//
this.lbTitle.Location = new System.Drawing.Point(136, 152);
this.lbTitle.Name = "lbTitle";
this.lbTitle.Size = new System.Drawing.Size(272, 16);
this.lbTitle.TabIndex = 13;
this.lbTitle.Text = "lbTitle";
//
// lbThumb
//
this.lbThumb.Location = new System.Drawing.Point(136, 184);
this.lbThumb.Name = "lbThumb";
this.lbThumb.Size = new System.Drawing.Size(272, 48);
this.lbThumb.TabIndex = 14;
this.lbThumb.Text = "lbThumb";
//
// lbTaken
//
this.lbTaken.Location = new System.Drawing.Point(136, 240);
this.lbTaken.Name = "lbTaken";
this.lbTaken.Size = new System.Drawing.Size(272, 16);
this.lbTaken.TabIndex = 15;
this.lbTaken.Text = "lbThumb";
//
// lbType
//
this.lbType.Location = new System.Drawing.Point(136, 272);
this.lbType.Name = "lbType";
this.lbType.Size = new System.Drawing.Size(272, 16);
this.lbType.TabIndex = 16;
this.lbType.Text = "lbThumb";
//
// lbSize
//
this.lbSize.Location = new System.Drawing.Point(136, 304);
this.lbSize.Name = "lbSize";
this.lbSize.Size = new System.Drawing.Size(272, 16);
this.lbSize.TabIndex = 17;
this.lbSize.Text = "lbThumb";
//
// lbWidth
//
this.lbWidth.Location = new System.Drawing.Point(136, 336);
this.lbWidth.Name = "lbWidth";
this.lbWidth.Size = new System.Drawing.Size(272, 16);
this.lbWidth.TabIndex = 18;
this.lbWidth.Text = "lbThumb";
//
// lbHeight
//
this.lbHeight.Location = new System.Drawing.Point(136, 368);
this.lbHeight.Name = "lbHeight";
this.lbHeight.Size = new System.Drawing.Size(272, 16);
this.lbHeight.TabIndex = 19;
this.lbHeight.Text = "lbThumb";
//
// lbHRes
//
this.lbHRes.Location = new System.Drawing.Point(136, 400);
this.lbHRes.Name = "lbHRes";
this.lbHRes.Size = new System.Drawing.Size(272, 16);
this.lbHRes.TabIndex = 20;
this.lbHRes.Text = "lbThumb";
//
// lbVRes
//
this.lbVRes.Location = new System.Drawing.Point(136, 432);
this.lbVRes.Name = "lbVRes";
this.lbVRes.Size = new System.Drawing.Size(272, 16);
this.lbVRes.TabIndex = 21;
this.lbVRes.Text = "lbVRes";
//
// bOK
//
this.bOK.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.bOK.Location = new System.Drawing.Point(176, 472);
this.bOK.Name = "bOK";
this.bOK.Size = new System.Drawing.Size(75, 23);
this.bOK.TabIndex = 0;
this.bOK.Text = "OK";
this.bOK.Click += new System.EventHandler(this.bOK_Click);
//
// ImageInfoDialog
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(424, 502);
this.Controls.Add(this.bOK);
this.Controls.Add(this.lbVRes);
this.Controls.Add(this.lbHRes);
this.Controls.Add(this.lbHeight);
this.Controls.Add(this.lbWidth);
this.Controls.Add(this.lbSize);
this.Controls.Add(this.lbType);
this.Controls.Add(this.lbTaken);
this.Controls.Add(this.lbThumb);
this.Controls.Add(this.lbTitle);
this.Controls.Add(this.lbPath);
this.Controls.Add(this.lbName);
this.Controls.Add(this.lbLVRes);
this.Controls.Add(this.lbLHRes);
this.Controls.Add(this.lbLHeight);
this.Controls.Add(this.lbLWidth);
this.Controls.Add(this.lbLSize);
this.Controls.Add(this.lbLType);
this.Controls.Add(this.lbLTaken);
this.Controls.Add(this.lbLThumb);
this.Controls.Add(this.lbLTitle);
this.Controls.Add(this.lbLPath);
this.Controls.Add(this.lbLName);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Icon = ((System.Drawing.Icon) (resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MaximumSize = new System.Drawing.Size(432, 536);
this.MinimizeBox = false;
this.Name = "ImageInfoDialog";
this.Text = "ImageInfoDialog";
this.ResumeLayout(false);
}
#endregion
private void bOK_Click(object sender, System.EventArgs e) {
this.Close();
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?