开发者

Windows form OnPaint, white backgorund with red cross

开发者 https://www.devze.com 2023-03-16 09:51 出处:网络
How i can draw big graphics on form ? I generate graphic 开发者_C百科map on function MyForm_Paint()

How i can draw big graphics on form ? I generate graphic 开发者_C百科map on function MyForm_Paint()

But if its take a long time, graphic don't render, just white background with red cross


If you want to draw directly on the form, there are many tutorials and examples:

  • Code: Drawing Graphics on a Windows Form (Visual C#)
  • Techtopia: Drawing Graphics in C Sharp
  • Graphics in Visual C# .NET
  • Codeguru: Getting Graphics to stay on a Form (C#)

If you are just trying to set a form to use a particular image, you might consider placing a PictureBox and setting its .Image property to that of your generated graphic:

pictureBox1.Image = myBitmap;

There is also the form's .BackgroundImage property:

form1.BackgroundImage = myBitmap;

The white background with red cross means that the requested resource is unavailable or not in a recognized format.

Do you need to generate a new graphic every time the form is redrawn? If so, then the Paint event is fine, but that may be why things are taking a long time; i.e. lots of redraws whenever the form is invalidated. If the map doesn't need to change then one of the above suggestions would probably be better.

If redrawing the graphic is the intention, then it would be necessary to discuss how you are generating the graphic in order to diagnose the problem. Because of the red "X" problem you are having, it's possible the graphic is not in the correct format, so it may help to post some of that code for further assistance.

0

精彩评论

暂无评论...
验证码 换一张
取 消