Rendering issue

Issue #18 invalid
_Andre_ created an issue

With following code I have a rendering issue while using the splitter. While moving the splitter, the drawing of my RectangleFigure looks not correct.

import dgui.all;
import dgui.layout.splitpanel;

class RectangleFigure : PictureBox
{             
    private int borderWidth_ = 1;
    private Color borderColor_ = SystemColors.black;
    private Color fillColor_ = SystemColors.white;

    protected override void onPaint(PaintEventArgs e)
    {
       Canvas c = e.canvas;
       c.drawRectangle(new Pen(borderColor_, borderWidth_),
                       new SolidBrush(fillColor_),
                       Rect(nullPoint, this.size));
       c.drawText(text, Rect(Point(2,2), this.size));    
       super.onPaint(e);
    }                             
}

class MainForm: Form
{
    private SplitPanel _spVPanel;

    public this()
    {
        this.text = "DGui SplitPanel Example";
        this.size = Size(500, 500);
        this.startPosition = FormStartPosition.centerScreen;

        auto rct = new RectangleFigure();
        rct.text = "123";
        rct.dock = DockStyle.fill;

        this._spVPanel = new SplitPanel();
        this._spVPanel.dock = DockStyle.fill;
        this._spVPanel.splitPosition = 200;
        this._spVPanel.splitOrientation = SplitOrientation.vertical;
        this._spVPanel.parent = this;

        rct.parent = _spVPanel.panel2;
    }
}

int main(string[] args)
{
    return Application.run(new MainForm());
}

Comments (2)

  1. Denis Shelomovskii

    By default, when control size increased only newly occupied space is repainted, and no painting occurs when control size is decreased. You have to invalidate the control on resize if it doesn't logically satisfy this behaviour:

    rct.resize.attach((s, e) => rct.invalidate());
    
  2. Log in to comment