listbox添加数据后,滚动条显示在底部,横向滚动条显示出来的方法
By
admin
at 2017-12-10 • 0人收藏 • 1286人看过
//listbox的滚动条显示最下方,消息方式
mainForm.Rxdata.scrollToBottom = function () {
return ::SendMessageInt(owner.hwnd, 0x115/*_WM_VSCROLL*/, 0x7/*_SB_BOTTOM*/, 0);
}调用方式:
mainForm.button8.oncommand = function(id,event){
//mainForm.msgbox( mainForm.button8.text );
var buf = raw.malloc(1000, 0);
var len,ms = 100,1000;
var Rxlength = Usbhidapi.Hidapi_read_timeout(Hiddevice, buf, len, ms);
if(Rxlength == -1){
console.log("读取失败!")
}else {
console.log("读取成功!!读取长度为:",Rxlength,'\n读取到:' /*,raw.tostring(databuf)*/);
//console.log(raw.tostring(databuf, 1, Rxlength));
if(Rxlength == 0){
return; //没数据退出
}
var str = "";
//str = Aiscii(buf,Rxlength);
str = Hex(buf,Rxlength);
mainForm.Rxdata.add(str);
mainForm.Rxdata.scrollToBottom();//显示到底部
console.log(str);
}
}listbox,横向滚动条显示不出来
首先在窗体设计器 中 点击listbox控件,在属性面板中设置水平滚动条为true( 启用 )
然后切换到代码视图,添加下面的代码:
::SendMessageInt( winform.listbox.hwnd,0x194/*_LB_SETHORIZONTALEXTENT*/,500,0)
1 个回复 | 最后更新于 2017-12-10
登录后方可回帖
listbox读取某一行的值
读取所有的值
for(i=1;winform.listbox.count;1){ winform.edit.text=winform.listbox.getItemText(i) }//取listbox内容另外一种读取所有的值