HighTechTalks DotNet Forums  

AnimateWindow and custom controls

Dotnet Framework (Drawing) microsoft.public.dotnet.framework.drawing


Discuss AnimateWindow and custom controls in the Dotnet Framework (Drawing) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
MariusI
 
Posts: n/a

Default AnimateWindow and custom controls - 09-09-2005 , 03:48 AM






Does anyone know if AnimateWindow (user32.dll) can be used in conjunction
with custom controls for example, to fade controls in and out when their
visibility is changed? I've tried to call AnimateWindow in Control_Load,
OnVisibleChanged and also when the WM_SHOWWINDOW message is sent, but nothing
happens.

Reply With Quote
  #2  
Old   
Oliver Sturm
 
Posts: n/a

Default Re: AnimateWindow and custom controls - 09-09-2005 , 04:02 AM






MariusI wrote:

Quote:
Does anyone know if AnimateWindow (user32.dll) can be used in conjunction
with custom controls for example, to fade controls in and out when their
visibility is changed? I've tried to call AnimateWindow in Control_Load,
OnVisibleChanged and also when the WM_SHOWWINDOW message is sent, but
nothing
happens.
I've only ever tried it with Forms, not with single controls. The API docs
(http://shrinkster.com/7wy) don't say anything about this, but have you
tried checking the return code of the AnimateWindow function? At least
you'll find out if the function itself thinks there's something wrong.


Oliver Sturm
--
Expert programming and consulting services available
See http://www.sturmnet.org (try /blog as well)



Reply With Quote
  #3  
Old   
MariusI
 
Posts: n/a

Default Re: AnimateWindow and custom controls - 09-09-2005 , 05:39 AM



Well, the return value indicates that something is wrong, but in terms of
documentation and usage, i can't see any reason as to why this shouldn't
work. The documentation states that the AnimateWindow function should recieve
a window handle. Since a control is a technically a window this should work
fine, but it doesn't so i'm obviously missing something here :-). By the way,
my problems with flickering child controls when resizing was solved by
removing the client area from the nc-area graphics object before it was
drawn. The underlying bitmap had transparency set in the client area, but
that wasn't enough to avoid the flicker.

"Oliver Sturm" wrote:

Quote:
MariusI wrote:

Does anyone know if AnimateWindow (user32.dll) can be used in conjunction
with custom controls for example, to fade controls in and out when their
visibility is changed? I've tried to call AnimateWindow in Control_Load,
OnVisibleChanged and also when the WM_SHOWWINDOW message is sent, but
nothing
happens.

I've only ever tried it with Forms, not with single controls. The API docs
(http://shrinkster.com/7wy) don't say anything about this, but have you
tried checking the return code of the AnimateWindow function? At least
you'll find out if the function itself thinks there's something wrong.


Oliver Sturm
--
Expert programming and consulting services available
See http://www.sturmnet.org (try /blog as well)



Reply With Quote
  #4  
Old   
Oliver Sturm
 
Posts: n/a

Default Re: AnimateWindow and custom controls - 09-09-2005 , 06:04 AM



MariusI wrote:

Quote:
Well, the return value indicates that something is wrong, but in terms of
documentation and usage, i can't see any reason as to why this shouldn't
work. The documentation states that the AnimateWindow function should
recieve
a window handle. Since a control is a technically a window this should work
fine, but it doesn't so i'm obviously missing something here :-).
Have you used GetLastError? What does it say?

Quote:
By the way,
my problems with flickering child controls when resizing was solved by
removing the client area from the nc-area graphics object before it was
drawn. The underlying bitmap had transparency set in the client area, but
that wasn't enough to avoid the flicker.
Ah - nice to hear you figured it out.


Oliver Sturm
--
Expert programming and consulting services available
See http://www.sturmnet.org (try /blog as well)



Reply With Quote
  #5  
Old   
MariusI
 
Posts: n/a

Default Re: AnimateWindow and custom controls - 09-09-2005 , 07:23 AM



Well, guess this doesn't work, i got the "ERROR_INVALID_WINDOW_HANDLE". Any
microsoft officials who would like to comment on the error?

"Oliver Sturm" wrote:

Quote:
MariusI wrote:

Well, the return value indicates that something is wrong, but in terms of
documentation and usage, i can't see any reason as to why this shouldn't
work. The documentation states that the AnimateWindow function should
recieve
a window handle. Since a control is a technically a window this should work
fine, but it doesn't so i'm obviously missing something here :-).

Have you used GetLastError? What does it say?

By the way,
my problems with flickering child controls when resizing was solved by
removing the client area from the nc-area graphics object before it was
drawn. The underlying bitmap had transparency set in the client area, but
that wasn't enough to avoid the flicker.

Ah - nice to hear you figured it out.


Oliver Sturm
--
Expert programming and consulting services available
See http://www.sturmnet.org (try /blog as well)



Reply With Quote
  #6  
Old   
Scott McChesney
 
Posts: n/a

Default Re: AnimateWindow and custom controls - 09-09-2005 , 08:30 AM



Well, I'm not an official MS source, but given that the docs for
"AnimateWindow" say that the function will fail "[w]hen trying to animate a
child window with AW_BLEND", this may be the source of your problem. MSDN
says that AW_BLEND can only be used on a top-level window, and your custom
control is not likely that.

HTH

- Scott

"MariusI" <MariusI (AT) discussions (DOT) microsoft.com> wrote

Quote:
Well, guess this doesn't work, i got the "ERROR_INVALID_WINDOW_HANDLE".
Any
microsoft officials who would like to comment on the error?

"Oliver Sturm" wrote:

MariusI wrote:

Well, the return value indicates that something is wrong, but in terms
of
documentation and usage, i can't see any reason as to why this shouldn't
work. The documentation states that the AnimateWindow function should
recieve
a window handle. Since a control is a technically a window this should
work
fine, but it doesn't so i'm obviously missing something here :-).

Have you used GetLastError? What does it say?

By the way,
my problems with flickering child controls when resizing was solved by
removing the client area from the nc-area graphics object before it was
drawn. The underlying bitmap had transparency set in the client area,
but
that wasn't enough to avoid the flicker.

Ah - nice to hear you figured it out.


Oliver Sturm
--
Expert programming and consulting services available
See http://www.sturmnet.org (try /blog as well)





Reply With Quote
  #7  
Old   
Frank Hileman
 
Posts: n/a

Default Re: AnimateWindow and custom controls - 09-09-2005 , 09:34 AM



To my knowledge, none of the translucency features (per-pixel alpha
blending) in windows work with child controls. Generally you use lightweight
graphical objects or pop up an overlying window.

--
Regards,
Frank Hileman

check out VG.net: http://www.vgdotnet.com
Animated vector graphics system
Integrated Visual Studio .NET graphics editor

"Scott McChesney" <scott.NO.SPAM.mcchesney (AT) us (DOT) army.mil> wrote

Quote:
Well, I'm not an official MS source, but given that the docs for
"AnimateWindow" say that the function will fail "[w]hen trying to animate
a child window with AW_BLEND", this may be the source of your problem.
MSDN says that AW_BLEND can only be used on a top-level window, and your
custom control is not likely that.

HTH

- Scott



Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.