471,310 Members | 1,214 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,310 software developers and data experts.

Draw control doesn't redraw on SplitPanel

hi @all,

I have a simple draw control which uses the OnPaint event:

protected override void OnPaint(PaintEventArgs pe)
{
base.OnPaint(pe);
CalculatePaint();
DrawCanvas(pe.Graphics);
if (ShowGrid)
DrawGrid(pe.Graphics);
DrawDocument(pe.Graphics);
DrawLabels(pe.Graphics);
}

It redraws fine, when I resize the window. But when it's placed on a
SplitPanel and I change the size with the splitter, the control is
almost never redrawn.

What have I missed here?

Do I need to Invalidate() my control in a resize event?
btw, CalculatePaint() does the calculation of the client rectangle,
basically this own:

_ClientRect = new RectangleF(
Padding.Left,
Padding.Top,
Width - Padding.Left - Padding.Right - 1,
Height - Padding.Top - Padding.Bottom - 1);
mfG
--stefan <--
Sep 10 '08 #1
1 1539
On Wed, 10 Sep 2008 09:32:37 -0700, Stefan Hoffmann
<st*************@explido.dewrote:
[...]
Do I need to Invalidate() my control in a resize event?
If the visual aspects of your control depend on its size, yes. You do.

Pete
Sep 10 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by David | last post: by
1 post views Thread by Tim Haughton | last post: by
4 posts views Thread by Mathieu Chavoutier | last post: by
4 posts views Thread by --== Alain ==-- | last post: by
10 posts views Thread by Phil | last post: by
1 post views Thread by Sin Jeong-hun | last post: by
3 posts views Thread by Brandon Arnold | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.