CSkin博客

标题: 关于SkinListBox动态生成item加载数据 [打印本页]

作者: tianyu924    时间: 2016-3-17 17:42
标题: 关于SkinListBox动态生成item加载数据
使用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加载数据

作者: 乔克斯    时间: 2016-3-18 10:11
请发到技术求助板块。
作者: tianyu924    时间: 2016-3-18 10:15
乔克斯 发表于 2016-3-18 10:11
请发到技术求助板块。

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

是的,是16版本的,好的,我去试试,谢谢




欢迎光临 CSkin博客 (http://bbs.cskin.net/) Powered by Discuz! X3.2