Click here to Skip to main content
15,897,273 members

Drawing Graphics on a Windows Form Problems

Daniel Verbatim Hallam asked:

Open original thread
I have 2 graphics I draw onto a form.

1 Graphic is a Randomly Generated Star Field, these stars move, and are updated every tick on a timer(50ms)

Once the stars have been drawn/updated a cockpit is overlayed onto this image to give the appearance of moving through space.

The problem I am having is that the stars are drawn onto the cockpit of the previous iteration of the loop giving the allusion that the stars are in the ship.

I have not a clue how to solve this and would love any advice. I have tried making it redraw the cockpit after it updates each star, this just makes updating the stars take too long.

One option is to kill each star once it reaches the edge of the cockpit's "window" I fear though that this would cause an equal problem with delay as it would have to check many conditons as the cockpit window is not even in shape.

A friend has suggested double buffering - I have only ever came across this as an option in VS to Enable or Disable.

Any help would be appreciated, especially in regards to if Double Buffering is the way to go.

I can provide the code if need be it is just obnoxiously long and makes the post look quite messy.

Thank you in advance.
Tags: Visual Basic, Graphics

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



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