Solved

Drawing a border gives problems with resizing the form.

Posted on 2011-09-24
2
181 Views
Last Modified: 2013-12-17
Dear Expers,

I have this OnPaint-methode to draw a border around
my borderless form:

        private void StickyNotes_Paint(object sender, PaintEventArgs e)
         {
            using (Pen pen = new Pen(Brushes.Silver, 2))
            {
                e.Graphics.DrawRectangle(pen, this.ClientRectangle);
            }
         }

And it works awsome.
In picture2 you see what happens when I resize my form!

What can I do about this? Who knows the answer and
is willing to help me?

Greetings,

Peter Kiers
Picture1.jpg
Picture2.jpg
0
Comment
Question by:peterkiers
2 Comments
 
LVL 44

Accepted Solution

by:
AndyAinscow earned 500 total points
ID: 36591902
For some reason the whole form is not being flagged for repainting.
You could use a this.Invalidate() in the OnResize event.  (NOT in the OnPaint otherwise it will be stuck in a loop)
0
 
LVL 1

Author Comment

by:peterkiers
ID: 36591910
Thanks.

Peter Kiers
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question