Solved

Drawing a border gives problems with resizing the form.

Posted on 2011-09-24
2
178 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

930 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now