Click here to Skip to main content
15,904,346 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I use the code below:
VB
Protected Function OMID_GetPath() As GraphicsPath

       Dim w As Integer = Me.Width
       Dim h As Integer = Me.Height


       Dim path As GraphicsPath = New GraphicsPath()

       path.AddArc(0, 0, 2 * w, 2 * h, 180, 90)
       path.AddLine(w, 0, w, h)

       path.CloseFigure()
       Return path

   End Function


and:

VB
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint

       Dim bb As GraphicsPath = OMID_GetPath()

       e.Graphics.SmoothingMode = SmoothingMode.HighQuality

       e.Graphics.FillPath(Brushes.Black, bb)
   End Sub


and this:

VB
Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
    Me.Refresh()
End Sub



I have drawn a curve But when I change the window size Graphics will be page by page.


What can I do to solve this problem?
Posted
Comments
Sergey Alexandrovich Kryukov 29-Nov-11 14:22pm    
No, it won't! Because the question is not clear. :-) What's "page by page"? Please use "Improve question".
--SA
[no name] 29-Nov-11 14:22pm    
What do you mean "page by page"?
sara.solati68 29-Nov-11 14:38pm    
Maybe I can not I use the word correctly.

But if you change the window size.
You will notice the problem.

1 solution

I can guess the paint problems you are experiencing. Here's what happens when you resize a window.

Before your Paint event is called the drawable region is clipped and you can only paint on the extra window size you get after resizing.
You can check the allowable area in
e.ClipRectangle
It's more efficient that way and reduces flickering.

You cannot ignore or change the ClipRectangle. If you still want to redraw the entire form, Invalidate the window on the ResizeEnd event. It'll call the paint function with the entire region updatable

VB
Private Sub Form1_ResizeEnd(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.ResizeEnd
    Invalidate()
End Sub


You can call Me.Invalidate() whenever you want to repaint your window

Edit: Removed a dead link
 
Share this answer
 
v3
Comments
sara.solati68 1-Dec-11 15:39pm    
Thank you.
Helped.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900