public void SetData(DwarfListItem data, DwarfListMode mode)
        {
            // store it
            m_data = data;
            m_mode = mode;

            // measure it
            using (var g = this.CreateGraphics())
                this.ClientSize = DrawTip(g, false).ToSize();
        }
        private void DrawSkillBar(Graphics g, DwarfListItem item, Brush brush, string caption, bool draw, ref int y, ref float width)
        {
            // draw the image
            if (draw)
                g.DrawImageUnscaled(item.Image, LAYOUT_PADDING * 2, y);

            // skill bar
            if (draw && item.Labor.HasSkill)
            {
                var brush_pip = item.SkillInfo.Level >= GameData.SKILL_MAX ? Brushes.Gold : brush;
                var rect_background = new Rectangle(
                    LAYOUT_PADDING * 3 + item.Image.Width,
                    y + (SKILL_BAR_HEIGHT - SKILL_BAR_HEIGHT_INNER) / 2,
                    SKILL_BAR_WIDTH,
                    SKILL_BAR_HEIGHT_INNER);

                // draw background
                g.FillRectangle(SystemBrushes.ControlLightLight, rect_background);
                g.DrawRectangle(SystemPens.ControlDarkDark, rect_background.Left, rect_background.Top, rect_background.Width + 1, rect_background.Height + 1);

                // draw the level pips
                for (int i = 1; i <= item.SkillInfo.Level && i <= GameData.SKILL_MAX; ++i)
                {
                    g.FillRectangle(
                        brush_pip,
                        rect_background.Left + SKILL_BAR_WIDTH - SKILL_BAR_BORDER - (SKILL_BAR_SEGMENT + SKILL_BAR_PADDING) * i + SKILL_BAR_PADDING,
                        rect_background.Top + SKILL_BAR_BORDER + SKILL_BAR_PADDING + 1,
                        SKILL_BAR_SEGMENT,
                        SKILL_BAR_SEGMENT);
                }
            }

            // draw the caption
            var measured = g.MeasureString(caption, this.Font);
            var rect_caption = item.Labor.HasSkill
                ? new Rectangle(LAYOUT_PADDING * 4 + SKILL_BAR_WIDTH + item.Image.Width, (int)y, (int)Math.Ceiling(measured.Width), SKILL_BAR_HEIGHT)
                : new Rectangle(LAYOUT_PADDING * 3 + item.Image.Width, (int)y, (int)Math.Ceiling(measured.Width), SKILL_BAR_HEIGHT);
            if (draw)
                g.DrawString(caption, this.Font, brush, rect_caption, m_format_left_center);
            width = Math.Max(width, rect_caption.Right + LAYOUT_PADDING);

            // increment measurements
            y += SKILL_BAR_HEIGHT + LAYOUT_PADDING / 3;
        }