Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 137071
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T07:02:54+00:00 2026-05-11T07:02:54+00:00

I’ve created a simple solution with 2 projects. The 1st project (class library) contains

  • 0

I’ve created a simple solution with 2 projects. The 1st project (class library) contains a custom control called Container which draws itself with rounded corners. The 2nd project (windows forms) is a test application.

If I add a Container instance to main Form in the 2nd project it shows the rounded corners nicely. Also when I run the 2nd project I can see the Container.

However when I start moving the form (click and hold the title bar), especially when I move it very fast, all the drawing is messed up, drawn over and over again but not clearing it’s surface first…

I can call Container1.Refresh() in the Form1.Move event, but I don’t want to set this every time because this also means I have to call Container1.Refresh() in the Form1.Resize event and who knows which other event…

Is there an event in the Container (control) class itself where I should call Me.Refresh() or Me.Update() or Me.Invalidate() ?

For reference (Form1.vb)

Public Class Form1  Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load  End Sub  Private Sub Form1_Move(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Move     Me.Container1.Refresh() End Sub End Class 

for reference (Container.vb):

Imports System.Windows.Forms Imports System.Drawing Imports System.Drawing.Drawing2D  Public Class Container : Inherits Control     Private _Gp As GraphicsPath      Private Sub Container_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint          Dim r As Rectangle = e.ClipRectangle         Dim gp As New GraphicsPath         Dim cs As Integer = 25 'CornerSize'          r.Inflate(-5, -5)          gp.AddArc(r.X, r.Y, cs, cs, 180, 90)         gp.AddArc(r.X + r.Width - cs, r.Y, cs, cs, 270, 90)         gp.AddArc(r.X + r.Width - cs, r.Y + r.Height - cs, cs, cs, 0, 90)         gp.AddArc(r.X, r.Y + r.Height - cs, cs, cs, 90, 90)          Dim t As Single = cs / 2 + r.Y         gp.AddLine(r.X, r.Y + r.Height - cs, r.X, t)          e.Graphics.SmoothingMode = Drawing.Drawing2D.SmoothingMode.AntiAlias         e.Graphics.DrawPath(Pens.Black, gp)     End Sub  End Class 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T07:02:55+00:00Added an answer on May 11, 2026 at 7:02 am

    This is your problem:

    Dim r As Rectangle = e.ClipRectangle 

    Change it to:

    Dim r As Rectangle = Me.ClientRectangle 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 137k
  • Answers 137k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You need to call the win32 API function SetConsoleCtrlHandler with… May 12, 2026 at 7:21 am
  • Editorial Team
    Editorial Team added an answer typedef std::list<std::string> MyList; MyList myList = getMyList(); MyList::const_iterator i =… May 12, 2026 at 7:21 am
  • Editorial Team
    Editorial Team added an answer I can't think of any technical reason to stick with… May 12, 2026 at 7:21 am

Related Questions

I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I am currently running into a problem where an element is coming back from
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.