代码之家  ›  专栏  ›  技术社区  ›  Chinmay Kanchi

找出可以显示的行数wx.richtext.RichTextCtrl 不滚动

  •  2
  • Chinmay Kanchi  · 技术社区  · 14 年前

    我想用控件的高度除以 RichTextCtrl.GetFont().GetPixelSize() ,但似乎 wx.Font 仅在Windows和GTK上指定。此外,这不包括行/段落之间的任何额外垂直间距。

    有没有明智的方法?

    2 回复  |  直到 14 年前
        1
  •  2
  •   FabienAndre    14 年前

    源代码 PageDown

    def GetLineHeight(rtc):
        tallString = "\n".join([str(i) for i in xrange(200)])
        rtc.SetValue(tallString)
        rtc.SetInsertionPoint(0)
        rtc.PageDown()
        pos = rtc.GetInsertionPoint()
        end = tallString.find("\n",pos)
        lineHeight=int(tallString[pos:end])
        return lineHeight
    
        2
  •  0
  •   Mike Driscoll    14 年前

    是否尝试调用GetNumberOfLines()方法?根据罗宾·邓恩的说法,这应该是可行的,尽管它没有考虑到包装线。