0

我正在开发一种视频播放器,其中包括在固定容器内运行的 mplayer 小部件。我希望视频播放器的宽度和高度为固定窗格的 100%。固定窗格的左侧还有一个水平窗格。

我已经弄清楚如何获取窗口的宽度并将视频的初始大小设置为此,但我还没有弄清楚如何计算它所在的固定窗格或旁边的水平容器的大小它。

var width = -1;
var height = -1;

//1048,756 - too big
this.fixed1.ParentWindow.GetSize(out width, out height);

//would rather use this.fixed1.width or something of that sort.

//this.hpaned1 has an initial width that is auto-defined
//this.hpaned1 also contains a vpaned1

Console.WriteLine(width+","+height);
this.socket.WidthRequest = width; 
this.socket.HeightRequest = height; 
4

1 回答 1

0

您可以使用固定容器的“分配”属性获取固定容器的大小。

像这样:

Console.WriteLine(fixed1.Allocation.Width.ToString()+","+fixed1.Allocation.Height.ToString());
this.socket.WidthRequest = fixed1.Allocation.Width; 
this.socket.HeightRequest = fixed1.Allocation.Height;
于 2014-04-19T00:07:28.340 回答