使用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);
鼠标滚动没反应,点击滚动条箭头也没反应,请问是怎么回事,是在生成的子控件的过程中代码哪里出来问题吗?
|