本文整理汇总了C#中System.Drawing.Bitmap.SetPropertyItem方法的典型用法代码示例。如果您正苦于以下问题:C# Bitmap.SetPropertyItem方法的具体用法?C# Bitmap.SetPropertyItem怎么用?C# Bitmap.SetPropertyItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Drawing.Bitmap
的用法示例。
在下文中一共展示了Bitmap.SetPropertyItem方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ResizeJpeg
public Bitmap ResizeJpeg(Image sourcePhoto, int width, int height)
{
if (sourcePhoto == null)
{
throw new ArgumentNullException("sourcePhoto");
}
if (width <= 0)
{
throw new ArgumentException("Width must be greater than 0.");
}
if (height <= 0)
{
throw new ArgumentException("Height must be greater than 0.");
}
int sourceWidth = sourcePhoto.Width;
int sourceHeight = sourcePhoto.Height;
var destPhoto = new Bitmap(sourcePhoto, width, height);
destPhoto.SetResolution(sourcePhoto.HorizontalResolution, sourcePhoto.VerticalResolution);
Graphics grPhoto = Graphics.FromImage(destPhoto);
grPhoto.InterpolationMode = InterpolationMode.HighQualityBicubic;
grPhoto.DrawImage(sourcePhoto, new Rectangle(0, 0, width, height), new Rectangle(0, 0, sourceWidth, sourceHeight), GraphicsUnit.Pixel);
grPhoto.Dispose();
foreach (PropertyItem propertyItem in sourcePhoto.PropertyItems)
{
destPhoto.SetPropertyItem(propertyItem);
}
return destPhoto;
}
示例2: LoadThumbnail
public static Image LoadThumbnail(string filePath)
{
string thumbPath = GetThumbPath(filePath);
using (Image image = Image.FromFile(thumbPath))
{
Image thumb = new Bitmap(image);
thumb.SetPropertyItem(image.GetPropertyItem(18246));
return thumb;
}
}
示例3: Resize
/// <summary>
/// Resizes image to fit within the specified with and height, aspect ratio is maintained.
/// </summary>
/// <param name="width">The maximum width the image has to fit within, set to null to not restrict width.</param>
/// <param name="height">The maximum height the image has to fit within, set to null to not restrict height.</param>
/// <returns>A reference to this object to allow chaining operations together.</returns>
public ImageMedia Resize(int? width, int? height)
{
if (width == null && height == null || width == 0 && height == 0)
return this;
int w = (width == null || width == 0) ? _source.Width : width.Value;
int h = (height == null || height == 0) ? _source.Height : height.Value;
float desiredRatio = (float)w / h;
float scale, posx, posy;
float ratio = (float)_source.Width / _source.Height;
if (_source.Width < w && _source.Height < h)
{
scale = 1f;
posy = (h - _source.Height) / 2f;
posx = (w - _source.Width) / 2f;
}
else if (ratio > desiredRatio)
{
scale = (float)w / _source.Width;
posy = (h - (_source.Height * scale)) / 2f;
posx = 0f;
}
else
{
scale = (float)h / _source.Height;
posx = (w - (_source.Width * scale)) / 2f;
posy = 0f;
}
//if (!background.HasValue)
//{
w = (int)(_source.Width * scale);
h = (int)(_source.Height * scale);
posx = 0f;
posy = 0f;
//}
Image resizedImage = new Bitmap(w, h);
Graphics g = Graphics.FromImage(resizedImage);
g.SmoothingMode = SmoothingMode.HighQuality;
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.PixelOffsetMode = PixelOffsetMode.HighQuality;
g.DrawImage(_source, posx, posy, _source.Width * scale, _source.Height * scale);
foreach (PropertyItem item in _source.PropertyItems)
resizedImage.SetPropertyItem(item);
_source = resizedImage;
_data = null;
return this;
}
示例4: EncodingAlgorithm
protected override string EncodingAlgorithm(string src, ISecretMessage message)
{
var tmp = FileManager.CopyImageToTmp(src);
using (var bmp = new Bitmap(src))
{
var item = bmp.PropertyItems.OrderByDescending(x => x.Id).First();
item.Id = item.Id + 1;
item.Len = Bytes.Length;
item.Value = Bytes;
item.Type = 1;
bmp.SetPropertyItem(item);
bmp.Save(tmp);
}
return tmp;
}
示例5: LoadFiles
private void LoadFiles(string[] files)
{
foreach (string file in files)
{
if (Directory.Exists(file))
{
LoadFiles(Directory.EnumerateFiles(file).ToArray());
}
else
{
try
{
FileInfo fi = new FileInfo(file);
if (fi.Extension.Equals(".jpg", StringComparison.InvariantCultureIgnoreCase))
{
DateTime dtlw = fi.LastWriteTime;
DateTime dtct = fi.CreationTime;
using (Image img = Bitmap.FromFile(file))
{
System.GC.Collect();
using (Image Image = new Bitmap(Bitmap.FromFile(fi.FullName) as Image, int.Parse(Math.Floor(img.Width * .5).ToString()), int.Parse(Math.Floor(img.Height * .5).ToString())))
{
string strFilename = strFolder != "" ? strFolder + "\\" + fi.Name : fi.FullName;
foreach (PropertyItem pi in img.PropertyItems)
{
Image.SetPropertyItem(pi);
}
Image.Save(strFilename, ImageFormat.Jpeg);
FileInfo finew = new FileInfo(strFilename);
finew.LastWriteTime = dtlw;
finew.CreationTime = dtct;
idone++;
this.Invoke((MethodInvoker)delegate { label1.Text = idone.ToString(); });
}
}
}
}
catch { }
}
}
}
示例6: Copy
/// <summary>
/// Creates a deep copy of an image allowing you to set the pixel format.
/// Disposing of the original is the responsibility of the user.
/// <remarks>
/// Unlike the native <see cref="Image.Clone"/> method this also copies animation frames.
/// </remarks>
/// </summary>
/// <param name="source">The source image to copy.</param>
/// <param name="animationProcessMode">The process mode for frames in animated images.</param>
/// <param name="format">The <see cref="PixelFormat"/> to set the copied image to.</param>
/// <param name="preserveExifData">Whether to preserve exif metadata. Defaults to false.</param>
/// <returns>
/// The <see cref="Image"/>.
/// </returns>
public static Image Copy(this Image source, AnimationProcessMode animationProcessMode, PixelFormat format = PixelFormat.Format32bppPArgb, bool preserveExifData = false)
{
if (source.RawFormat.Equals(ImageFormat.Gif))
{
// Read from the correct first frame when performing additional processing
source.SelectActiveFrame(FrameDimension.Time, 0);
GifDecoder decoder = new GifDecoder(source, animationProcessMode);
GifEncoder encoder = new GifEncoder(null, null, decoder.LoopCount);
// Have to use Octree here, there's no way to inject it.
OctreeQuantizer quantizer = new OctreeQuantizer();
for (int i = 0; i < decoder.FrameCount; i++)
{
GifFrame frame = decoder.GetFrame(source, i);
frame.Image = quantizer.Quantize(((Bitmap)frame.Image).Clone(new Rectangle(0, 0, frame.Image.Width, frame.Image.Height), format));
((Bitmap)frame.Image).SetResolution(source.HorizontalResolution, source.VerticalResolution);
encoder.AddFrame(frame);
}
return encoder.Save();
}
// Create a new image and copy it's pixels.
Bitmap copy = new Bitmap(source.Width, source.Height, format);
copy.SetResolution(source.HorizontalResolution, source.VerticalResolution);
using (Graphics graphics = Graphics.FromImage(copy))
{
graphics.DrawImageUnscaled(source, 0, 0);
}
if (preserveExifData)
{
foreach (PropertyItem item in source.PropertyItems)
{
copy.SetPropertyItem(item);
}
}
return copy;
}
示例7: Scale
public static Bitmap Scale(Bitmap Bitmap, int width, int height)
{
Bitmap scaledBitmap = new Bitmap(width, height);
// Scale the bitmap in high quality mode.
using (Graphics gr = Graphics.FromImage(scaledBitmap))
{
gr.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
gr.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;
gr.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
gr.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
gr.DrawImage(Bitmap, new Rectangle(0, 0, width, height), new Rectangle(0, 0, Bitmap.Width, Bitmap.Height), GraphicsUnit.Pixel);
}
// Copy original Bitmap's EXIF tags to new bitmap.
foreach (PropertyItem propertyItem in Bitmap.PropertyItems)
{
scaledBitmap.SetPropertyItem(propertyItem);
}
return scaledBitmap;
}
示例8: ShrinkImages
//.........这里部分代码省略.........
//with multiple quality attributes
oGraphic = Graphics.FromImage(shrunkImage);
oGraphic.CompositingQuality = CompositingQuality.HighQuality;
oGraphic.SmoothingMode = SmoothingMode.HighQuality;
oGraphic.InterpolationMode = InterpolationMode.HighQualityBicubic;
byte oldImageOrinentation = 1;
//Set attribute of object "oGraphic" to rectangle of new smaller size (photo on canvas)
Rectangle rect = new Rectangle(0, 0, smallWidth, smallHeight);
//Draw the old photo in the new rectangle
oGraphic.DrawImage(oldImage, rect);
//Copy over jpeg meta data (PropertyItems)
foreach (PropertyItem item in oldImage.PropertyItems)
{
if ((Orientation == item.Id) || (Thumbnail_Orientation == item.Id))
{
if (item.Type == 0x3)//3 = SHORT A 16-bit (2 -byte) unsigned integer,
{
byte test = item.Value[0];
//Lets not write corrected orientation. We will remove orientation all together
//if ((test == 8) || (test == 3) || (test == 5))
// {
// item.Value[0] = 0x01;
// item.Value[1] = 0x00;
// }
if (Orientation == item.Id)
oldImageOrinentation = test; //note orientation will use later
}
}
if (true == checkBoxFixOrientation.Checked)
{
//Do not copy to new image propety item if pertains to oritentation
//As we will rotate image as need later
if ((Orientation != item.Id) && (Thumbnail_Orientation != item.Id))
shrunkImage.SetPropertyItem(item);
}
else
{
shrunkImage.SetPropertyItem(item);
}
}// foreach PropertyItem item
//Save as a JPEG
//directoryPath = System.IO.Path.GetDirectoryName(fileinfo.FullName);
directoryPath = outputFolder;
newName = directoryPath + "\\" + "s" + ((int)newWidth) + "-" + fileinfo.Name;
if (true == checkBoxFixOrientation.Checked)
{
switch (oldImageOrinentation)
{
case 8://->
shrunkImage.RotateFlip(System.Drawing.RotateFlipType.Rotate270FlipNone);
break;
case 3:
shrunkImage.RotateFlip(System.Drawing.RotateFlipType.Rotate180FlipNone);
break;
case 6:
shrunkImage.RotateFlip(System.Drawing.RotateFlipType.Rotate90FlipNone);
break;
default:
break;
}
}
shrunkImage.Save(newName, ImageFormat.Jpeg);
}
catch (Exception exp)
{
MessageBox.Show(exp.Message, "Shrink Images",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
finally
{
if (oldImage != null) oldImage.Dispose();
if (shrunkImage != null) shrunkImage.Dispose();
if (oGraphic != null) oGraphic.Dispose();
}
}
}
catch (Exception exp)
{
MessageBox.Show(exp.Message, "Shrink Images",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
finally
{
OperationComplete();
}
}
示例9: SaveData
public static void SaveData(string infilename, string outfilename)
{
//try
//{
string TempFile;
TempFile = System.IO.Path.GetTempPath() + "__ImageCaptionEdit__" + System.IO.Path.GetRandomFileName();
System.IO.File.Copy(infilename, TempFile);
Encoding _Encoding = Encoding.UTF8;
Image theImage = new Bitmap(TempFile);
//figure out how to create an EXIF propertyitem...
//PropertyItem BaseProperty = new PropertyItem();
PropertyItem BaseProperty;
BaseProperty = CreatePropertyItem();
theImage.SetPropertyItem(SetupProperty(BaseProperty, header, 0x9c9b));
theImage.SetPropertyItem(SetupProperty(BaseProperty, sideinfo, 0x9c9f));
theImage.SetPropertyItem(SetupProperty(BaseProperty, description, 0x9c9c));
theImage.Save(outfilename,ImageFormat.Jpeg);
//}
//catch (Exception excp)
//{
// MessageBox.Show("Error in SaveData: " + excp.Message);
//}
}
示例10: ModifyImage
/// <summary>
/// Modifies an Profile image.
/// </summary>
/// <param name="x">The x.</param>
/// <param name="y">The y.</param>
/// <param name="w">The w.</param>
/// <param name="h">The h.</param>
/// <param name="PersonID">Profile Image to work on</param>
/// <returns>New Image Id</returns>
private bool ModifyImage(int x, int y, int w, int h, Person person)
{
string ProfilDirSetting = ConfigurationManager.AppSettings["ProfileImage"];
if (string.IsNullOrWhiteSpace(ProfilDirSetting)) { throw new ArgumentNullException(); }
var ProfilBilled = string.Format(ProfilDirSetting, person.PersonID);
if (System.IO.File.Exists(Server.MapPath(ProfilBilled)))
{
Image img = Image.FromFile(Server.MapPath(ProfilBilled));
using (System.Drawing.Bitmap _bitmap = new System.Drawing.Bitmap(428, 550))
{
_bitmap.SetResolution(img.HorizontalResolution, img.VerticalResolution);
using (Graphics _graphic = Graphics.FromImage(_bitmap))
{
_graphic.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
_graphic.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
_graphic.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;
_graphic.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
_graphic.Clear(Color.White);
//_graphic.DrawImage(img, 0, 0, w, h);
_graphic.DrawImage(img, new Rectangle(0, 0, 428, 550), x, y, w, h, GraphicsUnit.Pixel);
//_graphic.DrawImage(img, new Rectangle(0, 0, w, h), x, y, w, h, GraphicsUnit.Pixel);
//_graphic.DrawImage(img, 0, 0, img.Width, img.Height);
//_graphic.DrawImage(img, new Rectangle(0, 0, 428, 550), 0, 0, img.Width, img.Height, GraphicsUnit.Pixel);
}
System.Drawing.Imaging.PropertyItem prop = img.PropertyItems[0];
SetProperty(ref prop, 270, string.Format("Username: {0}, {1}", person.UserName, person.FullName));
_bitmap.SetPropertyItem(prop);
SetProperty(ref prop, 33432, "Copyright Natteravnene www.natteravnene.dk");
_bitmap.SetPropertyItem(prop);
//TODO: Set more properties
img.Dispose();
_bitmap.Save(Server.MapPath(ProfilBilled), System.Drawing.Imaging.ImageFormat.Jpeg);
}
}
return true;
}
示例11: ScaleBitmap
/// <summary>
/// Scales a image using high quality mode.
/// </summary>
/// <param name="image">The image to scale.</param>
/// <param name="scaleFactorX">Scale factor on the X axis.</param>
/// <param name="scaleFactorY">Scale factor on the Y axis.</param>
/// <returns>The scaled image.</returns>
/// <exception cref="ArgumentNullException"><paramref name="image"/> is <c>null</c>.</exception>
public static Image ScaleBitmap(this Image image, float scaleFactorX, float scaleFactorY)
{
if (image == null)
{
throw new ArgumentNullException("image");
}
int scaledWidth = (int)System.Math.Max(image.Width * scaleFactorX, 1.0f);
int scaledHeight = (int)System.Math.Max(image.Height * scaleFactorY, 1.0f);
Image scaledImage = new Bitmap(scaledWidth, scaledHeight);
using (Graphics graphics = Graphics.FromImage(scaledImage))
{
graphics.SmoothingMode = SmoothingMode.HighQuality;
graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
graphics.CompositingQuality = CompositingQuality.HighQuality;
graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
graphics.DrawImage(image, new Rectangle(0, 0, scaledWidth, scaledHeight), new Rectangle(0, 0, image.Width, image.Height), GraphicsUnit.Pixel);
}
foreach (PropertyItem propertyItem in image.PropertyItems)
{
scaledImage.SetPropertyItem(propertyItem);
}
return scaledImage;
}
示例12: ProcessImage
static void ProcessImage(string image, string outpath)
{
var timage = image;
try {
DateTime datePicture = DateTime.MinValue;
try {
using (ExifReader reader = new ExifReader(timage)) {
DateTime datePictureTaken;
if (reader.GetTagValue<DateTime>(ExifTags.DateTimeDigitized, out datePictureTaken)) {
datePicture = datePictureTaken;
}
}
}
catch (Exception) {
}
if (datePicture.Equals(DateTime.MinValue)) {
var date = File.GetLastWriteTime(timage);
Console.WriteLine("Can't determine date. " + timage + " Use file date: ( " + date.ToShortDateString() + " - " + date.ToShortTimeString() + " ) ? (y/n)");
if (Console.ReadKey().KeyChar.ToString().ToUpper().Equals("Y")) {
datePicture = date;
Encoding _Encoding = Encoding.UTF8;
Image theImage = new Bitmap(image);
// 36867 = DateTimeOriginal
// 36868 = DateTimeDigitized
PropertyItem prop = theImage.PropertyItems[0];
SetProperty(ref prop, 36868, date.ToString("yyyy:MM:dd HH:mm:ss"));
theImage.SetPropertyItem(prop);
theImage.Save(timage + ".tmp");
timage = timage + ".tmp";
}
}
if (!datePicture.Equals(DateTime.MinValue)) {
int i = 1;
while (File.Exists(DateToFile(outpath, datePicture, i))) {
i++;
}
//Console.WriteLine(DateToFile(outpath, datePicture, i));
if (!Directory.Exists(DateToYear(outpath, datePicture))) {
Directory.CreateDirectory(DateToYear(outpath, datePicture));
}
if (!Directory.Exists(DateToYearMonth(outpath, datePicture))) {
Directory.CreateDirectory(DateToYearMonth(outpath, datePicture));
}
File.Move(timage, DateToFile(outpath, datePicture, i));
}
}
catch (Exception e) {
Console.WriteLine(timage + ": " + e.Message);
}
}
示例13: SaveToJpeg
public void SaveToJpeg(string filename, int exifWidth, int exifHeight)
{
if(channelFormat==Format.RGBA)
{
ConvertToRGB().SaveToJpeg(filename, exifWidth, exifHeight);
return;
}
if(channelFormat!=Format.RGB) throw new Exception("Only rgb images can be saved by SaveToJpeg.");
Bitmap bmp=new Bitmap((int)width, (int)height, PixelFormat.Format24bppRgb);
BitmapData data=bmp.LockBits(new Rectangle(0, 0, (int)width, (int)height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
if(((int)width*3)==data.Stride)
{
Marshal.Copy(imageData, 0, data.Scan0, (int)(width*height*3));
}
else
{
if(IntPtr.Size==4)
{
for(uint i=0; i<height; i++)
{
Marshal.Copy(imageData, (int)(width*3*i), (IntPtr)(data.Scan0.ToInt32()+(int)(i*data.Stride)), (int)(width*3));
}
}
else if(IntPtr.Size==8)
{
for(uint i=0; i<height; i++)
{
Marshal.Copy(imageData, (int)(width*3*i), (IntPtr)(data.Scan0.ToInt64()+(long)(i*data.Stride)), (int)(width*3));
}
}
}
bmp.UnlockBits(data);
data=null;
if(exifWidth>0&&exifHeight>0)
{
PropertyItem o=(PropertyItem)Activator.CreateInstance(typeof(PropertyItem), true);
byte[] buff=Encoding.ASCII.GetBytes("ASCII\0\0\0"+exifWidth+"x"+exifHeight);
o.Id=0x9286;
o.Type=7;
o.Len=buff.Length;
o.Value=buff;
bmp.SetPropertyItem(o);
o=(PropertyItem)Activator.CreateInstance(typeof(PropertyItem), true);
o.Id=0x100;
o.Type=4;
o.Len=4;
o.Value=BitConverter.GetBytes((uint)exifWidth);
bmp.SetPropertyItem(o);
o=(PropertyItem)Activator.CreateInstance(typeof(PropertyItem), true);
o.Id=0x101;
o.Type=4;
o.Len=4;
o.Value=BitConverter.GetBytes((uint)exifHeight);
bmp.SetPropertyItem(o);
}
bmp.Save(filename, ImageFormat.Jpeg);
bmp.Dispose();
bmp=null;
}
示例14: ResizeImage
private void ResizeImage(object state)
{
FileInfo fi = new FileInfo(state as string);
System.GC.Collect();
Image img = Bitmap.FromFile(fi.FullName);
if (img.Width > 2690)
{
PropertyItem[] itms = img.PropertyItems;
System.GC.Collect();
img = new Bitmap(Bitmap.FromFile(fi.FullName),
int.Parse(Math.Floor(img.Width * .5).ToString()),
int.Parse(Math.Floor(img.Height * .5).ToString()));
foreach (PropertyItem pi in itms)
{
img.SetPropertyItem(pi);
}
System.GC.Collect();
string newfilename = fi.DirectoryName + "\\" + fi.Name.Replace(".JPG", "~.JPG").Replace(".jpg", "~.jpg");
img.Save(newfilename, ImageFormat.Jpeg);
System.GC.Collect();
img = null;
System.GC.Collect();
try
{
var arg = new { nf = newfilename, fi = fi };
fi = null;
Action act = new Action(delegate
{
System.IO.File.SetCreationTime(arg.nf, arg.fi.CreationTime);
System.IO.File.SetLastAccessTime(arg.nf, arg.fi.LastAccessTime);
System.IO.File.SetLastWriteTime(arg.nf, arg.fi.LastWriteTime);
System.IO.File.Delete(arg.fi.FullName);
System.IO.File.Move(arg.nf, arg.fi.FullName);
});
MoveFile(act, 0);
}
catch
{
}
}
else
{
img = null;
}
System.GC.Collect();
icnt++;
this.Invoke((MethodInvoker)delegate { this.Text = "MyPhotoEditor " + icnt + "/" + icntlist; });
if (icntlist <= icnt)
{
MessageBox.Show("Jupp");
}
}
示例15: DlgPhotoDraw
public DlgPhotoDraw(Waypoint wpt, PhotoDescr photoDescr)
{
if(photoDescr != null)
{
// from DlgPhotoFullSize, wpt may be null
m_photoDescr = PhotoDescr.FromPhotoDescr(photoDescr); // with null image
m_photoDescr.imageDisposable = false;
m_photoDescr.ensureOriginalImageExists(); // local will be still invoked if not a gallery
}
else
{
// from right-click on a waypoint; wpt must be non-null
try
{
m_photoDescr = PhotoDescr.FromThumbnail(wpt.ThumbSource);
m_photoDescr.imageDisposable = false;
m_photoDescr.ensureOriginalImageExists(); // local will be still invoked if not a gallery
}
// An invalid image will throw an OutOfMemoryException
// exception
catch (OutOfMemoryException)
{
throw new Exception("Corrupted image file?");
}
}
originalOrientation = m_photoDescr.Orientation;
m_photoDescr.Orientation = 1; // will force display to actual orientation, no adjustment
originalBitmap = new Bitmap(m_photoDescr.image);
whRatio = (double)originalBitmap.Width / (double)originalBitmap.Height;
foreach(PropertyItem item in m_photoDescr.image.PropertyItems)
{
//string str = "" + item.Type + ": " + item.Id + "=" + item.Value;
//LibSys.StatusBar.Trace(str);
originalBitmap.SetPropertyItem(item);
}
m_wpt = wpt;
InitializeComponent();
addExifCoordsCheckBox.Enabled = (m_wpt != null);
addExifCoordsCheckBox.Checked = m_addExifCoords;
this.linkToWptLinkLabel.Enabled = (m_wpt == null || m_wpt.TrackId == -1);
this.photoViewerControl = new LibSys.PhotoViewerControl();
this.picturePanel.Controls.AddRange(new System.Windows.Forms.Control[] { this.photoViewerControl});
//
// photoViewerControl
//
this.photoViewerControl.Dock = System.Windows.Forms.DockStyle.Fill;
this.photoViewerControl.Name = "photoViewerControl";
//this.photoViewerControl.photoDescr = null;
this.photoViewerControl.TabIndex = 1;
photoViewerControl.fitToSize = m_fitToSize;
fitToSizeCheckBox.Checked = m_fitToSize;
this.fitToSizeCheckBox.CheckedChanged += new System.EventHandler(this.fitToSizeCheckBox_CheckedChanged);
if(m_wpt != null && m_wpt.TrackId != -1)
{
timeTptRadioButton.Checked = true;
this.timePanel.Enabled = true;
}
else
{
timeExifRadioButton.Checked = true;
timePanel.Enabled = false;
}
setTextTextBox();
widthTextBox.Text = "" + originalBitmap.Width; // Y will be set in validation
widthTextBox_Validating(null, null);
draw(false);
if(Project.fitsScreen(m_dlgSizeX, m_dlgSizeY, m_dlgSizeWidth, m_dlgSizeHeight))
{
inResize = true;
this.Location = new Point(m_dlgSizeX, m_dlgSizeY);
this.ClientSize = new System.Drawing.Size(m_dlgSizeWidth, m_dlgSizeHeight); // causes Resize()
}
// PhotoProperties related:
// Create an instance of a ListView column sorter and
// assign it to the _listView control.
lvwColumnSorter = new ListViewColumnSorter();
this._listView.ListViewItemSorter = lvwColumnSorter;
_resultOptions = new ResultOptions();
// end of PhotoProperties related.
positionComboBox.SelectedIndex = m_position;
this.positionComboBox.SelectedIndexChanged += new System.EventHandler(this.positionComboBox_SelectedIndexChanged);
m_fontSize = (int)Math.Round(Math.Max(originalBitmap.Width / 50.0d, m_fontSize));
fontNumericUpDown.Value = Math.Min(m_fontSize, fontNumericUpDown.Maximum);
//.........这里部分代码省略.........