Windows Media Player 11 SDK IWMPMedia.imageSourceHeight (VB and C#)
Previous | Next |
IWMPMedia.imageSourceHeight (VB and C#)
The imageSourceHeight property gets the height of the current media item in pixels.
[Visual Basic] ReadOnly Property imageSourceHeight As Integer [C#] int imageSourceHeight {get;}
Property Value
A System.Int32 that is the height of the media item.
Remarks
If the media item is not the current one, this property returns zero.
Before using this property, you must have read access to the library. For more information, see Library Access.
Example Code
The following example uses imageSourceHeight to display the image size, in pixels, of the current media item in a text box. The AxWMPLib.AxWindowsMediaPlayer object is represented by the variable named player.
[Visual Basic]
' Create an event handler for the OpenStateChange event. Public Sub player_OpenStateChange(ByVal sender As Object, ByVal e As AxWMPLib._WMPOCXEvents_OpenStateChangeEvent) Handles player.OpenStateChange ' Test whether the current media item is open. If (e.newState = WMPLib.WMPOpenState.wmposMediaOpen) Then ' Store the height and width of the new media item. Dim Height As Integer = player.currentMedia.imageSourceHeight Dim Width As Integer = player.currentMedia.imageSourceWidth ' Clear all the information in the text box. videoSize.Clear() ' Test whether an image is visible. If (Height <> 0 And Width <> 0) Then ' Display the image size information. videoSize.Text = (Width.ToString() + " x " + Height.ToString()) End If End If End Sub
FakePre-680421d346d243799a5f7c69c8e40f32-a3891bd20a5f456ba369df3ed8ae9518
// Create an event handler for the OpenStateChange event. private void player_OpenStateChange(object sender, AxWMPLib._WMPOCXEvents_OpenStateChangeEvent e) { // Test whether the current media item is open. if (e.newState == (int)WMPLib.WMPOpenState.wmposMediaOpen) { // Store the height and width of the new media item. int height = player.currentMedia.imageSourceHeight; int width = player.currentMedia.imageSourceWidth; // Clear all the information in the text box. videoSize.Clear(); // Test whether an image is visible. if (height != 0 && width != 0) { // Display the image size information. videoSize.Text = (width.ToString() + " x " + height.ToString()); } } }
Requirements
Version: Windows Media Player 9 Series or later
Namespace: WMPLib
Assembly: Interop.WMPLib.dll (automatically generated by Visual Studio)
See Also
Previous | Next |