alemargo Posted January 3, 2004 Posted January 3, 2004 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. Quote
Hamburger1984 Posted January 5, 2004 Posted January 5, 2004 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 Quote
alemargo Posted January 5, 2004 Author Posted January 5, 2004 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. Quote
LDV Posted January 5, 2004 Posted January 5, 2004 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 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.