• 0

[C#] Skinned form with black flicker while resizing!


Question

Hi,

I'm trying to create some skinned forms (just the border and caption) with a different approach than you usually see but I'm having some issues with form flickering while I re size the form.

I don't know how else to explain the problem, so here's a video I created of the problem:

http://www.screencast.com/t/AIqK9Szmz

Also, here's a VS2008 test solution with the whole code that repaints the form borders:

http://stuff.nazgulled.net/misc/TestForm.zip

Hope someone can help me getting rid of the flicker...

Edited by Nazgulled

12 answers to this question

Recommended Posts

  • 0

that should be the background color you selected for the form in VS. No worries it doesn't affect the program in any way. one of the form's colors are probably on black (i'm pretty sure it's background) so just change it to white or whatever you want. Was having problems myself with this in visual C# for a while. It's a .NET thing i guess =\

  • 0

That's not it... Cause if you take a look at the code you see that the background color is actually lime, the same goes for the transparency key (to make it transparent in case I use a non rectangular skin).

And how can you say it doesn't affect the program in any way? It is affecting the program, it makes it look wierd when people resize (or even move) the form, that's affecting the program in some way.

And that's what I want to solve... :/

  • 0

Are you double buffering?

Everything you see on your screen is being redrawn at around 60 times a second, well depending on your refresh rate. Now, without double buffering, it can be difficult to write to the display buffer before the output is updated. Double buffering allows you to paint to a buffer, which is swapped with the current display buffer in one go, reducing the chances of flickering, artefacts etc.

I've found a pretty good article Don't Ficker! Double Buffer! @ CodeProject which should help you with your problem.

  • 0
  Nazgulled said:
That's not it... Cause if you take a look at the code you see that the background color is actually lime, the same goes for the transparency key (to make it transparent in case I use a non rectangular skin).

Well if the transparency key is lime then your background isn't lime, it's the color of whatever is behind it. Given your description, I'm guessing the thing behind it is black.

  • 0
  Brandon Live said:
Well if the transparency key is lime then your background isn't lime, it's the color of whatever is behind it. Given your description, I'm guessing the thing behind it is black.

Uh? Look at the code...

I set the form background to Lime and I've also set the Transparency Key to Lime, this is the easiest way I know of to have a form transparent with irregular shapes.

Of course the background is not Lime, it's transparent, but that's just because the Transparency Key is the same color as the form background, otherwise the form background wouldn't be transparent...

  • 0
  Nazgulled said:
Uh? Look at the code...

I set the form background to Lime and I've also set the Transparency Key to Lime, this is the easiest way I know of to have a form transparent with irregular shapes.

Of course the background is not Lime, it's transparent, but that's just because the Transparency Key is the same color as the form background, otherwise the form background wouldn't be transparent...

Hi,

I just had a similar problem which was corrected by placing an Invalidate() in the OnSize message for the form.

Good luck,

Dave.

  • 0
  Nazgulled said:
Uh? Look at the code...

I set the form background to Lime and I've also set the Transparency Key to Lime, this is the easiest way I know of to have a form transparent with irregular shapes.

Of course the background is not Lime, it's transparent, but that's just because the Transparency Key is the same color as the form background, otherwise the form background wouldn't be transparent...

Sorry, I misspoke (miswrote?). I meant to say if the transparency key is Lime and the background color is Lime, then that means the color of the control or window behind it will show through. If it is the top-level Form, I believe it will not let you set it to be transparent in this way (if you're trying to show through to windows beind yours, you'll need to use a layered window).

I haven't looked at the code, sorry. It just sounded like you were talking about the background color of a control, in which case what I said above holds true.

I still think this is likely, and what you're seeing is an artifact of the top-level window being resized and repainting itself before your control has been resized and invalidated.

  • 0

But I'm not showing any window being mine. I just have one window/one form and I want it to be transparent so I can have an irregular shaped form and that's all I'm doing.

But I'm not really sure what you are talking about because you say you don't believe it will let me set it to transparent but I've already made it transparent, so the problem isn't there, I think.

When and if you have the time, please, look at the source code...

  • 0

I have met the same situation with you. Although I google a lot, but I didn't find a statisfied answer yet. Doublebuffer works when I don't need a transparent background but not the transparent one. I also hope someone who have solved the problem can make some progress...

PS: I don't understand why the traditional softs can handle it so perfectly.

I have met the same situation with you. Although I google a lot, but I didn't find a statisfied answer yet. Doublebuffer works when I don't need a transparent background but not the transparent one. I also hope someone who have solved the problem can make some progress...

PS: I don't understand why the traditional softs can handle it so perfectly.

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

  • Recent Achievements

    • First Post
      Gladiattore earned a badge
      First Post
    • Reacting Well
      Gladiattore earned a badge
      Reacting Well
    • Week One Done
      NeoWeen earned a badge
      Week One Done
    • One Month Later
      BA the Curmudgeon earned a badge
      One Month Later
    • First Post
      Doreen768 earned a badge
      First Post
  • Popular Contributors

    1. 1
      +primortal
      649
    2. 2
      ATLien_0
      256
    3. 3
      Xenon
      166
    4. 4
      neufuse
      143
    5. 5
      +FloatingFatMan
      107
  • Tell a friend

    Love Neowin? Tell a friend!