private void lbChat_MeasureItem(object sender, MeasureItemEventArgs e)
        {
            try
            {
                ChatNode chatNode = lbChat.Items[e.Index] as ChatNode;

                e.ItemHeight = (int)e.Graphics.MeasureString(chatNode.ToString(), lbChat.Font, lbChat.Width).Height;

                if (chatNode.image != null)
                {
                    e.ItemHeight += 100;
                }
            }
            catch
            {
            }
        }
        private void lbChat_DrawItem(object sender, DrawItemEventArgs e)
        {
            if (lbChat.Items.Count > 0 && e.Index != -1)
            {
                try
                {
                    DrawingHelper.enableSmooth(e.Graphics, false);

                    ChatNode node = lbChat.Items[e.Index] as ChatNode;

                    if ((e.State & DrawItemState.Selected) == DrawItemState.Selected)
                    {
                        e = new DrawItemEventArgs(e.Graphics,
                                                  e.Font,
                                                  e.Bounds,
                                                  e.Index,
                                                  e.State ^ DrawItemState.Selected,
                                                  e.ForeColor,
                                                  Color.FromArgb(0, 180, 255));

                        e.DrawBackground();
                        e.DrawFocusRectangle();
                    }
                    else
                    {
                        e.DrawBackground();
                        e.DrawFocusRectangle();

                        e.Graphics.FillRectangle(new SolidBrush(node.currentUser ? Color.FromArgb(192, 237, 252) : Color.FromArgb(240, 244, 248)), e.Bounds);
                    }

                    DrawingHelper.enableSmooth(e.Graphics, true);

                    e.Graphics.DrawString(node.ToString(), e.Font, new SolidBrush(e.ForeColor), e.Bounds);

                    if (node.image != null)
                    {
                        Image cropped = ImageUtils.ResizeAndCrop(node.image, 150, 100);

                        e.Graphics.TranslateTransform(0, lbChat.GetItemHeight(e.Index) - 100);
                        e.Graphics.DrawImage(cropped, 0, e.Bounds.Y);
                    }
                }
                catch { }
            }
        }