Jump to content
  • Advertisement
Sign in to follow this  
dcox

SlimDX RenderForm in Visual Studio Desginer

This topic is 2655 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

When I view a SlimDX RenderForm in the VS designer, it is transparent. What is the best way to fill in the background?

Thanks

Share this post


Link to post
Share on other sites
Advertisement
The RenderForm class purposely overrides the PaintBackground method so that the background never gets drawn, which reduces flicker when you're going to be putting Direct3D over it anyway.

Share this post


Link to post
Share on other sites
Thanks. Is background painting what causes flicker, then, with regular Forms? Also, one more thought. Could RenderForm detect that the form is being rendered from the designer and allow the background to be rendered while inside the designer (but not do so while the application is running outside the designer)? The reason I ask is that I think it would be nice to sometimes add controls to a RenderForm inside the designer. Because the background isn't drawn, it is a little disconcerting to see everything behind the form while in the designer.


The RenderForm class purposely overrides the PaintBackground method so that the background never gets drawn, which reduces flicker when you're going to be putting Direct3D over it anyway.

Share this post


Link to post
Share on other sites
[color=#1C2837][size=2]
The reason I ask is that I think it would be nice to sometimes add controls to a RenderForm inside the designer[/quote]
[color=#1C2837][size=2]Why would you want to add controls to the render form? They will have airspace issues with the D3D rendering.

Share this post


Link to post
Share on other sites
I am not sure what you mean by airspace issues. That term is not familiar with me. Regarding your question, I can easily envision scenarios where they would be useful. My immediate wish is to add some semi-transparent controls (like Google maps). If the user moves the mouse over the buttons, the transparency changes allowing them to become opaque.


[color="#1c2837"]
The reason I ask is that I think it would be nice to sometimes add controls to a RenderForm inside the designer

[color="#1c2837"]Why would you want to add controls to the render form? They will have airspace issues with the D3D rendering.
[/quote]

Share this post


Link to post
Share on other sites

I am not sure what you mean by airspace issues. That term is not familiar with me. Regarding your question, I can easily envision scenarios where they would be useful. My immediate wish is to add some semi-transparent controls (like Google maps). If the user moves the mouse over the buttons, the transparency changes allowing them to become opaque.

[quote name='Josh Petrie' timestamp='1300118976' post='4785648']
[color="#1c2837"]
The reason I ask is that I think it would be nice to sometimes add controls to a RenderForm inside the designer

[color="#1c2837"]Why would you want to add controls to the render form? They will have airspace issues with the D3D rendering.
[/quote]
[/quote]

What he means is that customizing the design behavior in this instance would be disingenuous, since at runtime it would appear differently and it would be confusing as to why. DirectX will happily render right over the top of any controls you stick in the client area of the window, making the experience shaky at best.

If you actually want this behavior, fine, but we can't make that decision in the general case for all users.

Share this post


Link to post
Share on other sites
Hmmm. A RenderForm is transparent in the designer and consequently already appears differently than at run time. I guess the question is, would you rather it be transparent at design time or with a painted background?

I downloaded the SlimDX code over the weekend. If memory serves me correctly the RenderWindow OnPaintBackground method is overridden. The base class method is not called which is why the background is not painted. I find this to have the following effect: For example, if you drag a button from the VS toolbox to the RenderForm, a trail of duplicated buttons is left in the form-- this is caused by the button being redrawn as it is moved. Because the RenderForm's background is not repainted, the artifact of a trail of buttons appears. By the time several controls are added to the window, you have such a mess in the designer to render (excuse the pun) the form very confusing. If a background were painted at design time, then the result would be much closer to what would appear at run time.

Also, in the experiments that I have performed, I don't find that DirectX draws over the top of the controls. Drawing of the controls doesn't seem to happen until the RenderForm is first painted by DirectX.



[quote name='dcox' timestamp='1300120812' post='4785660']
I am not sure what you mean by airspace issues. That term is not familiar with me. Regarding your question, I can easily envision scenarios where they would be useful. My immediate wish is to add some semi-transparent controls (like Google maps). If the user moves the mouse over the buttons, the transparency changes allowing them to become opaque.

[quote name='Josh Petrie' timestamp='1300118976' post='4785648']
[color="#1c2837"]
The reason I ask is that I think it would be nice to sometimes add controls to a RenderForm inside the designer

[color="#1c2837"]Why would you want to add controls to the render form? They will have airspace issues with the D3D rendering.
[/quote]
[/quote]

What he means is that customizing the design behavior in this instance would be disingenuous, since at runtime it would appear differently and it would be confusing as to why. DirectX will happily render right over the top of any controls you stick in the client area of the window, making the experience shaky at best.

If you actually want this behavior, fine, but we can't make that decision in the general case for all users.
[/quote]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!