Don't know whether to post this to a DirectX newsgroup, but I'd post it here
:)

I have written a C# MDI app utilising GDI+ to do the drawing. Performance is
terrible. (I have double buffering, but this causes other problems,
especially at high zoom levels - on large documents).

Is it possible to use DirectX9 to paint MDI child windows? I have seen some
samples, and they seem to use a busy loop to continually redraw a window,
calling Application.DoEvents after each iteration.

Why do they need to do this? Would it work to have multiple MDI childs and
update those in the loop? Why not just respond to paint events instead of
replacing the message loop?

Maybe I just don't get it.... :)

Anyone have any ideas? Any advice? Anyone actually done this with any
success?

Thanks -

Paul Wardle

Re: Using DirectX 9 with .NET by Bob

Bob
Mon Dec 15 04:33:36 CST 2003

I recently published an article in Well Formed that showed how to use
DirectX to speed up Windows Forms drawing.

I think its a viable solution but it is a litle quirky. I also think that
the code generated by the DirectX app-wizard that comes with the 9.x SDK is
over complex but it's easy to get away with that using boilerplate code.

http://www.bobpowell.net/october2003.htm

--
Bob Powell [MVP]
C#, System.Drawing

The November edition of Well Formed is now available.
Learn how to create Shell Extensions in managed code.
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

Read my Blog at http://bobpowelldotnet.blogspot.com

"Paul Wardle" <p.wardle@ntlworld.com> wrote in message
news:%23DrvIjrwDHA.2440@TK2MSFTNGP12.phx.gbl...
> Don't know whether to post this to a DirectX newsgroup, but I'd post it
here
> :)
>
> I have written a C# MDI app utilising GDI+ to do the drawing. Performance
is
> terrible. (I have double buffering, but this causes other problems,
> especially at high zoom levels - on large documents).
>
> Is it possible to use DirectX9 to paint MDI child windows? I have seen
some
> samples, and they seem to use a busy loop to continually redraw a window,
> calling Application.DoEvents after each iteration.
>
> Why do they need to do this? Would it work to have multiple MDI childs and
> update those in the loop? Why not just respond to paint events instead of
> replacing the message loop?
>
> Maybe I just don't get it.... :)
>
> Anyone have any ideas? Any advice? Anyone actually done this with any
> success?
>
> Thanks -
>
> Paul Wardle
>
>



Re: Using DirectX 9 with .NET by n!

n!
Mon Dec 15 04:54:09 CST 2003

> Is it possible to use DirectX9 to paint MDI child windows? I have seen
some
> samples, and they seem to use a busy loop to continually redraw a window,
> calling Application.DoEvents after each iteration.
>
> Why do they need to do this? Would it work to have multiple MDI childs and
> update those in the loop? Why not just respond to paint events instead of
> replacing the message loop?
>
> Anyone have any ideas? Any advice? Anyone actually done this with any
> success?

I have an assembly currently available intended for use with the DX9 Summer
Update that supports multiple control views, its currently in an alpha state
(until I get my C#-2003 at Christmas!) available in preview form at
www.btinternet.com/~nfactorial/downloads/Framework3D.zip (for those
interested).

For non-realtime apps it is easier (and much less strain on the machine) to
respond to the applications Idle event, couple this with a 'dirty' flag for
each viewport and rendering only when the flag is set allows an alternative
that reduces the burden to almost non-existant.

n!



Re: Using DirectX 9 with .NET by Jacek

Jacek
Mon Dec 15 06:06:00 CST 2003

Hi Paul!

In case your do not code MDI game environment (hehe) the simplest solution
is to create single device in MDI Parent for drowing all MDI Children and
not using game loop but as indicated by n! just responding to Paint events -
works smoothly with app processor load unnoticeably low - afterall your
graphics card does the job! If you need some animations use technique from
internet technology - timers for managing animation time scale i.e.
unmanaged TIME class - rather than resources exhousting game loop.

hope this helps

Jacek


U¿ytkownik "Paul Wardle" <p.wardle@ntlworld.com> napisa³ w wiadomo¶ci
news:%23DrvIjrwDHA.2440@TK2MSFTNGP12.phx.gbl...
> Don't know whether to post this to a DirectX newsgroup, but I'd post it
here
> :)
>
> I have written a C# MDI app utilising GDI+ to do the drawing. Performance
is
> terrible. (I have double buffering, but this causes other problems,
> especially at high zoom levels - on large documents).
>
> Is it possible to use DirectX9 to paint MDI child windows? I have seen
some
> samples, and they seem to use a busy loop to continually redraw a window,
> calling Application.DoEvents after each iteration.
>
> Why do they need to do this? Would it work to have multiple MDI childs and
> update those in the loop? Why not just respond to paint events instead of
> replacing the message loop?
>
> Maybe I just don't get it.... :)
>
> Anyone have any ideas? Any advice? Anyone actually done this with any
> success?
>
> Thanks -
>
> Paul Wardle
>
>



Re: Using DirectX 9 with .NET by Paul

Paul
Mon Dec 15 16:41:57 CST 2003

Thanks guys

Bob - I seem no to able to access the page you suggested - do I need a
subscription...?
n! - not been able to get your stuff to work yet - do you have an executable
that I can run to have a peek?
Jacek - thanks for the advice!

I get my PC back from the repair man tomorrow, so I should be able to have a
hard play over Xmas..the wife'll love me for it :)

I'll let you know how I get on.

Thanks again.

Paul

"Paul Wardle" <p.wardle@ntlworld.com> wrote in message
news:%23DrvIjrwDHA.2440@TK2MSFTNGP12.phx.gbl...
> Don't know whether to post this to a DirectX newsgroup, but I'd post it
here
> :)
>
> I have written a C# MDI app utilising GDI+ to do the drawing. Performance
is
> terrible. (I have double buffering, but this causes other problems,
> especially at high zoom levels - on large documents).
>
> Is it possible to use DirectX9 to paint MDI child windows? I have seen
some
> samples, and they seem to use a busy loop to continually redraw a window,
> calling Application.DoEvents after each iteration.
>
> Why do they need to do this? Would it work to have multiple MDI childs and
> update those in the loop? Why not just respond to paint events instead of
> replacing the message loop?
>
> Maybe I just don't get it.... :)
>
> Anyone have any ideas? Any advice? Anyone actually done this with any
> success?
>
> Thanks -
>
> Paul Wardle
>
>



Re: Using DirectX 9 with .NET by n!

n!
Tue Dec 16 07:45:03 CST 2003

> n! - not been able to get your stuff to work yet - do you have an
executable
> that I can run to have a peek?

There is an executable available at
http://www.btinternet.com/~nfactorial/downloads/HeightEditor.zip, however
this program is in early development so dont expect much :)

n!



Re: Using DirectX 9 with .NET by n!

n!
Tue Dec 16 08:26:18 CST 2003

> > n! - not been able to get your stuff to work yet - do you have an
> executable
> > that I can run to have a peek?
>
> There is an executable available at
> http://www.btinternet.com/~nfactorial/downloads/HeightEditor.zip, however
> this program is in early development so dont expect much :)

I should note it was intended for WinXP but should work on 2K (though I dont
know how well). Anything else is purely by chance :)

n!