【问题标题】:GTK# Mono - Retrieving the size of a fixed container or the width of a horizontal paneGTK# Mono - 检索固定容器的大小或水平窗格的宽度
【发布时间】:2014-04-19 08:07:28
【问题描述】:

我正在开发一种视频播放器,其中包括在固定容器内运行的 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; 

【问题讨论】:

    标签: mono gtk#


    【解决方案1】:

    可以通过固定容器的“Allocation”属性获取固定容器的大小。

    像这样:

    Console.WriteLine(fixed1.Allocation.Width.ToString()+","+fixed1.Allocation.Height.ToString());
    this.socket.WidthRequest = fixed1.Allocation.Width; 
    this.socket.HeightRequest = fixed1.Allocation.Height;
    

    【讨论】:

      猜你喜欢
      • 2016-12-28
      • 2013-07-06
      • 2012-08-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-01-22
      • 1970-01-01
      相关资源
      最近更新 更多