public int Add(SkinListBoxItem item) { if (item == null) { throw new ArgumentNullException("item"); } return(Owner.OldItems.Add(item)); }
public void Insert(int index, SkinListBoxItem item) { if (item == null) { throw new ArgumentNullException("item"); } Owner.OldItems.Insert(index, item); }
public void ShowLoginStatusAccountOnList(String strAccout) { Action<String>showLoginList =(str)=>{ //跨线程访问UI控件 SkinListBoxItem listInfo = new SkinListBoxItem(); //String messageInfo = "微博账号:" + strAccout + "成功登录!"; listInfo.Text = strAccout; LoginStatusAccountsList.Items.Add(listInfo); }; LoginStatusAccountsList.Invoke(showLoginList, strAccout); }
protected override void OnMouseMove(MouseEventArgs e) { base.OnMouseMove(e); for (int i = 0; i < Items.Count; i++) { Rectangle bounds = this.GetItemRectangle(i); if (bounds.Contains(e.X, e.Y)) { if (Items[i] != mouseitem) { mouseitem = Items[i]; this.Invalidate(); } } } }
//加载热门评论 private void skinListBox1_Click(object sender, EventArgs e) { if (skinListBox1.SelectedIndices.Count > 0) { var id = ((skinListBox1.SelectedItem as SkinListBoxItem).Tag as cookinfo).Guid_id; //获取美食Id //加载热门评论 List <cookcommentinfo> list = icookcommentInfoService.LoadHotCommentByCookieId(id, 10); skinListBox2.Items.Clear(); foreach (var c in list) { CCWin.SkinControl.SkinListBoxItem item = new CCWin.SkinControl.SkinListBoxItem(); item.Text = " 用户:" + c.userinfo.Name + "\n\n"; item.Text += "评论:" + c.Content + "\n"; item.Text += "点赞数:" + c.PraiseNum; item.Image = Common.CommonHelper.BytesToPic(c.userinfo.Pic); skinListBox2.Items.Add(item); } } }
private void F_HotCookie_Load(object sender, EventArgs e) { //清空 skinListBox1.Items.Clear(); skinListBox2.Items.Clear(); //加载热门美食 skinListBox1.Items.Clear(); List <cookinfo> list = icookieInfoService.LoadHotCookieByWeek(); for (int i = 0; i < list.Count; i++) { CCWin.SkinControl.SkinListBoxItem item = new CCWin.SkinControl.SkinListBoxItem(); item.Tag = list[i]; //存对象,减少查询数据库 item.Image = list[i].pic == null ? Properties.Resources.nopic : Common.CommonHelper.BytesToPic(list[i].pic); item.Text = "第" + (i + 1).ToString() + "名:" + list[i].Name + "\n\n"; item.Text += "已有" + list[i].PraiseNum + "位吃货为其点赞!!\n"; skinListBox1.Items.Add(item); } }
public int Add(SkinListBoxItem item) { if (item == null) { throw new ArgumentNullException("item"); } return Owner.OldItems.Add(item); }
public bool Contains(SkinListBoxItem item) { return Owner.OldItems.Contains(item); }
protected override void OnPaint(PaintEventArgs e) { Graphics g = e.Graphics; //绘画背景 if (Back != null) { //是否启用九宫绘图 if (Palace) { ImageDrawRect.DrawRect(g, (Bitmap)Back, this.ClientRectangle, Rectangle.FromLTRB(BackRectangle.X, BackRectangle.Y, BackRectangle.Width, BackRectangle.Height), 1, 1); } else { g.DrawImage(Back, 0, 0, this.Width, this.Height); } } //绘画Item项 for (int i = 0; i < Items.Count; i++) { Rectangle bounds = this.GetItemRectangle(i); SkinListBoxItem item = Items[i]; if (mouseitem == Items[i] && mouseitem != this.SelectedItem && mouse) //悬浮时 { RenderBackgroundInternal( g, bounds, MouseColor, MouseColor, Color.FromArgb(200, 255, 255, 255), ItemRoundStyle, ItemRadius, 0.45f, ItemBorderVisble, ItemHoverGlassVisble, LinearGradientMode.Vertical); } else //非悬浮时 { if (this.SelectedItem == Items[i])//选中时 { RenderBackgroundInternal( g, bounds, _selectedColor, _selectedColor, Color.FromArgb(200, 255, 255, 255), ItemRoundStyle, ItemRadius, 0.45f, ItemBorderVisble, ItemGlassVisble, LinearGradientMode.Vertical); } else { Color backColor; if (i % 2 == 0) { backColor = _rowBackColor2; } else { backColor = _rowBackColor1; } using (SolidBrush brush = new SolidBrush(backColor)) { g.FillRectangle(brush, bounds); } } } Image image = item.Image; //获得Img绘画范围 Rectangle imageRect = new Rectangle( bounds.X + 2, bounds.Y + 2, bounds.Height - 4, bounds.Height - 4); //获得文字绘画范围 Rectangle textRect = new Rectangle( (ImageVisble ? (ImagePoint ? imageRect.Width : 0) : 0), bounds.Y, bounds.Width - (ImageVisble ? imageRect.Width : 0) - 2, bounds.Height); string text = item.ToString(); TextFormatFlags formatFlags = TextFormatFlags.VerticalCenter; if (RightToLeft == RightToLeft.Yes) { imageRect.X = bounds.Right - imageRect.Right; textRect.X = bounds.Right - textRect.Right; formatFlags |= TextFormatFlags.RightToLeft; formatFlags |= TextFormatFlags.Right; } else { formatFlags |= TextFormatFlags.Left; } if (image != null && ImageVisble) { //如果是右边绘制图标,呢么就要使图标偏移至右方 if (!ImagePoint) { imageRect.X = bounds.Right - imageRect.Right; } g.InterpolationMode = InterpolationMode.HighQualityBilinear; if (ItemImageLayout) //如果是true,即使局中绘制 { g.DrawImage(image, imageRect.X + (imageRect.Width - image.Width) / 2, imageRect.Y + (imageRect.Height - image.Height) / 2); } else { g.DrawImage( image, imageRect, 0, 0, image.Width, image.Height, GraphicsUnit.Pixel); } } TextRenderer.DrawText( g, text, Font, textRect, ForeColor, formatFlags); } }
public void CopyTo( SkinListBoxItem[] destination, int arrayIndex) { Owner.OldItems.CopyTo(destination, arrayIndex); }
public void Remove(SkinListBoxItem item) { Owner.OldItems.Remove(item); }
public int IndexOf(SkinListBoxItem item) { return Owner.OldItems.IndexOf(item); }
public int IndexOf(SkinListBoxItem item) { return(Owner.OldItems.IndexOf(item)); }
public bool Contains(SkinListBoxItem item) { return(Owner.OldItems.Contains(item)); }
public void AddRange(SkinListBoxItem[] items) { Owner.OldItems.AddRange(items); }