BitmapMetadata.DateTaken 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得或設定值,這個值表示影像的拍攝日期。
public:
property System::String ^ DateTaken { System::String ^ get(); void set(System::String ^ value); };
public string DateTaken { get; set; }
member this.DateTaken : string with get, set
Public Property DateTaken As String
屬性值
影像的拍攝日期。
範例
下列程式碼範例示範如何使用 類別的 BitmapMetadata 易記屬性,將中繼資料寫入點陣圖影像。
FileStream stream3 = new FileStream( "image2.tif", FileMode.Create );
BitmapMetadata myBitmapMetadata = new BitmapMetadata( "tiff" );
TiffBitmapEncoder encoder3 = new TiffBitmapEncoder();
myBitmapMetadata.ApplicationName = "Microsoft Digital Image Suite 10";
myBitmapMetadata.Author = new ReadOnlyCollection<string>(
new List<string>() { "Lori Kane" } );
myBitmapMetadata.CameraManufacturer = "Tailspin Toys";
myBitmapMetadata.CameraModel = "TT23";
myBitmapMetadata.Comment = "Nice Picture";
myBitmapMetadata.Copyright = "2010";
myBitmapMetadata.DateTaken = "5/23/2010";
myBitmapMetadata.Keywords = new ReadOnlyCollection<string>(
new List<string>() { "Lori", "Kane" } );
myBitmapMetadata.Rating = 5;
myBitmapMetadata.Subject = "Lori";
myBitmapMetadata.Title = "Lori's photo";
// Create a new frame that is identical to the one
// from the original image, except for the new metadata.
encoder3.Frames.Add(
BitmapFrame.Create(
decoder2.Frames[0],
decoder2.Frames[0].Thumbnail,
myBitmapMetadata,
decoder2.Frames[0].ColorContexts ) );
encoder3.Save( stream3 );
stream3.Close();
Dim stream3 As New FileStream("image2.tif", FileMode.Create)
Dim myBitmapMetadata As New BitmapMetadata("tiff")
Dim encoder3 As New TiffBitmapEncoder()
myBitmapMetadata.ApplicationName = "Microsoft Digital Image Suite 10"
myBitmapMetadata.Author = New ReadOnlyCollection(Of String) _
(New List(Of String)(New String() {"Lori Kane"}))
myBitmapMetadata.CameraManufacturer = "Tailspin Toys"
myBitmapMetadata.CameraModel = "TT23"
myBitmapMetadata.Comment = "Nice Picture"
myBitmapMetadata.Copyright = "2010"
myBitmapMetadata.DateTaken = "5/23/2010"
myBitmapMetadata.Keywords = New ReadOnlyCollection(Of String) _
(New List(Of String)(New String() {"Lori", "Kane"}))
myBitmapMetadata.Rating = 5
myBitmapMetadata.Subject = "Lori"
myBitmapMetadata.Title = "Lori's photo"
' Create a new frame that is identical to the one
' from the original image, except for the new metadata.
encoder3.Frames.Add( _
BitmapFrame.Create(decoder2.Frames(0), _
decoder2.Frames(0).Thumbnail, _
myBitmapMetadata, _
decoder2.Frames(0).ColorContexts))
encoder3.Save(stream3)
stream3.Close()