作者: tianyu924
查看: 4302|回复: 5
打印 上一主题 下一主题

关于SkinListBox动态生成item加载数据

[复制链接]
跳转到指定楼层
楼主
tianyu924 发表于 2016-3-17 17:42:25 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式
查看: 4302|回复: 5
使用SkinListBox动态加载item元素后,滚动不能用呀,鼠标中键滚动没反应,不能拖动滚动条,代码如下:
[C#] 纯文本查看 复制代码
List<Msgs> sl = info.ToList<Msgs>();//分组后的集合   
                MsgType type = (MsgType)sl[0].MsgType;

                //生成listbox控件
                SkinListBox listBox = new SkinListBox();
                listBox.BorderColor = System.Drawing.Color.Transparent;
                listBox.BorderStyle = System.Windows.Forms.BorderStyle.None;
                listBox.Dock = System.Windows.Forms.DockStyle.Fill;
                listBox.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
                listBox.ItemBorderVisble = false;
                listBox.ItemGlassVisble = false;
                listBox.ItemImageLayout = false;
                listBox.ItemHoverGlassVisble = false;
                listBox.ItemHeight = 40;
                listBox.Location = new System.Drawing.Point(0, 0);
                listBox.MouseColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(243)))), ((int)(((byte)(243)))));
                listBox.Name = "listBox_"+type;
                listBox.RowBackColor2 = System.Drawing.Color.White;
                listBox.SelectedColor = System.Drawing.Color.FromArgb(((int)(((byte)(243)))), ((int)(((byte)(243)))), ((int)(((byte)(243)))));
                listBox.Size = new System.Drawing.Size(630, 516);
                listBox.TabIndex = 0;
                listBox.SelectedIndexChanged += new EventHandler(controlHost_Click);

                foreach (Msgs m in sl)
                {
                    listBox.Items.Add(new SkinListBoxItem() { Text = (sl.IndexOf(m) + 1) + "  " + m.Title + "  " + m.SendTime.ToString("yyyy-MM-dd HH:mm:ss") + "   " + m.request_name, Tag = m.info + "$" + m.Id });

                }
                AddListBox(type, listBox, sl.Count);


鼠标滚动没反应,点击滚动条箭头也没反应,请问是怎么回事,是在生成的子控件的过程中代码哪里出来问题吗?

123.jpg (55.69 KB, 下载次数: 10)

关于SkinListBox动态生成item加载数据

关于SkinListBox动态生成item加载数据
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 转播转播
回复 论坛版权

使用道具 举报

沙发
乔克斯 发表于 2016-3-18 10:11:32 | 只看该作者
请发到技术求助板块。
板凳
 楼主| tianyu924 发表于 2016-3-18 10:15:13 | 只看该作者
乔克斯 发表于 2016-3-18 10:11
请发到技术求助板块。

发错了,已经发到技术求助版块了
地板
乔克斯 发表于 2016-3-18 10:23:04 | 只看该作者
www.cskin.net最新版么。。如果是最新版的问题。。去论坛下载旧版本。。最新版的滚动条做了美化兼容性不好就会导致这种问题。
5#
乔克斯 发表于 2016-3-18 10:27:41 | 只看该作者
也可以不用代码生成 SkinListBox 试试。
直接拖到窗体上。。然后additem。
6#
 楼主| tianyu924 发表于 2016-3-18 10:28:02 | 只看该作者
乔克斯 发表于 2016-3-18 10:23
是www.cskin.net最新版么。。如果是最新版的问题。。去论坛下载旧版本。。最新版的滚动条做了美化兼容性不 ...

是的,是16版本的,好的,我去试试,谢谢
您需要登录后才可以回帖 登录 | 加入CSkin博客

本版积分规则

QQ|申请友链|小黑屋|手机版|Archiver|CSkin ( 粤ICP备13070794号

Powered by Discuz! X3.2  © 2001-2013 Comsenz Inc.  Designed by ARTERY.cn
GMT+8, 2024-4-27 01:40, Processed in 0.894795 second(s), 31 queries , Gzip On.

快速回复 返回顶部 返回列表