Exemple #1
0
        private void MessageWindow_Load(object sender, EventArgs e)
        {
            RosterItem ri = null;

            if (!XmppGlobal.Roster.TryGetValue(foreign_jid, out ri))
            {
                XmppGlobal.Roster.TryGetValue(new jabber.JID(foreign_jid.Bare), out ri);
            }

            if (ri == null)
            {
                this.Text = foreign_jid.Bare;
                this.Icon = PaintFunctions.ImageToIcon((Bitmap)XmppImages.DefaultAvatar);
                this.ChattingWith.Text = string.Format("Chatting with {0}", foreign_jid.ToString());
            }
            else
            {
                this.Text = ri.GetDisplayName();
                this.Icon = PaintFunctions.ImageToIcon((Bitmap)ri.BaseAvatar);
                this.ChattingWith.Text = string.Format("Chatting with {0}", ri.GetDisplayName());

                ri.PresenceChanged += new EventHandler <PresenceItemEventArgs> (PresenceChanged);
                PresenceChanged(ri, new PresenceItemEventArgs(ri.GetPresence()));
            }

            StatusBarPanel1.Image = XmppImages.AwayOverlay;
        }
Exemple #2
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            Graphics g = e.Graphics;

            // Clear the canvas
            g.Clear(BackColor);

            // Draw background highlight if hovering
            if (hover)
            {
                g.FillRectangle(highlight_brush, highlight_rectangle);
                PaintFunctions.DrawRoundedRectangle(g, highlight_rectangle, 5, border_pen);
            }

            // If there is an avatar, draw it
            if (avatar != null)
            {
                switch (style)
                {
                case ContactItemStyle.Regular:
                    g.DrawImage(avatar, 2, 2);
                    break;

                case ContactItemStyle.Compact:
                    if (small_avatar == null)
                    {
                        small_avatar = new Bitmap(avatar, 16, 16);
                    }

                    g.DrawImage(small_avatar, 2, 2);
                    break;

                default:
                    break;
                }
            }

            // Draw the text lines
            TextRenderer.DrawText(e.Graphics, line_one_text, line_one_font, line_one_bounds, line_one_color, Color.Transparent, TextFormatFlags.EndEllipsis);

            if (style == ContactItemStyle.Regular)
            {
                TextRenderer.DrawText(e.Graphics, line_two_text, line_two_font, line_two_bounds, line_two_color, Color.Transparent, TextFormatFlags.EndEllipsis);
            }
        }
Exemple #3
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            Graphics g = e.Graphics;

            // Clear the canvas
            g.Clear(BackColor);

            // Draw the arrow
            if (expanded)
            {
                PaintFunctions.DrawDownChevron(g, new Point(7, 8), Pens.DimGray);
            }
            else
            {
                PaintFunctions.DrawRightChevron(g, new Point(8, 5), Pens.DimGray);
            }

            // Draw the text
            TextRenderer.DrawText(g, Text, font, new Point(18, 2), Color.Black);
        }
Exemple #4
0
        protected override void OnPaintBackground(PaintEventArgs e)
        {
            base.OnPaintBackground(e);

            if (Width == 0 || Height == 0)
            {
                return;
            }

            if (hover && enabled)
            {
                Rectangle r = new Rectangle(0, 0, Width - 1, Height - 1);

                using (LinearGradientBrush b = new LinearGradientBrush(r, ProfessionalColors.MenuItemSelectedGradientBegin, ProfessionalColors.MenuItemSelectedGradientEnd, LinearGradientMode.Vertical)) {
                    PaintFunctions.FillRoundedRectangle(e.Graphics, r, 5f, b);
                    PaintFunctions.DrawRoundedRectangle(e.Graphics, r, 5f, Pens.Black);
                }
            }

            if (enabled)
            {
                PaintFunctions.DrawDownChevron(e.Graphics, new Point(Width - 15, (Height - 4) / 2), Pens.Black);
            }
        }