lxn / walk

A Windows GUI toolkit for the Go Programming Language
Other
6.8k stars 885 forks source link

logview of examples how to set the correct line height #653

Open mingnet opened 4 years ago

mingnet commented 4 years ago

I want a log window, so I want to use the logview in the example. But I found the line height of this example to be a problem, as shown below, and I don't know how to change this. How can I deal with this?

2019-11-18 21-29-08屏幕截图_2

The os is win7 x64.

LINQQ1212 commented 4 years ago

import ( "github.com/lxn/walk" "github.com/lxn/win" )

type LogView struct { walk.TextEdit }

func NewLogView(parent walk.Container) (LogView, error) { e,err := walk.NewTextEditWithStyle(parent,win.WS_VSCROLL) if err != nil { return nil,err } lv := &LogView{e} lv.SetReadOnly(true) return lv, nil }

func (lv *LogView) PostAppendText(value string) { lv.AppendText(value) }

func (lv *LogView) Write(p []byte) (int, error) { lv.PostAppendText(string(p)) return len(p), nil }

wufei-png commented 1 month ago

import ( "github.com/lxn/walk" "github.com/lxn/win" )

type LogView struct { walk.TextEdit }

func NewLogView(parent walk.Container) (LogView, error) { e,err := walk.NewTextEditWithStyle(parent,win.WS_VSCROLL) if err != nil { return nil,err } lv := &LogView{e} lv.SetReadOnly(true) return lv, nil }

func (lv *LogView) PostAppendText(value string) { lv.AppendText(value) }

func (lv *LogView) Write(p []byte) (int, error) { lv.PostAppendText(string(p)) return len(p), nil }

this work for me! thanks