Esempio n. 1
0
    /// <summary>
    /// Paints the selected node in the control.
    /// </summary>
    /// <param name="e"></param>
    protected override void OnPaintContent(DropDownPaintEventArgs e)
    {
        base.OnPaintContent(e);

        Image  img  = GetNodeImage(_selectedNode);
        string text = _nullValue;

        if (_showCheckBoxes)
        {
            text = GetCheckedNodeString();
        }
        else if (_selectedNode != null)
        {
            text = (_showPath) ? Path : _selectedNode.Text;
        }

        Rectangle imgBounds = (img == null) ? new Rectangle(1, 0, 0, 0) : new Rectangle(4, e.Bounds.Height / 2 - img.Height / 2, img.Width, img.Height);
        Rectangle txtBounds = new Rectangle(imgBounds.Right, 0, e.Bounds.Width - imgBounds.Right - 3, e.Bounds.Height);

        if (img != null)
        {
            e.Graphics.DrawImage(img, imgBounds);
        }

        TextRenderer.DrawText(e.Graphics, text, Font, txtBounds, Enabled ? ForeColor : SystemColors.GrayText, TEXT_FORMAT_FLAGS);

        // focus rectangle
        if (Focused && ShowFocusCues && !DroppedDown)
        {
            e.DrawFocusRectangle();
        }
    }
 /// <summary>
 /// Paints the content in the editable portion of the control, providing additional measurements and operations.
 /// </summary>
 /// <param name="e"></param>
 protected virtual void OnPaintContent(DropDownPaintEventArgs e)
 {
     if (PaintContent != null)
     {
         PaintContent(this, e);
     }
 }
 /// <summary>
 /// Draws the text that has been entered into the control by the user.
 /// </summary>
 /// <param name="e"></param>
 protected override void OnPaintContent(DropDownPaintEventArgs e)
 {
     if (DroppedDown)
     {
         _services.DrawText(e.Graphics);
     }
     else
     {
         base.OnPaintContent(e);
     }
 }
Esempio n. 4
0
        protected override void OnPaintContent(DropDownPaintEventArgs e)
        {
            decimal sum = 0m;

            foreach (var node in this.CheckedNodes)
            {
                var pipe = node.Tag as Pipe;
                if (pipe != null)
                {
                    sum += pipe.Volume;
                }
            }
            Rectangle txtBounds = new Rectangle(1, 0, e.Bounds.Width - 4, e.Bounds.Height);

            TextRenderer.DrawText(e.Graphics, String.Format("{0} m³", sum), Font, txtBounds, ForeColor, TEXT_FORMAT_FLAGS);
            if (Focused && ShowFocusCues && !DroppedDown)
            {
                e.DrawFocusRectangle();
            }
        }
Esempio n. 5
0
    /// <summary>
    /// Paints the selected node in the control.
    /// </summary>
    /// <param name="e"></param>
    protected override void OnPaintContent(DropDownPaintEventArgs e)
    {
        base.OnPaintContent(e);

        Image  img  = GetNodeImage(selectedNode);
        string text = (selectedNode != null) ? ((showPath) ? Path : selectedNode.Text) : nullValue;

        Rectangle imgBounds = (img == null) ? new Rectangle(1, 0, 0, 0) : new Rectangle(4, e.Bounds.Height / 2 - img.Height / 2, img.Width, img.Height);
        Rectangle txtBounds = new Rectangle(imgBounds.Right, 0, e.Bounds.Width - imgBounds.Right - 3, e.Bounds.Height);

        if (img != null)
        {
            e.Graphics.DrawImage(img, imgBounds);
        }

        TextRenderer.DrawText(e.Graphics, text, Font, txtBounds, ForeColor, TEXT_FORMAT_FLAGS);

        // focus rectangle
        if (Focused && ShowFocusCues && !DroppedDown)
        {
            e.DrawFocusRectangle();
        }
    }
Esempio n. 6
0
 /// <summary>
 /// Paints the content in the editable portion of the control, providing additional measurements and operations.
 /// </summary>
 /// <param name="e"></param>
 protected virtual void OnPaintContent(DropDownPaintEventArgs e)
 {
     if (PaintContent != null) PaintContent(this, e);
 }
Esempio n. 7
0
    /// <summary>
    /// Paints the selected node in the control.
    /// </summary>
    /// <param name="e"></param>
    protected override void OnPaintContent(DropDownPaintEventArgs e)
    {
        base.OnPaintContent(e);

        Image img = GetNodeImage(_selectedNode);
        string text = _nullValue;
        if (_showCheckBoxes)
            text = GetCheckedNodeString();
        else if (_selectedNode != null)
            text = (_showPath) ? Path : _selectedNode.Text;

        Rectangle imgBounds = (img == null) ? new Rectangle(1,0,0,0) : new Rectangle(4, e.Bounds.Height / 2 - img.Height / 2, img.Width, img.Height);
        Rectangle txtBounds = new Rectangle(imgBounds.Right, 0, e.Bounds.Width - imgBounds.Right - 3, e.Bounds.Height);

        if (img != null) e.Graphics.DrawImage(img, imgBounds);

        TextRenderer.DrawText(e.Graphics, text, Font, txtBounds, ForeColor, TEXT_FORMAT_FLAGS);

        // focus rectangle
        if (Focused && ShowFocusCues && !DroppedDown) e.DrawFocusRectangle();
    }