protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); int count = CustomFaceManager.GetItemCount(); int iconSz = CustomFaceManager.IconSize; for (int j = 0; j < LineCount; j++) { for (int i = 0; i < LineItemCount; i++) { int idx = j * LineItemCount + i; idx += m_pageIndex * LineItemCount * LineCount; if (idx >= count) { return; } Image img = CustomFaceManager.GetItem(idx).Icon; e.Graphics.DrawImage(img, StartX + i * iconSz, StartY + j * iconSz); e.Graphics.DrawRectangle(Pens.Black, new Rectangle(StartX + i * iconSz, StartY + j * iconSz, iconSz, iconSz)); } } }
private void m_nextPage_btn_Click(object sender, EventArgs e) { int count = CustomFaceManager.GetItemCount(); if ((m_pageIndex + 1) * LineItemCount * LineCount < count) { m_pageIndex++; } this.Invalidate(); }