本文整理汇总了Golang中github.com/lxn/win.SCROLLINFO.CbSize方法的典型用法代码示例。如果您正苦于以下问题:Golang SCROLLINFO.CbSize方法的具体用法?Golang SCROLLINFO.CbSize怎么用?Golang SCROLLINFO.CbSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/lxn/win.SCROLLINFO
的用法示例。
在下文中一共展示了SCROLLINFO.CbSize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: updateScrollBars
func (sv *ScrollView) updateScrollBars() {
s := sv.composite.Size()
clb := sv.ClientBounds()
var si win.SCROLLINFO
si.CbSize = uint32(unsafe.Sizeof(si))
si.FMask = win.SIF_PAGE | win.SIF_RANGE
si.NMax = int32(s.Width - 1)
si.NPage = uint32(clb.Width)
win.SetScrollInfo(sv.hWnd, win.SB_HORZ, &si, false)
sv.composite.SetX(sv.scroll(win.SB_HORZ, win.SB_THUMBPOSITION))
si.NMax = int32(s.Height - 1)
si.NPage = uint32(clb.Height)
win.SetScrollInfo(sv.hWnd, win.SB_VERT, &si, false)
sv.composite.SetY(sv.scroll(win.SB_VERT, win.SB_THUMBPOSITION))
}
示例2: scroll
func (sv *ScrollView) scroll(sb int32, cmd uint16) int {
var pos int32
var si win.SCROLLINFO
si.CbSize = uint32(unsafe.Sizeof(si))
si.FMask = win.SIF_PAGE | win.SIF_POS | win.SIF_RANGE | win.SIF_TRACKPOS
win.GetScrollInfo(sv.hWnd, sb, &si)
pos = si.NPos
switch cmd {
case win.SB_LINELEFT: // == win.SB_LINEUP
pos -= 20
case win.SB_LINERIGHT: // == win.SB_LINEDOWN
pos += 20
case win.SB_PAGELEFT: // == win.SB_PAGEUP
pos -= int32(si.NPage)
case win.SB_PAGERIGHT: // == win.SB_PAGEDOWN
pos += int32(si.NPage)
case win.SB_THUMBTRACK:
pos = si.NTrackPos
}
if pos < 0 {
pos = 0
}
if pos > si.NMax+1-int32(si.NPage) {
pos = si.NMax + 1 - int32(si.NPage)
}
si.FMask = win.SIF_POS
si.NPos = pos
win.SetScrollInfo(sv.hWnd, sb, &si, true)
return -int(pos)
}