Beispiel #1
0
        private void button_MouseMove(object sender, MouseEventArgs e)
        {
            //Get actual form screen and use it to enable FullScreen
            Screen screen = Screen.FromControl(this);

            Point p = PointToClient(Control.MousePosition);
            int   h = screen.WorkingArea.Bottom;
            int   w = screen.WorkingArea.Right;

            p.X -= w / 64;
            p.Y -= h / 64;
            Rectangle r = new Rectangle(p, new Size(w / 32, h / 32));

            if (ClientRectangle.IntersectsWith(r))
            {
                SetButtonColor(Color.White);
            }
            else
            {
                SetButtonColor(Color.Black);
            }
            if (mouseDown)
            {
                Opacity = 0.05;
                int xoffset = MousePosition.X - lastPos.X;
                int yoffset = MousePosition.Y - lastPos.Y;
                Left   += xoffset;
                Top    += yoffset;
                lastPos = MousePosition;
            }
            else
            {
                Opacity = 0.1;
            }
        }
Beispiel #2
0
        private void GlDrawer_MouseWheel(object sender, MouseEventArgs e)
        {
            float    zoomK = 10;
            var      cur   = PointToClient(Cursor.Position);
            MouseRay mr    = new MouseRay(cur.X, cur.Y, Camera);


            var camera = Camera;

            if (ClientRectangle.IntersectsWith(new Rectangle(PointToClient(Cursor.Position), new Size(1, 1))))
            {
                if (e.Delta > 0)
                {
                    var dir = camera.CamTo - camera.CamFrom;
                    dir = mr.Dir;
                    dir.Normalize();
                    camera.CamFrom += dir * zoomK;
                    camera.CamTo   += dir * zoomK;
                }
                else
                {
                    var dir = camera.CamTo - camera.CamFrom;
                    dir = mr.Dir;
                    dir.Normalize();
                    camera.CamFrom -= dir * zoomK;
                    camera.CamTo   -= dir * zoomK;
                }
            }
        }
Beispiel #3
0
        public void InvalidateItem(HistoryItem item)
        {
            var bounds = item.Bounds;

            bounds.Offset(0, -_scroll);
            if (ClientRectangle.IntersectsWith(bounds))
            {
                Invalidate(bounds);
            }
        }
Beispiel #4
0
        /// <summary>
        /// 重绘每项
        /// </summary>
        /// <param name="e"></param>
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
            Rectangle bound;

            for (int i = 0; i < Items.Count; ++i)
            {
                WXUser user = Items[i] as WXUser;
                bound = GetItemRectangle(i);

                if (user != null)  //好友项
                {
                    if (!ClientRectangle.IntersectsWith(bound))
                    {
                        continue;
                    }
                    if (_mouse_over == i)
                    {
                        e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(20, 37, 37, 37)), bound);
                    }
                    if (SelectedIndex == i)
                    {
                        e.Graphics.FillRectangle(Brushes.LightGray, bound);
                    }
                    e.Graphics.DrawLine(new Pen(Color.FromArgb(50, Color.Black)), new Point(bound.X, bound.Y + 50), new Point(bound.X + Width, bound.Y + 50));
                    using (Font f = new System.Drawing.Font("微软雅黑", 11))
                    {
                        if (user.Icon != null)
                        {
                            e.Graphics.DrawImage(user.Icon, new Rectangle(bound.X + 8, bound.Y + 8, 34, 34));           //头像
                        }
                        e.Graphics.DrawString(user.ShowName, f, Brushes.Black, new PointF(bound.X + 50, bound.Y + 16)); //昵称
                    }
                }
                else  //分类项
                {
                    if (!ClientRectangle.IntersectsWith(bound))
                    {
                        continue;
                    }

                    using (Font f = new Font("微软雅黑", 15))
                    {
                        if (!string.IsNullOrEmpty(Items[i].ToString()))
                        {
                            e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(150, Color.Gray)), bound);
                            e.Graphics.DrawString(i == 0 ? "" : Items[i].ToString(), f, Brushes.Black, new PointF(bound.X + 10, bound.Y + 3));
                        }
                    }
                }
            }
        }
        private void TransparentCommandBarControl_Invalidated(object sender, InvalidateEventArgs e)
        {
            Point     absLoc  = _parent.PointToScreen(e.InvalidRect.Location);
            Point     relLoc  = PointToClient(absLoc);
            Rectangle relRect = new Rectangle(relLoc, e.InvalidRect.Size);

            if (ClientRectangle.IntersectsWith(relRect))
            {
                relRect.Intersect(ClientRectangle);
                Invalidate(relRect);
            }
        }
Beispiel #6
0
        /// <summary>
        /// 重绘
        /// </summary>
        /// <param name="e"></param>
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            Rectangle bound;

            e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
            for (int i = 0; i < Items.Count; ++i)
            {
                WXUser user = Items[i] as WXUser;
                if (user != null)
                {
                    bound = GetItemRectangle(i);
                    if (!ClientRectangle.IntersectsWith(bound))
                    {
                        continue;
                    }
                    if (_mouse_over == i)
                    {
                        e.Graphics.FillRectangle(new SolidBrush(Color.FromArgb(20, 248, 248, 255)), bound);
                    }
                    if (SelectedIndex == i)
                    {
                        e.Graphics.FillRectangle(Brushes.LightGray, bound);
                    }
                    e.Graphics.DrawLine(new Pen(Color.FromArgb(50, Color.Black)), new Point(bound.X, bound.Y + 70), new Point(bound.X + Width, bound.Y + 70));
                    using (Font f = new Font("微软雅黑", 11))
                    {
                        if (user.Icon != null)
                        {
                            e.Graphics.DrawImage(user.Icon, new Rectangle(bound.X + 10, bound.Y + 10, 50, 50));        //头像
                        }
                        e.Graphics.DrawString(user.ShowName, f, Brushes.Black, new PointF(bound.X + 70, bound.Y + 8)); //昵称
                    }
                    List <WXMsg> list_unread = user.GetUnReadMsg();
                    WXMsg        latest      = user.GetLatestMsg();
                    if (list_unread != null)  //有未读消息
                    {
                        using (Font f2 = new Font("微软雅黑", 10))
                        {
                            string time_str  = list_unread[list_unread.Count - 1].Time.ToShortTimeString();
                            Size   time_size = TextRenderer.MeasureText(time_str, f2);
                            e.Graphics.DrawString(time_str, f2, new SolidBrush(Color.FromArgb(0, 0, 0)), new PointF(bound.X + Width - time_size.Width - 13, bound.Y + 8)); //最后一条未读消息时间

                            string latest_msg = list_unread[list_unread.Count - 1].Msg.ToString();                                                                         //最后一条未读消息
                            latest_msg = latest_msg.Length <= 10 ? latest_msg : latest_msg.Substring(0, 10) + "...";
                            latest_msg = "[" + list_unread.Count + "条] " + latest_msg;
                            Size latest_msg_size = TextRenderer.MeasureText(latest_msg, f2);
                            e.Graphics.DrawString(latest_msg, f2, new SolidBrush(Color.FromArgb(0, 0, 0)), new PointF(bound.X + 70, bound.Y + 40));
                        }
                        using (Font f3 = new Font("微软雅黑", 8))  //未读消息条数  小红圆点
                        {
                            e.Graphics.FillEllipse(Brushes.Red, new Rectangle(bound.X + 10 + 50 - 9, bound.Y + 10 - 9, 18, 18));
                            e.Graphics.DrawString((list_unread.Count < 10 ? list_unread.Count.ToString() : "..."), f3, Brushes.White, new PointF(bound.X + 10 + 50 - 5, bound.Y + 10 - 7));
                        }
                    }
                    else //否则 显示最新的一条消息
                    {
                        if (latest != null)
                        {
                            using (Font f2 = new Font("微软雅黑", 10))
                            {
                                string time_str  = latest.Time.ToShortTimeString();
                                Size   time_size = TextRenderer.MeasureText(time_str, f2);
                                e.Graphics.DrawString(time_str, f2, new SolidBrush(Color.FromArgb(255, 69, 0)), new PointF(bound.X + Width - time_size.Width - 13, bound.Y + 8)); //最后一条未读消息时间

                                string latest_msg = latest.Msg.ToString();                                                                                                        //最新一条消息
                                latest_msg = latest_msg.Length <= 10 ? latest_msg : latest_msg.Substring(0, 10) + "...";
                                Size latest_msg_size = TextRenderer.MeasureText(latest_msg, f2);
                                e.Graphics.DrawString(latest_msg, f2, new SolidBrush(Color.FromArgb(0, 0, 0)), new PointF(bound.X + 70, bound.Y + 40));
                            }
                        }
                    }
                }
            }
        }
Beispiel #7
0
        /// <summary>
        /// Event-Handler for the Graphic-Update-Timer-Tick
        /// </summary>
        /// <param name="sender">Contains information which object triggered the Event.</param>
        /// <param name="e">Conatins informatin about the Event.</param>
        private void OnTimerTick(object sender, EventArgs e)
        {
            for (int j = 0; j < chars.Length; j++)
            {
                RectangleF character = chars[j].RectF;
                SizeF      velocity  = chars[j].Velocity;
                if (velocity.Height < 30)                 //the player shouldn't fall faster than 30 px/tick, it can cause miss calculation
                {
                    velocity.Height += g;
                }

                if (!ClientRectangle.IntersectsWith(Rectangle.Round(character)))
                {
                    character.Location = loadedLevel.StartPoint;
                }

                Portal sourcePortal = null;
                Portal destPortal   = null;
                bool   portalHitted = false;
                if (bluePortal.Hitbox.IntersectsWith(Rectangle.Round(character)) && orangePortal.Alignment != -1)
                {
                    destPortal   = orangePortal;
                    sourcePortal = bluePortal;
                    portalHitted = true;
                }
                else if (orangePortal.Hitbox.IntersectsWith(Rectangle.Round(character)) && bluePortal.Alignment != -1)
                {
                    destPortal   = bluePortal;
                    sourcePortal = orangePortal;
                    portalHitted = true;
                }

                if (portalHitted)
                {
                    switch (destPortal.Alignment)
                    {
                    case 0:
                        character.Location = Point.Subtract(destPortal.ImageLocation, new Size(Convert.ToInt32(character.Width), 0));
                        break;

                    case 1:
                        character.Location = Point.Add(destPortal.ImageLocation, new Size(4, 0));
                        break;

                    case 2:
                        character.Location = Point.Subtract(destPortal.ImageLocation, new Size(0, Convert.ToInt32(character.Height)));
                        break;

                    case 3:
                        character.Location = Point.Add(destPortal.ImageLocation, new Size(32 - Convert.ToInt32(character.Width / 2), 4));
                        break;
                    }

                    #region Velocity change
                    int sa = sourcePortal.Alignment;
                    int da = destPortal.Alignment;
                    //source left
                    if (sa == 0 && da == 0)                     // dest left
                    {
                        velocity.Width = -velocity.Width;
                    }
                    else if (sa == 0 && da == 1)                     // dest right
                    {
                        //nothing to change
                    }
                    else if (sa == 0 && da == 2)                     // dest up
                    {
                        float temp = -velocity.Width;
                        velocity.Width  = velocity.Height;
                        velocity.Height = temp;
                    }
                    else if (sa == 0 && da == 3)                     // dest bottom
                    {
                        float temp = velocity.Width;
                        velocity.Width  = velocity.Height;
                        velocity.Height = temp;
                    }
                    //source right
                    else if (sa == 1 && da == 0)                     //dest left
                    {
                        //nothing to change
                    }
                    else if (sa == 1 && da == 1)                      // dest right
                    {
                        velocity.Width = -velocity.Width;
                    }
                    else if (sa == 1 && da == 2)                     // dest up
                    {
                        float temp = velocity.Width;
                        velocity.Width  = velocity.Height;
                        velocity.Height = temp;
                    }
                    else if (sa == 1 && da == 3)                     // dest bottom
                    {
                        float temp = -velocity.Width;
                        velocity.Width  = velocity.Height;
                        velocity.Height = temp;
                    }
                    //source up
                    else if (sa == 2 && da == 0)                     // dest left
                    {
                        float temp = -velocity.Height;
                        velocity.Height = velocity.Width;
                        velocity.Width  = temp;
                    }
                    else if (sa == 2 && da == 1)                     // dest right
                    {
                        float temp = velocity.Height;
                        velocity.Height = velocity.Width;
                        velocity.Width  = temp;
                    }
                    else if (sa == 2 && da == 2)                     // dest up
                    {
                        velocity.Height = -velocity.Height;
                    }
                    else if (sa == 2 && da == 3)                     // dest bottom
                    {
                        //nothing to change
                    }
                    // source bottom
                    else if (sa == 3 && da == 0)                     // dest left
                    {
                        float temp = -velocity.Height;
                        velocity.Height = velocity.Width;
                        velocity.Width  = temp;
                    }
                    else if (sa == 3 && da == 1)                     // dest right
                    {
                        float temp = velocity.Height;
                        velocity.Height = velocity.Width;
                        velocity.Width  = temp;
                    }
                    else if (sa == 3 && da == 2)                     // dest up
                    {
                        // nothing to change
                    }
                    else if (sa == 3 && da == 3)                     // dest bottom
                    {
                        velocity.Height = -velocity.Height;
                    }
                    #endregion
                }

                RectangleF futureCharacter = new RectangleF(character.Location + velocity, character.Size);

                if (!bluePortal.Hitbox.IntersectsWith(Rectangle.Round(futureCharacter)) &&
                    !orangePortal.Hitbox.IntersectsWith(Rectangle.Round(futureCharacter)) ||
                    bluePortal.Alignment == -1 || orangePortal.Alignment == -1)
                {
                    #region Detect the collision in the next tick

                    List <int> futureCollidedTileIndex = new List <int>();

                    for (int i = 0; i < tilesArray.Length; i++)
                    {
                        if (tilesArray[i].HitboxFlag)
                        {
                            if (tilesArray[i].Rect.IntersectsWith(Rectangle.Round(futureCharacter)))
                            {
                                futureCollidedTileIndex.Add(i);
                            }
                        }
                    }
                    #endregion

                    #region Detect in which direction the collision will occure and calculating the borders
                    // player position in tiles
                    Point playerTile = new Point(Convert.ToInt32(Math.Round(character.X / 32)), Convert.ToInt32(Math.Round(character.Y / 32)));
                    // vars for saving the "border" where the player has to hit
                    float heightBorder = -1;
                    float widthBorder  = -1;

                    foreach (int i in futureCollidedTileIndex)
                    {
                        // detecting in which direction the future hitted tile is
                        Point p = Point.Subtract(new Point(Convert.ToInt32(tilesArray[i].Rect.X / 32), Convert.ToInt32(tilesArray[i].Rect.Y / 32)), (Size)playerTile);

                        if (p.X == -1 || p.X == 0 || p.X == 1)                                   //If the tile is above or under the player
                        {
                            if (p.Y == 2)                                                        //under the player
                            {
                                heightBorder = tilesArray[i].Rect.Y;                             //set the height border at the top edge of the tile
                            }
                            else if (p.Y == -1)                                                  // above the player
                            {
                                heightBorder = tilesArray[i].Rect.Y + tilesArray[i].Rect.Height; //set the height border at the bottom edge of the tile
                            }
                        }

                        if (p.Y == 0 || p.Y == 1)                                              //If the tile is left or right
                        {
                            if (p.X == 1)                                                      //right of the player
                            {
                                widthBorder = tilesArray[i].Rect.X;                            // set the left edge as width border
                            }
                            else if (p.X == -1)                                                //left of the player
                            {
                                widthBorder = tilesArray[i].Rect.X + tilesArray[i].Rect.Width; //set the right edge as width border
                            }
                        }
                    }
                    #endregion

                    #region Apply the borders to the velocity of the player
                    if (futureCollidedTileIndex.Count > 0)
                    {
                        if (velocity.Height > 0 && heightBorder != -1)                         //Meaning falling
                        {
                            //Oberkante der kachel muss betrachtet werden
                            if (heightBorder < (character.Y + character.Height))
                            {
                                character.Y = character.Y - ((character.Y + character.Height) - heightBorder);
                            }
                            velocity.Height = heightBorder - (character.Y + character.Height);
                        }
                        else if (velocity.Height < 0 && heightBorder != -1)                         //Meaning jumping
                        {
                            //Unterkante der kachel muss betrachtet werden
                            velocity.Height = heightBorder - character.Y;
                        }

                        if (velocity.Width > 0 && widthBorder != -1)                         //Meaning movement to the right
                        {
                            //linke seite der kachel muss betrachtet werden
                            velocity.Width = widthBorder - (character.X + character.Width);
                        }
                        else if (velocity.Width < 0 && widthBorder != -1)                         //Meaning movement to the left
                        {
                            //rechte seite der Kachel muss betrachtet werden
                            velocity.Width = widthBorder - character.X;
                        }
                    }
                    #endregion
                }
                character.Location      += velocity;
                chars[j].Velocity        = velocity;
                verticalVelocityLastTick = velocity.Height;
                chars[j].RectF           = character;
            }

            #region Animation
            // Count the times where the character is moving left or right in a frame
            if (chars[0].IsMovingLR)
            {
                horizontalMovementFrameCounter++;
            }
            // When it reaches its maximum, play the next frame of the animation
            // Maximum is defined as the animationSpeed
            if (horizontalMovementFrameCounter == animationSpeed)
            {
                horizontalMovementFrameCounter = 0;
                chars[0].NextFrame();
            }
            #endregion

            Invalidate();
        }
Beispiel #8
0
 public bool CheckWindowWithinClient(ExtremeDragWindow window)
 {
     return(ClientRectangle.IntersectsWith(window.Bounds));
 }
        protected override void OnPaint(PaintEventArgs e)
        {
            // Just work like an empty control if image file not set
            if (null == MyDFImageFile)
            {
                base.OnPaint(e);
                return;
            }

            // Redraw items
            for (int i = 0; i < MyLayout.Length; i++)
            {
                // Get containing rects
                Rectangle OuterRect = MyLayout[i].OuterBounds;
                Rectangle InnerRect = MyLayout[i].InnerBounds;

                // Adjust scrolling
                OuterRect.Offset(0, -VerticalScroll.Value);
                InnerRect.Offset(0, -VerticalScroll.Value);

                // Skip if rect not visible
                if (!ClientRectangle.IntersectsWith(OuterRect))
                {
                    MyLayout[i].IsVisible = false;
                    continue;
                }
                else
                {
                    MyLayout[i].IsVisible = true;
                }

                // Draw bitmap cel
                if (i == MyMouseOverIndex && i != MySelectedIndex)
                {
                    Brush brush = new LinearGradientBrush(OuterRect, Color.AliceBlue, Color.LightBlue, LinearGradientMode.Vertical);
                    Manina.Windows.Forms.Utility.FillRoundedRectangle(e.Graphics, brush, OuterRect, 4);
                    if (ShowImageBordersValue)
                    {
                        Manina.Windows.Forms.Utility.DrawRoundedRectangle(e.Graphics, new Pen(Color.DarkBlue), OuterRect.Left, OuterRect.Top, OuterRect.Width, OuterRect.Height, 4);
                    }
                }
                else if (i == MyMouseOverIndex && i == MySelectedIndex)
                {
                    Brush brush = new LinearGradientBrush(OuterRect, Color.LightBlue, Color.DarkCyan, LinearGradientMode.Vertical);
                    Manina.Windows.Forms.Utility.FillRoundedRectangle(e.Graphics, brush, OuterRect, 4);
                    if (ShowImageBordersValue)
                    {
                        Manina.Windows.Forms.Utility.DrawRoundedRectangle(e.Graphics, new Pen(Color.Blue), OuterRect.Left, OuterRect.Top, OuterRect.Width, OuterRect.Height, 4);
                    }
                }
                else if (i == MySelectedIndex)
                {
                    if (this.Focused)
                    {
                        Brush brush = new LinearGradientBrush(OuterRect, Color.LightBlue, Color.DarkCyan, LinearGradientMode.Vertical);
                        Manina.Windows.Forms.Utility.FillRoundedRectangle(e.Graphics, brush, OuterRect, 4);
                        if (ShowImageBordersValue)
                        {
                            Manina.Windows.Forms.Utility.DrawRoundedRectangle(e.Graphics, new Pen(Color.Black), OuterRect.Left, OuterRect.Top, OuterRect.Width, OuterRect.Height, 4);
                        }
                    }
                    else
                    {
                        Brush brush = new LinearGradientBrush(OuterRect, Color.LightGray, Color.DarkSlateGray, LinearGradientMode.Vertical);
                        Manina.Windows.Forms.Utility.FillRoundedRectangle(e.Graphics, brush, OuterRect, 4);
                        if (ShowImageBordersValue)
                        {
                            Manina.Windows.Forms.Utility.DrawRoundedRectangle(e.Graphics, new Pen(Color.Black), OuterRect.Left, OuterRect.Top, OuterRect.Width, OuterRect.Height, 4);
                        }
                    }
                }
                else
                {
                    if (ShowImageBordersValue)
                    {
                        Manina.Windows.Forms.Utility.DrawRoundedRectangle(e.Graphics, new Pen(Color.FromArgb(90, 90, 120)), OuterRect.Left, OuterRect.Top, OuterRect.Width, OuterRect.Height, 4);
                    }
                }

                // Get current frame
                int CurrentFrame = 0;
                if (MyLayout[i].IsAnimated)
                {
                    CurrentFrame = MyLayout[i].CurrentFrame;
                }

                // Draw current frame
                Rectangle SrcRect = new Rectangle(0, 0, MyLayout[i].ManagedBitmaps[CurrentFrame].Width, MyLayout[i].ManagedBitmaps[CurrentFrame].Height);
                e.Graphics.DrawImage(MyLayout[i].ManagedBitmaps[CurrentFrame], InnerRect, SrcRect, GraphicsUnit.Pixel);
            }
        }
Beispiel #10
0
        private void PaintItem(Graphics aGraphics, int aWidth, int aHeight, int aOffsetX, int aOffsetY, Uri aArtworkUri, string aTitle, string aAlbum, string aArtist, string aGenre, bool aCurrent)
        {
            int height = aHeight;
            int width  = height;

            int offsetY = aOffsetY;
            int offsetX = aOffsetX;

            Rectangle itemRect = new Rectangle(offsetX, ClientRectangle.Y, kItemWidth, ClientSize.Height);

            if (ClientRectangle.IntersectsWith(itemRect))
            {
                bool  drawTime   = false;
                Color fontColour = iViewSupport.ForeColour;
                if (aCurrent)
                {
                    fontColour = iViewSupport.ForeColourBright;
                    drawTime   = (iTransportState == ETransportState.ePlaying || iTransportState == ETransportState.ePaused);
                }

                Uri uri = aArtworkUri;

                IArtwork artwork = null;
                Image    image   = kImageNoArtwork;
                if (uri != null)
                {
                    artwork = iArtworkCache.Artwork(uri);

                    if (artwork.Image != null)
                    {
                        image = artwork.Image;
                    }
                }

                width = (int)(image.Width * (height / (float)image.Height));
                int offset = (int)((height - width) * 0.5f) + 20;
                aGraphics.DrawImage(image, offsetX + offset, offsetY, width, height);

                image = null;
                if (artwork != null)
                {
                    image = artwork.ImageReflected;
                }
                if (image == null)
                {
                    image = kImageReflectedNoArtwork;
                }
                int reflectionHeight = (int)(image.Height * (width / (float)image.Width));
                aGraphics.DrawImage(image, offsetX + offset, offsetY + height, width, reflectionHeight);

                TextFormatFlags flags = TextFormatFlags.Left | TextFormatFlags.EndEllipsis;
                int             x     = offsetX + height + 30;
                int             y     = offsetY;
                width = Width - (height + 30);
                Size size = TextRenderer.MeasureText(aGraphics, aTitle, iLargeFont);
                TextRenderer.DrawText(aGraphics, aTitle, iLargeFont, new Rectangle(x, y, width, size.Height), fontColour, flags);
                y += (int)(size.Height + (height * 0.1f));

                if (aArtist.Length > 0)
                {
                    size = TextRenderer.MeasureText(aGraphics, aArtist, iMediumFont);
                    TextRenderer.DrawText(aGraphics, aArtist, iMediumFont, new Rectangle(x, y, width, size.Height), fontColour, flags);
                    y += size.Height;
                }

                if (aAlbum.Length > 0)
                {
                    size = TextRenderer.MeasureText(aGraphics, aAlbum, iSmallFont);
                    TextRenderer.DrawText(aGraphics, aAlbum, iSmallFont, new Rectangle(x, y, width, size.Height), fontColour, flags);
                    y += size.Height;
                }

                if (aGenre.Length > 0)
                {
                    size = TextRenderer.MeasureText(aGraphics, aGenre, iSmallFont);
                    TextRenderer.DrawText(aGraphics, aGenre, iSmallFont, new Rectangle(x, y, width, size.Height), fontColour, flags);
                    y += size.Height;
                }

                y = height + offsetY - iSmallFont.Height;
                //int yOffset = (int)(Height * 0.12f);

                /*using (Pen p = new Pen(iViewSupport.ForeColourBright))
                 * {
                 *  //Rectangle rect = new Rectangle(x, y, width - 30, size.Height);
                 *  //e.Graphics.DrawRectangle(p, rect);
                 *  int startOffset = (i == 0) ? 20 : 0;
                 *  int endOffset = (i == (iPlaylist.Count - 1)) ? 20 : 0;
                 *  if (i == 0)
                 *  {
                 *      e.Graphics.DrawLine(p, new Point(startOffset + offsetX, ClientSize.Height - iSmallFont.Height - yOffset), new Point(startOffset + offsetX, ClientSize.Height - yOffset));
                 *  }
                 *  if (i == (iPlaylist.Count - 1))
                 *  {
                 *      e.Graphics.DrawLine(p, new Point(ClientSize.Width - endOffset + offsetX, ClientSize.Height - iSmallFont.Height - yOffset), new Point(ClientSize.Width - endOffset + offsetX, ClientSize.Height - yOffset));
                 *  }
                 *  e.Graphics.DrawLine(p, new Point(startOffset + offsetX, ClientSize.Height - iSmallFont.Height - yOffset), new Point(offsetX + ClientSize.Width - endOffset, ClientSize.Height - iSmallFont.Height - yOffset));
                 *  e.Graphics.DrawLine(p, new Point(startOffset + offsetX, ClientSize.Height - yOffset), new Point(offsetX + ClientSize.Width - endOffset, ClientSize.Height - yOffset));
                 * }*/
                /*using (Brush b = new SolidBrush(iViewSupport.HighlightBackColour))
                 * {
                 *  int startOffset = (i == 0) ? 21 : 0;
                 *  int endOffset = (i == (iPlaylist.Count - 1)) ? 21 : 0;
                 *  if (i < iIndex)
                 *  {
                 *      Rectangle rect = new Rectangle(startOffset + offsetX, ClientSize.Height - iSmallFont.Height - (yOffset - 1), ClientSize.Width - startOffset, iSmallFont.Height - 1);
                 *      e.Graphics.FillRectangle(b, rect);
                 *  }
                 *  else if (drawTime && iDuration > 0)
                 *  {
                 *      Rectangle rect = new Rectangle(startOffset + offsetX, ClientSize.Height - iSmallFont.Height - yOffset + 1, (int)((ClientSize.Width - startOffset - endOffset) * (iSeconds / (float)iDuration)), iSmallFont.Height - 1);
                 *      e.Graphics.FillRectangle(b, rect);
                 *  }
                 * }*/

                if (aCurrent)
                {
                    Time time     = new Time((int)iSeconds);
                    Time duration = new Time((int)iDuration);

                    string t = (drawTime ? time.ToPrettyString() : "");
                    if (duration.SecondsTotal > 0)
                    {
                        t += (drawTime ? " / " : "") + duration.ToPrettyString();
                    }

                    Size tSize = TextRenderer.MeasureText(aGraphics, t, iMicroFont);
                    TextRenderer.DrawText(aGraphics, t, iMicroFont, new Rectangle(x, y - iMicroFont.Height, tSize.Width, tSize.Height), fontColour, TextFormatFlags.Default);

                    /*size = TextRenderer.MeasureText(e.Graphics, duration.ToPrettyString(), iMicroFont);
                     * TextRenderer.DrawText(e.Graphics, duration.ToPrettyString(), iMicroFont, new Rectangle(x + width - 30 - size.Width, y - size.Height, size.Width, size.Height), fontColour, TextFormatFlags.Right);*/

                    if (iCodec != string.Empty)
                    {
                        string info     = iBitrate.ToString() + " kbps, " + iSampleRate.ToString() + " kHz" + (iLossless ? " / " + iBitDepth.ToString() + " bits, " : ", ") + iCodec;
                        Size   infoSize = TextRenderer.MeasureText(aGraphics, info, iMicroFont);
                        TextRenderer.DrawText(aGraphics, info, iMicroFont, new Rectangle(x, y - iMicroFont.Height - iMicroFont.Height, infoSize.Width, infoSize.Height), fontColour, TextFormatFlags.Default);
                    }
                }
            }
        }