BrightIdeasSoftware.DescribedTaskRenderer.DrawDescribedTask C# (CSharp) Метод

DrawDescribedTask() защищенный Метод

Draw the task
protected DrawDescribedTask ( Graphics g, Rectangle r, string title, string description, Image image ) : void
g System.Drawing.Graphics
r System.Drawing.Rectangle
title string
description string
image Image
Результат void
        protected virtual void DrawDescribedTask(Graphics g, Rectangle r, string title, string description, Image image)
        {
            Rectangle cellBounds = this.ApplyCellPadding(r);
            Rectangle textBounds = cellBounds;

            if (image != null) {
                g.DrawImage(image, cellBounds.Location);
                int gapToText = image.Width + this.ImageTextSpace;
                textBounds.X += gapToText;
                textBounds.Width -= gapToText;
            }

            // Color the background if the row is selected and we're not using a translucent selection
            if (this.IsItemSelected && !this.ListView.UseTranslucentSelection) {
                using (SolidBrush b = new SolidBrush(this.GetTextBackgroundColor())) {
                    g.FillRectangle(b, textBounds);
                }
            }

            // Draw the title
            if (!String.IsNullOrEmpty(title)) {
                using (StringFormat fmt = new StringFormat(StringFormatFlags.NoWrap)) {
                    fmt.Trimming = StringTrimming.EllipsisCharacter;
                    fmt.Alignment = StringAlignment.Near;
                    fmt.LineAlignment = StringAlignment.Near;
                    Font f = this.TitleFontOrDefault;
                    using (SolidBrush b = new SolidBrush(this.TitleColorOrDefault)) {
                        g.DrawString(title, f, b, textBounds, fmt);
                    }

                    // How tall was the title?
                    SizeF size = g.MeasureString(title, f, (int)textBounds.Width, fmt);
                    textBounds.Y += (int)size.Height;
                    textBounds.Height -= (int)size.Height;
                }
            }

            // Draw the description
            if (!String.IsNullOrEmpty(description)) {
                using (StringFormat fmt2 = new StringFormat()) {
                    fmt2.Trimming = StringTrimming.EllipsisCharacter;
                    using (SolidBrush b = new SolidBrush(this.DescriptionColorOrDefault)) {
                        g.DrawString(description, this.DescriptionFontOrDefault, b, textBounds, fmt2);
                    }
                }
            }
        }