public PictureItem GetPictureItem(int index) { PictureItem PictureItem = new PictureItem(); if (index > this.data.Count || data.Count < 1) { return(PictureItem); } PictureItem = (PictureItem)data[index]; return(PictureItem); }
public PictureItem GetCurrentPictureItem() { PictureItem PictureItem = new PictureItem(); if (data.Count < 1) { return(PictureItem); } PictureItem = (PictureItem)data[this.CurrentImg]; return(PictureItem); }
public bool AddPictureItem(Bitmap map, string text) { if (text.Trim() == "") { return(false); } PictureItem it = new PictureItem { Pic = map, Text = text }; data.Add(it); this.Count++; return(true); }
/// <summary> /// 增加图片到图片管理控件 /// </summary> /// <param name="PictureItem"></param> /// <returns></returns> public bool AddPictureItem(PictureItem PictureItem) { data.Add(PictureItem); this.Count++; return(true); }
public void Draw() { this.Init(); this.DrawBack(); int rowcount = w / (this.ImgWidth + this.MidWidth); int curx = 10; int cury = 10; if (data.Count < 1) { return; } Graphics g = Graphics.FromImage(map); PictureItem tPictureItem = new PictureItem(); RectangleF rect = new RectangleF(0, 0, 10, 10); for (int i = 0; i < data.Count; i++) { tPictureItem = (PictureItem)data[i]; try { if (tPictureItem.Pic.Equals(null)) { continue; } if (tPictureItem.Text.Trim() == "") { tPictureItem.Text = "None"; } if (i == this.CurrentImg) { g.FillRectangle(new Pen(Color.FromArgb(166, 201, 232)).Brush, curx, cury, this.ImgWidth, this.ImgHeight); } g.DrawImage(tPictureItem.Pic, curx + 12, cury + 12, this.ImgWidth - 24, this.ImgHeight - 14 - 24); Pen pen = new Pen(this.SideBorderColor, 1); if (i == this.CurrentImg) { pen.DashStyle = DashStyle.DashDotDot; } g.DrawRectangle(pen, curx, cury, this.ImgWidth, this.ImgHeight); pen.Dispose(); rect = new RectangleF(curx + 12, cury + (this.ImgHeight - 14), this.ImgWidth - 24, 12); if (ShowText) { g.FillRectangle(new Pen(Color.FromArgb(242, 242, 242)).Brush, rect); } if (ShowText) { g.DrawString(tPictureItem.Text, new Font("Arial", 8), new Pen(Color.Black).Brush, rect); } } catch { continue; } curx += this.ImgWidth + this.MidWidth; if (((i + 1) % rowcount) == 0) { curx = 10; cury += this.ImgHeight + this.MidWidth; } } this.Count = data.Count; g.Dispose(); pictureList.Image = this.map; }