Solved

Drawing a border gives problems with resizing the form.

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

705 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

18 Experts available now in Live!

Get 1:1 Help Now