图形将逐页! [英] Graphics will be page by page!!!

查看:79
本文介绍了图形将逐页!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用以下代码:

I use the code below:

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:

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:

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?

推荐答案

我可以猜到你遇到的油漆问题iencing。这是调整窗口大小时会发生的事情。



在调用Paint事件之前,可裁剪区域被裁剪,您只能在调整大小后获得额外的窗口大小。

你可以查看允许的区域

e.ClipRectangle

它的效率更高,减少了闪烁。



您无法忽略或更改ClipRectangle。如果您仍想重绘整个表单,请在ResizeEnd事件上使窗口无效。它将调用paint函数,整个区域可更新



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

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





每当你想要重新绘制你的窗口时,你可以调用Me.Invalidate()



编辑:删除一个死链接



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

Removed a dead link


这篇关于图形将逐页!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆