المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Sliding an Image on another Image



C# Programming
12-28-2012, 09:54 AM
Dear Group,

I am new to DirectX and I am stuck in one basic scenario. So my requirement is -
I am having C# Windows Form. Now on top of that form I have to Slide one Image on top of another Image. Both Images are passed to my this translating class.
I used the concept of Sprite after going through the online Samples. But the problem is when the Sprite is moving the background is set to the color which is provided in the Device.Clear() method. I didn't find any way by which I can overcome this. There is no way to set the background image of the Device too.

I also tried using the concept of Microsoft.DirectX.DirectDraw.Surface too. PFB the code which I tried -

// Code Snippet Begin
SurfaceDescription description = new SurfaceDescription();

description.SurfaceCaps.PrimarySurface = true;
description.SurfaceCaps.Flip = true;
description.SurfaceCaps.Complex = true;
description.BackBufferCount = 1;

m_PrimarySurface = new Surface(description, m_Device);
description.Clear();
description.SurfaceCaps.BackBuffer = true;
m_SecondarySurface = m_PrimarySurface.GetAttachedSurface(description.SurfaceCaps);

description.Clear();
description.SurfaceCaps.OffScreenPlain = true;

m_ImageSurfaceurface = new Surface("MyImage.jpg", description, m_Device);
// Code Snippet End

But here the line -

m_ImageSurfaceurface = new Surface("MyImage.jpg", description, m_Device);

is giving build error without any explanation why.

So I am in a stuck state. Please Help...

Note - I have DirectX 9.0 SDK installed.

Thanks in advance...
Shubhanshu .