コード例 #1
0
        private void listBox_DrawItem(object sender, Tenor.Mobile.UI.DrawItemEventArgs e)
        {
            Badge badge = (Badge)e.Item.Value;

            Size factor = Tenor.Mobile.UI.Skin.Current.ScaleFactor;

            if (!string.IsNullOrEmpty(badge.Name))
            {
                int padding   = 5 * factor.Width;
                int imageSize = listBox.DefaultItemHeight - padding;

                RectangleF rect = new RectangleF
                                      (e.Bounds.X + imageSize + (padding * 2),
                                      e.Bounds.Y,
                                      e.Bounds.Width - (imageSize) - (padding * 2),
                                      e.Bounds.Height);


                if (imageList != null && imageList.ContainsKey(badge.ImageUrl.ToString()))
                {
                    if (!imageListA.ContainsKey(badge.ImageUrl.ToString()))
                    {
                        imageListA.Add(badge.ImageUrl.ToString(), new AlphaImage(new Bitmap(new MemoryStream(imageList[badge.ImageUrl.ToString()]))));
                        imageList[badge.ImageUrl.ToString()] = null;
                    }
                    AlphaImage image = imageListA[badge.ImageUrl.ToString()];

                    Rectangle imgRect =
                        new Rectangle(0 + Convert.ToInt32(padding),
                                      Convert.ToInt32(rect.Y + (rect.Height / 2) - (imageSize / 2)), imageSize, imageSize);
                    try
                    {
                        image.Draw(e.Graphics, imgRect);
                    }
                    catch (Exception ex) { Log.RegisterLog(ex); }
                }

                rect.Y += 2 * factor.Height;
                SizeF size = e.Graphics.MeasureString(badge.Name, fontBold);
                e.Graphics.DrawString(
                    badge.Name, fontBold, brush, rect);

                string text = badge.Description ?? badge.Hint;

                rect.Y += size.Height + (3 * factor.Height);
                e.Graphics.DrawString(
                    text, font, brush, rect, format);



                Rectangle rect2 = new Rectangle(
                    e.Bounds.X, e.Bounds.Bottom - 2, e.Bounds.Width / 3, 1);
                Tenor.Mobile.Drawing.GradientFill.Fill(e.Graphics, rect2, this.BackColor, Color.Gray, Tenor.Mobile.Drawing.GradientFill.FillDirection.LeftToRight);
                rect2.X += rect2.Width;
                Tenor.Mobile.Drawing.GradientFill.Fill(e.Graphics, rect2, Color.Gray, Color.Gray, Tenor.Mobile.Drawing.GradientFill.FillDirection.LeftToRight);
                rect2.X += rect2.Width;
                Tenor.Mobile.Drawing.GradientFill.Fill(e.Graphics, rect2, Color.Gray, this.BackColor, Tenor.Mobile.Drawing.GradientFill.FillDirection.LeftToRight);
            }
        }
コード例 #2
0
ファイル: VenueTips.cs プロジェクト: junalmeida/mysquare
        private void listBox_DrawItem(object sender, Tenor.Mobile.UI.DrawItemEventArgs e)
        {
            Tip tip = (Tip)e.Item.Value;


            if (!string.IsNullOrEmpty(tip.Text))
            {
                float padding   = 5 * factor.Width;
                int   imageSize = Convert.ToInt32(listBox.DefaultItemHeight - padding);

                RectangleF rect = new RectangleF
                                      (e.Bounds.X + imageSize + (padding * 2),
                                      e.Bounds.Y,
                                      e.Bounds.Width - (imageSize) - (padding * 2),
                                      e.Bounds.Height);

                if (e.Item.Selected)
                {
                    Tenor.Mobile.Drawing.RoundedRectangle.Fill(e.Graphics,
                                                               borderPen, selectedBrush, e.Bounds, new SizeF(8 * factor.Width, 8 * factor.Height).ToSize());
                }

                if (imageList != null && imageList.ContainsKey(tip.User.ImageUrl))
                {
                    Bitmap image = imageList[tip.User.ImageUrl];

                    Rectangle imgRect =
                        new Rectangle(0 + Convert.ToInt32(padding),
                                      Convert.ToInt32(rect.Y + (rect.Height / 2) - (imageSize / 2)), imageSize, imageSize);
                    try
                    {
                        e.Graphics.DrawImage(image, imgRect, new Rectangle(0, 0, image.Width, image.Height), GraphicsUnit.Pixel);
                        //image.Draw(e.Graphics, imgRect);
                    }
                    catch { }
                }

                e.Graphics.DrawString(
                    tip.User.ToString(), fontBold, brush, rect);

                SizeF size = e.Graphics.MeasureString(tip.User.ToString(), fontBold);
                rect.Y += size.Height;
                e.Graphics.DrawString(
                    tip.Text, font, brush, rect, format);

                if (!e.Item.Selected)
                {
                    Rectangle rect2 = new Rectangle(
                        e.Bounds.X, e.Bounds.Bottom - 2, e.Bounds.Width / 3, 1);
                    Tenor.Mobile.Drawing.GradientFill.Fill(e.Graphics, rect2, this.BackColor, Color.Gray, Tenor.Mobile.Drawing.GradientFill.FillDirection.LeftToRight);
                    rect2.X += rect2.Width;
                    Tenor.Mobile.Drawing.GradientFill.Fill(e.Graphics, rect2, Color.Gray, Color.Gray, Tenor.Mobile.Drawing.GradientFill.FillDirection.LeftToRight);
                    rect2.X += rect2.Width;
                    Tenor.Mobile.Drawing.GradientFill.Fill(e.Graphics, rect2, Color.Gray, this.BackColor, Tenor.Mobile.Drawing.GradientFill.FillDirection.LeftToRight);
                }
            }
        }
コード例 #3
0
        private void listBox_DrawItem(object sender, Tenor.Mobile.UI.DrawItemEventArgs e)
        {
            object obj = e.Item.Value;

            Venue venue = e.Item.Value as Venue;
            Tip   tip   = e.Item.Value as Tip;

            if (tip != null)
            {
                venue = tip.Venue;
            }


            Brush textBrush = (e.Item.Selected ? brushS : brush);

            if (obj == null)
            {
                if (smallFont == null)
                {
                    smallFont = new Font(this.Font.Name, this.Font.Size - 1, this.Font.Style);
                }

                Font  thisFont;
                float thisLeft;


                if (e.Item.YIndex < listBox.Count - 1)
                {
                    thisLeft = itemPadding;
                    thisFont = smallFont;
                }
                else
                {
                    thisLeft = e.Bounds.Height;
                    thisFont = Font;
                }

                string text = e.Item.Text;
                if (text.EndsWith("Nearby") && Address != null)
                {
                    StringBuilder geo = new StringBuilder();
                    if (!string.IsNullOrEmpty(Address.Neighborhood))
                    {
                        geo.Append(", ");
                        geo.Append(Address.Neighborhood);
                    }
                    if (!string.IsNullOrEmpty(Address.City))
                    {
                        geo.Append(", ");
                        geo.Append(Address.City);
                    }
                    if (string.IsNullOrEmpty(Address.Neighborhood) && string.IsNullOrEmpty(Address.City))
                    {
                        if (!string.IsNullOrEmpty(Address.Province))
                        {
                            geo.Append(", ");
                            geo.Append(Address.Province);
                        }
                        if (!string.IsNullOrEmpty(Address.Country))
                        {
                            geo.Append(", ");
                            geo.Append(Address.Country);
                        }
                    }

                    if (geo.Length > 0)
                    {
                        geo   = geo.Remove(0, 2);
                        text += " " + geo.ToString();
                    }
                }


                string secondText = null;

                if (text.IndexOf("\r\n") > -1)
                {
                    string[] textS = text.Split('\r', '\n');
                    text       = textS[0];
                    secondText = textS[2];
                }

                SizeF      measuring = e.Graphics.MeasureString(text, thisFont);
                RectangleF rect      = new RectangleF(thisLeft, e.Bounds.Y + itemPadding, measuring.Width, measuring.Height);

                Color color = Tenor.Mobile.UI.Skin.Current.ControlBackColor;
                if (e.Item.YIndex % 2 == 0)
                {
                    color = Tenor.Mobile.UI.Skin.Current.AlternateBackColor;
                }
                if (e.Item.YIndex < listBox.Count - 1)
                {
                    e.Graphics.FillRectangle(new SolidBrush(color), e.Bounds);
                }
                if (e.Item.YIndex > 0)
                {
                    e.Graphics.DrawSeparator(e.Bounds, color);
                }

                e.Graphics.DrawString(text, thisFont, textBrush, rect, format);
                if (secondText != null)
                {
                    if (secondFont == null)
                    {
                        secondFont = new Font(Font.Name, Font.Size - 1, Font.Style);
                    }
                    measuring = e.Graphics.MeasureString(secondText, secondFont);
                    rect      = new RectangleF(rect.X, rect.Bottom + itemPadding, measuring.Width, measuring.Height);
                    e.Graphics.DrawString(secondText, secondFont, secondBrush, rect, format);
                }
            }
            else
            {
                string title = null;
                if (tip != null)
                {
                    title = tip.User.ToString() + " @ " + venue.Name;
                }
                else
                {
                    title = venue.Name;
                }

                SizeF measuring = e.Graphics.MeasureString(title, Font);

                RectangleF rect = new RectangleF(listBox.DefaultItemHeight, e.Bounds.Y + itemPadding, measuring.Width, measuring.Height);
                if (tip != null)
                {
                    rect.X = e.Bounds.X + itemPadding;
                }
                e.Graphics.DrawString(title, this.Font, textBrush, rect, format);

                string secondText = null;
                if (tip != null && !string.IsNullOrEmpty(tip.Text))
                {
                    secondText = tip.Text;
                }
                else if (venue.Location != null)
                {
                    if (!string.IsNullOrEmpty(venue.Location.Address))
                    {
                        secondText = venue.Location.Address;
                    }
                    else if (!string.IsNullOrEmpty(venue.Location.City))
                    {
                        secondText = venue.Location.City;
                    }
                    else if (!string.IsNullOrEmpty(venue.Location.State))
                    {
                        secondText = venue.Location.State;
                    }
                }
                if (secondText != null)
                {
                    if (secondFont == null)
                    {
                        secondFont = new Font(Font.Name, Font.Size - 1, Font.Style);
                    }
                    measuring = e.Graphics.MeasureString(secondText, secondFont);
                    rect      = new RectangleF(rect.X, rect.Bottom + itemPadding, e.Bounds.Width - rect.X, e.Bounds.Height);
                    e.Graphics.DrawString(secondText, secondFont, secondBrush, rect, formatWrap);
                }
                if (
                    (
                        (venue.PrimaryCategory == null && imageList.ContainsKey(string.Empty)) ||
                        (venue.PrimaryCategory != null && imageList.ContainsKey(venue.PrimaryCategory.IconUrl.ToString()))
                    ) &&
                    tip == null
                    )
                {
                    string iconUrl = string.Empty;
                    if (venue.PrimaryCategory != null)
                    {
                        iconUrl = venue.PrimaryCategory.IconUrl.ToString();
                    }

                    int imageSize = listBox.DefaultItemHeight - Convert.ToInt32(itemPadding * 2);

                    if (!imageListBuffer.ContainsKey(iconUrl))
                    {
                        imageListBuffer.Add(iconUrl, new AlphaImage(Main.CreateRoundedAvatar(imageList[iconUrl], imageSize, factor)));
                    }
                    AlphaImage alpha = imageListBuffer[iconUrl];
                    try
                    {
                        alpha.Draw(e.Graphics,
                                   new Rectangle(
                                       e.Bounds.X + Convert.ToInt32(itemPadding),
                                       e.Bounds.Y + Convert.ToInt32(itemPadding),
                                       imageSize,
                                       imageSize), Tenor.Mobile.UI.Skin.Current.SelectedBackColor);
                    }
                    catch (Exception ex)
                    {
                        imageListBuffer.Remove(iconUrl);
                        Log.RegisterLog("gdi", ex);
                    }
                }

                if (venue.Specials != null)
                {
                    foreach (Special special in venue.Specials)
                    {
                        if (special.Kind != SpecialKind.here)
                        {
                            continue;
                        }
                        try
                        {
                            int padd = 10 * Tenor.Mobile.UI.Skin.Current.ScaleFactor.Height;

                            AlphaImage alpha = new AlphaImage(Resources.SpecialHere);
                            Rectangle  rectS = new Rectangle(e.Bounds.Right - listBox.DefaultItemHeight - padd, e.Bounds.Y, listBox.DefaultItemHeight + padd, listBox.DefaultItemHeight + padd);
                            rectS.Y = rectS.Y - (padd / 2);

                            alpha.Draw(e.Graphics, rectS);
                        }
                        catch (Exception ex)
                        {
                            Log.RegisterLog("gdi", ex);
                        }
                    }
                }
            }
        }
コード例 #4
0
ファイル: UserFriends.cs プロジェクト: junalmeida/mysquare
        private void listBox_DrawItem(object sender, Tenor.Mobile.UI.DrawItemEventArgs e)
        {
            User user = (User)e.Item.Value;



            Size factor = Tenor.Mobile.UI.Skin.Current.ScaleFactor;

            if (!string.IsNullOrEmpty(user.ToString()))
            {
                int padding   = 5 * factor.Width;
                int imageSize = listBox.DefaultItemHeight - padding;

                RectangleF rect = new RectangleF
                                      (e.Bounds.X + imageSize + (padding * 2),
                                      e.Bounds.Y,
                                      e.Bounds.Width - (imageSize) - (padding * 2),
                                      e.Bounds.Height);

                if (e.Item.Selected)
                {
                    Tenor.Mobile.Drawing.RoundedRectangle.Fill(e.Graphics,
                                                               borderPen, selectedBrush, e.Bounds, new Size(8 * factor.Width, 8 * factor.Height));
                }

                if (imageList != null && imageList.ContainsKey(user.ImageUrl))
                {
                    if (!imageListBuffer.ContainsKey(user.ImageUrl))
                    {
                        imageListBuffer.Add(user.ImageUrl, new AlphaImage(Main.CreateRoundedAvatar(imageList[user.ImageUrl], imageSize, factorF)));
                    }
                    AlphaImage image = imageListBuffer[user.ImageUrl];

                    Rectangle imgRect =
                        new Rectangle(0 + Convert.ToInt32(padding),
                                      Convert.ToInt32(rect.Y + (rect.Height / 2) - (imageSize / 2)), imageSize, imageSize);
                    try
                    {
                        //e.Graphics.DrawImage(image, imgRect, new Rectangle(0, 0, image.Width, image.Height), GraphicsUnit.Pixel);
                        image.Draw(e.Graphics, imgRect);
                    }
                    catch (Exception ex) { Log.RegisterLog("gdi", ex); }
                }

                rect.Y += 2 * factor.Height;
                SizeF size = e.Graphics.MeasureString(user.ToString(), fontBold);
                e.Graphics.DrawString(
                    user.ToString(), fontBold, brush, rect);

                if (user.CheckIn != null)
                {
                    string text = string.Empty;

                    if (user.CheckIn.Venue != null)
                    {
                        text = "@ " + user.CheckIn.Venue.Name;
                    }
                    else if (!string.IsNullOrEmpty(user.CheckIn.Shout))
                    {
                        text = user.CheckIn.Shout;
                    }
                    else if (user.CheckIn.Created > DateTime.MinValue)
                    {
                        text = user.CheckIn.Created.ToHumanTime();
                    }


                    rect.Y += size.Height + (3 * factor.Height);
                    e.Graphics.DrawString(
                        text, font, brush, rect, format);
                }


                if (!e.Item.Selected)
                {
                    Rectangle rect2 = new Rectangle(
                        e.Bounds.X, e.Bounds.Bottom - 2, e.Bounds.Width / 3, 1);
                    Tenor.Mobile.Drawing.GradientFill.Fill(e.Graphics, rect2, this.BackColor, Color.Gray, Tenor.Mobile.Drawing.GradientFill.FillDirection.LeftToRight);
                    rect2.X += rect2.Width;
                    Tenor.Mobile.Drawing.GradientFill.Fill(e.Graphics, rect2, Color.Gray, Color.Gray, Tenor.Mobile.Drawing.GradientFill.FillDirection.LeftToRight);
                    rect2.X += rect2.Width;
                    Tenor.Mobile.Drawing.GradientFill.Fill(e.Graphics, rect2, Color.Gray, this.BackColor, Tenor.Mobile.Drawing.GradientFill.FillDirection.LeftToRight);
                }
            }
        }
コード例 #5
0
ファイル: Friends.cs プロジェクト: junalmeida/mysquare
        private void listBox_DrawItem(object sender, Tenor.Mobile.UI.DrawItemEventArgs e)
        {
            string text       = null;
            string secondText = null;
            string userUrl    = null;

            Font  font     = this.Font;
            float thisLeft = e.Bounds.Height;

            if (e.Item.Value == null)
            {
                if (smallFont == null)
                {
                    smallFont = new Font(this.Font.Name, this.Font.Size - 1, this.Font.Style);
                }
                font = smallFont;
                text = e.Item.Text;
                Color color = Tenor.Mobile.UI.Skin.Current.ControlBackColor;
                if (e.Item.YIndex % 2 == 0)
                {
                    color = Tenor.Mobile.UI.Skin.Current.AlternateBackColor;
                }
                e.Graphics.FillRectangle(new SolidBrush(color), e.Bounds);
                thisLeft = itemPadding;
                if (e.Item.YIndex > 0)
                {
                    e.Graphics.DrawSeparator(e.Bounds, color);
                }
            }
            else if (e.Item.Value != null && e.Item.Value is CheckIn)
            {
                CheckIn checkIn = (CheckIn)e.Item.Value;

                text = checkIn.ToString();

                if (checkIn.User != null)
                {
                    userUrl = checkIn.User.ImageUrl;
                }


                secondText = checkIn.Created.ToHumanTime();
            }
            else if (e.Item.Value != null && e.Item.Value is User)
            {
                User user = (User)e.Item.Value;
                text = string.Format("{0} {1}", user.FirstName, user.LastName);
                if (user.Contact != null)
                {
                    secondText = user.Contact.Email;
                }
                userUrl = user.ImageUrl;
            }


            Brush textBrush = (e.Item.Selected ? brushS : brush);
            SizeF measuring = e.Graphics.MeasureString(text, Font);

            RectangleF rect = new RectangleF(thisLeft, e.Bounds.Y + itemPadding, measuring.Width, measuring.Height);

            e.Graphics.DrawString(text, font, textBrush, rect, format);

            if (!string.IsNullOrEmpty(secondText))
            {
                measuring = e.Graphics.MeasureString(secondText, Font);
                rect      = new RectangleF(rect.X, rect.Bottom + itemPadding, measuring.Width, measuring.Height);
                if (secondFont == null)
                {
                    secondFont = new Font(Font.Name, Font.Size - 1, Font.Style);
                }
                e.Graphics.DrawString(secondText, secondFont, secondBrush, rect, format);
            }

            if (userUrl != null && imageList.ContainsKey(userUrl) && imageList[userUrl] != null)
            {
                int imageSize = e.Bounds.Height - Convert.ToInt32(itemPadding * 2);

                if (!imageListBuffer.ContainsKey(userUrl))
                {
                    imageListBuffer.Add(userUrl,
                                        new AlphaImage(Main.CreateRoundedAvatar(imageList[userUrl], imageSize, factor)));
                }
                AlphaImage alpha = imageListBuffer[userUrl];

                try
                {
                    alpha.Draw(e.Graphics,
                               new Rectangle(
                                   e.Bounds.X + Convert.ToInt32(itemPadding),
                                   e.Bounds.Y + Convert.ToInt32(itemPadding),
                                   imageSize,
                                   imageSize), Tenor.Mobile.UI.Skin.Current.SelectedBackColor);
                }
                catch (Exception ex)
                {
                    imageListBuffer.Remove(userUrl);
                    Log.RegisterLog("gdi", ex);
                }
            }
        }
コード例 #6
0
        private void listBox_DrawItem(object sender, Tenor.Mobile.UI.DrawItemEventArgs e)
        {
            if (smallFont == null)
            {
                smallFont = new Font(this.Font.Name, this.Font.Size - 1, this.Font.Style);
            }
            if (format == null)
            {
                format = new StringFormat();
            }
            if (textBrush == null)
            {
                textBrush = new SolidBrush(Color.White);
            }
            if (secondBrush == null)
            {
                secondBrush = new SolidBrush(Color.LightGray);
            }



            Font  thisFont = listBox.Font;
            float thisLeft = e.Bounds.Height;


            string text       = e.Item.Text;
            string secondText = null;

            if (text.IndexOf("\r\n") > -1)
            {
                string[] textS = text.Split('\r', '\n');
                text       = textS[0];
                secondText = textS[2];
            }

            SizeF      measuring = e.Graphics.MeasureString(text, thisFont);
            RectangleF rect      = new RectangleF(thisLeft, e.Bounds.Y + itemPadding, measuring.Width, measuring.Height);

            Color color = Tenor.Mobile.UI.Skin.Current.ControlBackColor;

            if (e.Item.YIndex % 2 == 0)
            {
                color = Tenor.Mobile.UI.Skin.Current.AlternateBackColor;
            }
            //if (!e.Item.Selected)
            //    e.Graphics.FillRectangle(new SolidBrush(color), e.Bounds);
            if (e.Item.YIndex > 0)
            {
                e.Graphics.DrawSeparator(e.Bounds, color);
            }

            e.Graphics.DrawString(text, thisFont, textBrush, rect, format);
            if (secondText != null)
            {
                measuring = e.Graphics.MeasureString(secondText, smallFont);
                rect      = new RectangleF(rect.X, rect.Bottom + itemPadding, measuring.Width, measuring.Height);
                e.Graphics.DrawString(secondText, smallFont, secondBrush, rect, format);
            }

            AlphaImage alpha = e.Item.Value as AlphaImage;

            if (alpha != null)
            {
                try
                {
                    int imageSize = e.Bounds.Height - Convert.ToInt32(itemPadding * 2);
                    alpha.Draw(e.Graphics,
                               new Rectangle(
                                   e.Bounds.X + Convert.ToInt32(itemPadding),
                                   e.Bounds.Y + Convert.ToInt32(itemPadding),
                                   imageSize,
                                   imageSize));
                }
                catch (Exception ex)
                {
                    Log.RegisterLog("gdi", ex);
                }
            }
        }
コード例 #7
0
        void lstAll_DrawItem(object sender, Tenor.Mobile.UI.DrawItemEventArgs e)
        {
            var             listBox = (Tenor.Mobile.UI.KListControl)sender;
            LeaderboardUser lboard  = (LeaderboardUser)e.Item.Value;

            User user = lboard.User;

            string     rankText = "#" + lboard.Rank.ToString();
            SizeF      rankSize = e.Graphics.MeasureString(rankText, medFont);
            RectangleF rankRect = new RectangleF(
                3 * factorF.Width,
                e.Bounds.Y + (e.Bounds.Height / 2 - rankSize.Height / 2),
                rankSize.Width,
                rankSize.Height
                );

            Size factor = Tenor.Mobile.UI.Skin.Current.ScaleFactor;

            if (!string.IsNullOrEmpty(user.ToString()))
            {
                int padding   = 5 * factor.Width;
                int imageSize = listBox.DefaultItemHeight - padding;

                RectangleF rect = new RectangleF
                                      (imageSize + (padding * 2) + rankRect.Right,
                                      e.Bounds.Y,
                                      e.Bounds.Width - (imageSize) - (padding * 2),
                                      e.Bounds.Height);

                if (user.FriendStatus != null && user.FriendStatus.Value == FriendStatus.self)
                {
                    Tenor.Mobile.Drawing.RoundedRectangle.Fill(e.Graphics,
                                                               borderPen, selectedBrush, e.Bounds, new Size(8 * factor.Width, 8 * factor.Height));
                }
                e.Graphics.DrawString(rankText, medFont, brush, rankRect);

                if (imageList != null && imageList.ContainsKey(user.ImageUrl))
                {
                    if (!imageListBuffer.ContainsKey(user.ImageUrl))
                    {
                        imageListBuffer.Add(user.ImageUrl, new AlphaImage(Main.CreateRoundedAvatar(imageList[user.ImageUrl], imageSize, factorF)));
                    }
                    AlphaImage image = imageListBuffer[user.ImageUrl];

                    Rectangle imgRect =
                        new Rectangle(Convert.ToInt32(rankRect.Right + padding),
                                      Convert.ToInt32(rect.Y + (rect.Height / 2) - (imageSize / 2)), imageSize, imageSize);
                    try
                    {
                        //e.Graphics.DrawImage(image, imgRect, new Rectangle(0, 0, image.Width, image.Height), GraphicsUnit.Pixel);
                        image.Draw(e.Graphics, imgRect);
                    }
                    catch (Exception ex) { Log.RegisterLog("gdi", ex); }
                }

                rect.Y += 2 * factor.Height;
                SizeF size = e.Graphics.MeasureString(user.ToString(), fontBold);
                e.Graphics.DrawString(
                    user.ToString(), fontBold, brush, rect);

                if (lboard.Scores != null)
                {
                    string text = "7-day high score: ";
                    text += lboard.Scores.Max.ToString();


                    rect.Y += size.Height + (3 * factor.Height);
                    e.Graphics.DrawString(
                        text, font, brush, rect, format);


                    var   scoreText = lboard.Scores.Recent.ToString();
                    SizeF sizeScore = e.Graphics.MeasureString(scoreText, bigFont);
                    rect = new RectangleF(
                        e.Bounds.Width - sizeScore.Width - (10 * factorF.Width),
                        e.Bounds.Y + (e.Bounds.Height / 2 - sizeScore.Height / 2),
                        sizeScore.Width, sizeScore.Height
                        );

                    e.Graphics.DrawString(
                        scoreText, bigFont, brush, rect, format);
                }


                if (user.FriendStatus != null && user.FriendStatus.Value != FriendStatus.self)
                {
                    Rectangle rect2 = new Rectangle(
                        e.Bounds.X, e.Bounds.Bottom - 2, e.Bounds.Width / 3, 1);
                    Tenor.Mobile.Drawing.GradientFill.Fill(e.Graphics, rect2, this.BackColor, Color.Gray, Tenor.Mobile.Drawing.GradientFill.FillDirection.LeftToRight);
                    rect2.X += rect2.Width;
                    Tenor.Mobile.Drawing.GradientFill.Fill(e.Graphics, rect2, Color.Gray, Color.Gray, Tenor.Mobile.Drawing.GradientFill.FillDirection.LeftToRight);
                    rect2.X += rect2.Width;
                    Tenor.Mobile.Drawing.GradientFill.Fill(e.Graphics, rect2, Color.Gray, this.BackColor, Tenor.Mobile.Drawing.GradientFill.FillDirection.LeftToRight);
                }
            }
        }