2010/05/15

[Silverlight 4] 列印功能

1. 引入 namespace
System.Windows.Printing

2. 建立 PrintDocument
3. 建立對應 Event
  • BeginPrint
  • EndPrint
  • PrintPage - e.PrintVisual (指定列印目標物件), 確認 e.HasMorePages (是否有多頁)
4. 最後指定 PrintDocument 物件 Print 的文件名稱
Print("MyDocument")

2010/05/06

[ASP.NET] 轉換 ArrayList 至字串陣列

VB:

Dim str() As String = arrList.ToArray(GetType(String))

C#:

string[] strings = (string[])arrList.ToArray(typeof(string));

2010/05/03

[.NET] Bitmap to byte array

byte[] bytes = (byte[])System.ComponentModel.TypeDescriptor.GetConverter(bmp).ConvertTo(bmp, typeof(byte[]));

參考網址: Bitmap to byte array