本文整理匯總了Golang中github.com/lxn/win.SCROLLINFO類的典型用法代碼示例。如果您正苦於以下問題:Golang SCROLLINFO類的具體用法?Golang SCROLLINFO怎麽用?Golang SCROLLINFO使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了SCROLLINFO類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: 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)
}
示例2: 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))
}