
这个demo是干什么的呢???将近三百行。一个自定义的自增的列表框?
listbox_ownerdrawing.go
// Copyright 2019 The Walk Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import (
"fmt"
"log"
"strings"
"time"
"github.com/lxn/walk"
. "github.com/lxn/walk/declarative"
"github.com/lxn/win"
)
func main() {
var mw *walk.MainWindow
var lb *walk.ListBox
var items []logEntry
for i := 10000; i > 0; i-- {
items = append(items, logEntry{time.Now().Add(-time.Second * time.Duration(i)), fmt.Sprintf("Some stuff just happend. %s", strings.TrimSpace(strings.Repeat("blah ", i%100)))})
}
model := &logModel{items: items}
styler := &Styler{
lb: &lb,
model: model,
dpi2StampSize: ma

这个示例演示了一个自定义的列表框控件,用于高效显示大量日志条目。它实现了自增列表功能,每秒添加新的日志项,并自动滚动到最新条目。通过优化布局和测量策略,提高了滚动性能和显示效率。
最低0.47元/天 解锁文章

被折叠的 条评论
为什么被折叠?



