Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

The form flickers upon loading.

I do the following to prevent it, but that does not help at all.

 

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

e.Graphics.DrawImage(background, New Point(0, 0))

End Sub

 

I do set

SetStyle(ControlStyles.DoubleBuffer Or ControlStyles.UserPaint, True) in form Load event.

 

 

If anyone has any suggestions, please advise.

Posted
I do set

SetStyle(ControlStyles.DoubleBuffer Or ControlStyles.UserPaint, True) in form Load event.

 

you missed one important part in that Statement:

 

SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.DoubleBuffer Or ControlStyles.UserPaint, True)

 

if you don't set this style the system first redraws the background of the Form (the short gray flickering) and afterwards draws your custom drawing....

 

Andreas

Posted

Re: Re: Drawing image in for Paint

 

you missed one important part in that Statement:

 

SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.DoubleBuffer Or ControlStyles.UserPaint, True)

 

if you don't set this style the system first redraws the background of the Form (the short gray flickering) and afterwards draws your custom drawing....

 

Andreas

 

 

Thanks for responding. The ControlStyles.AllPaintingInWmPaint causes some inconvenience. I have a bitmap image that I draw on the form as a background. I have transparency key set to make everything around that image transparent. When I use ControlStyles.AllPaintingInWmPaint, transparency does not work for some reason. I am using 32-bit color quality.

Posted

I don't know if it will help you,

but you can try overriding the WM_PAINT message:

 

C#:

protected override void WndProc(ref Message m)

{

switch(m.Msg)

{

case WM_PAINT:

//base.WndProc(ref m);

break;

default:

base.WndProc(ref m);

break;

}

}

 

LDV

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...