e3 Rental Property Website

Welcome Guest (Register -  Login)  Active Topics Active Topics Display List of Forum Members Memberlist Search The Forum Search Help Help
 Navigation

 Latest Forum Posts
» Need Bantumi VB Codes
Last Reply By acha22
» School Project -> VB Game
Last Reply By ruger
» Game Idea
Last Reply By ruger
» Careers in Gaming
Last Reply By tarun321
» vb2008 dx9 triangle
Last Reply By bluatigro
» GDI+ Flickering Problem
Last Reply By blupig
» VB2010
Last Reply By blupig
» modding xbox360 games project
Last Reply By blupig
» how to ? vb6 lesson
Last Reply By bluatigro
» Firing Bullet at an angle
Last Reply By bluatigro
» shading in vb2008
Last Reply By bluatigro
» Game-ready model shops
Last Reply By Tinlau
» pa help game of the generals..... 
Last Reply By peejay
» dart game
Last Reply By yik17
» Heeelp me someone
Last Reply By Miranu

Game Programming
 Vb games Game Programming
Subject Topic: GDI+ Flickering Problem Post ReplyPost New Topic
 GDI+ Flickering Problem
<< Prev Topic | Next Topic >>
mouse88
Posted: July 22 2009 at 1:58pm | IP Logged Quote mouse88
Avatar
Newbie
Newbie


Group: Newbie
Joined: July 22 2009
Location: United Kingdom
Posts: 1
I am having problems with flickering when drawing squares
to a picture box. Heres my main form code:

Code:
Public Class FrmGame

    Public ArrayBlocks(15, 30) As Block
    Public BlockSize As New Size(15, 15)

    Private Sub FrmGame_Load(ByVal sender As Object,
ByVal e As System.EventArgs) Handles Me.Load

        'Reduce Flicker'
        SetStyle(ControlStyles.DoubleBuffer, True)
        SetStyle(ControlStyles.AllPaintingInWmPaint,
True)

    End Sub

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

        'Draw Game Board To Picture Box'
        Dim GameBoard As New GameBoard
        GameBoard.Draw(ImgMain.Handle)


        'Draw First Line Of Blocks To Picture Box'
        Dim X As Integer
        Dim Color1 As Color = Color.Blue
        Dim Color2 As Color = Color.LightBlue
        Dim InitialLoc As New Point(0, 0)

        For X = 0 To 14

            ArrayBlocks(X, 0) = New Block(BlockSize,
InitialLoc, Color1, Color2)
            ArrayBlocks(X, 0).Draw(ImgMain.Handle)

            'Update Initial Location'
            InitialLoc.X += 15

            'Change Block Colors'
            If Color1 = Color.Blue And Color2 =
Color.LightBlue Then

               Color1 = Color.Red
               Color2 = Color.Yellow

            Else

               Color1 = Color.Blue
               Color2 = Color.LightBlue

            End If

        Next X

        Me.Invalidate()

    End Sub

End Class

The Rectangle which is my game board is drawn as per
normal no flickering, however when the 15 blocks/squares
are drawn they are all flickering for some reason. I may
be doing something wrong as until now i've been creating
basic games with picture boxes. If anyone has any advice
i would appreciate it greatly.
 
Online Status: Offline
View mouse88's Profile Search for other posts by mouse88 Back to Top
 
creek23
Posted: August 22 2009 at 12:52pm | IP Logged Quote creek23
Avatar
KonsolScript Master
Senior Member


Group: Senior Member
Joined: December 23 2005
Location: Philippines
Posts: 173
Make sure that the form AutoRedraws.

__________________
Visit my scriptable 2D game engine at http://www.konsolscript.org
 
Online Status: Offline
View creek23's Profile Search for other posts by creek23 Back to Top
 
blupig
Posted: January 02 2010 at 1:49pm | IP Logged Quote blupig

Newbie
Newbie


Group: Newbie
Joined: January 02 2010
Posts: 3
Use a backbuffer.
 
Online Status: Offline
View blupig's Profile Search for other posts by blupig Back to Top
 
1 User(s) are browsing this topic, 1 Guest(s) and 0 Member(s)
0 Members:
<< Prev Topic Game Programming Next Topic >>

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You can vote in polls in this forum


[ Users browsing page: none ]

Terms and Conditions | Privacy | Contact Us

Copyright © 2010 VbGames. All rights reserved.

This site is best viewed at 1024x768 screen resolution.
Back to Top

Designed by Micronet Technologies