NewItemFactory.GetImageStream 方法
取得所指定 Type 的影像,而該影像可以做為集合編輯器或子屬性編輯器中的圖示。
命名空間: Microsoft.Windows.Design.PropertyEditing
組件: Microsoft.Windows.Design.Interaction (在 Microsoft.Windows.Design.Interaction.dll 中)
語法
'宣告
Public Overridable Function GetImageStream ( _
type As Type, _
desiredSize As Size, _
<OutAttribute> ByRef imageName As String _
) As Stream
public virtual Stream GetImageStream(
Type type,
Size desiredSize,
out string imageName
)
public:
virtual Stream^ GetImageStream(
Type^ type,
Size desiredSize,
[OutAttribute] String^% imageName
)
abstract GetImageStream :
type:Type *
desiredSize:Size *
imageName:string byref -> Stream
override GetImageStream :
type:Type *
desiredSize:Size *
imageName:string byref -> Stream
public function GetImageStream(
type : Type,
desiredSize : Size,
imageName : String
) : Stream
參數
- type
型別:System.Type
要為其取得影像的型別。
- desiredSize
型別:System.Windows.Size
影像的要求大小。
- imageName
型別:System.String%
找到的影像之名稱。
傳回值
型別:System.IO.Stream
Stream ,表示要顯示的 type 影像。
例外狀況
例外狀況 | 條件 |
---|---|
ArgumentNullException | type 為 nullNull 參照 (即 Visual Basic 中的 Nothing)。 |
備註
這個方法會在與控制項相同的組件中搜尋內嵌資源。
如果 type 有多個可用的影像,這個方法則會擷取最接近 desiredSize 的影像。 這個方法不保證會傳回完全符合 desiredSize 的影像。
這個方法傳回的物件可以設定為 ContentControl 的 Content 屬性。
這個方法的預設實作會搜尋名稱為 Namespace.ControlName.Icon.Extension 的影像。
目前,僅可辨認下列副檔名:
.png
.bmp
.gif
.jpg
.jpeg
.NET Framework 安全性
- 完全信任立即呼叫者。這個成員無法供部分信任的程式碼使用。如需詳細資訊,請參閱從部分受信任程式碼使用程式庫。
請參閱
參考
Microsoft.Windows.Design.PropertyEditing 命名空間