Proprietà IWMPMedia::imageSourceHeight
[La funzionalità associata a questa pagina, Lettore multimediale Windows SDK, è una funzionalità legacy. È stato sostituito da MediaPlayer. MediaPlayer è stato ottimizzato per Windows 10 e Windows 11. Microsoft consiglia vivamente che il nuovo codice usi MediaPlayer invece di Lettore multimediale Windows SDK, quando possibile. Microsoft suggerisce che il codice esistente che usa le API legacy venga riscritto per usare le nuove API, se possibile.
La proprietà imageSourceHeight ottiene l'altezza dell'elemento multimediale corrente in pixel.
Questa proprietà è di sola lettura.
Sintassi
public System.Int32 imageSourceHeight {get;}
Public ReadOnly Property imageSourceHeight As System.Int32
Valore proprietà
Oggetto System.Int32 che rappresenta l'altezza dell'elemento multimediale.
Commenti
Se l'elemento multimediale non è quello corrente, questa proprietà restituisce zero.
Prima di usare questa proprietà, è necessario disporre dell'accesso in lettura alla libreria. Per altre informazioni, vedere Accesso alla libreria.
Esempio
L'esempio seguente usa imageSourceHeight per visualizzare le dimensioni dell'immagine, in pixel, dell'elemento multimediale corrente in una casella di testo. L'oggetto AxWMPLib.AxWindowsMediaPlayer è rappresentato dalla variabile denominata player.
// 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());
}
}
}
' 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
Requisiti
Requisito | Valore |
---|---|
Versione |
Lettore multimediale Windows serie 9 o successive |
Spazio dei nomi |
WMPLib |
Assembly |
|
Vedi anche
Commenti e suggerimenti
https://aka.ms/ContentUserFeedback.
Presto disponibile: Nel corso del 2024 verranno gradualmente disattivati i problemi di GitHub come meccanismo di feedback per il contenuto e ciò verrà sostituito con un nuovo sistema di feedback. Per altre informazioni, vedereInvia e visualizza il feedback per