日期:2014-05-18  浏览次数:21157 次

winfrom获取视频宽高的问题
自己写了一个视频播放器
想窗体的大小根据视频原始尺寸来控制
int intWidth = wmp.currentMedia.imageSourceWidth;
int intHeight = wmp.currentMedia.imageSourceHeight;

我这个是获取视频的宽高。
但是我调试过的。。这个宽度一直是0.不知道为什么。差了很久不知道怎么弄
用的是windowsmediaplayer控件

------解决方案--------------------
IWMPMedia mediaInfo = axWindowsMediaPlayer1.newMedia("c:\\1.avi");

axWindowsMediaPlayer1.currentMedia = mediaInfo;
int intWidth = axWindowsMediaPlayer1.currentMedia.imageSourceWidth;
int intHeight = axWindowsMediaPlayer1.currentMedia.imageSourceHeight;
axWindowsMediaPlayer1.Width = intWidth ;
axWindowsMediaPlayer1.Height = intHeight ;