protected override void CreateTexture() { if (ControlTexture != null && !ControlTexture.IsDisposed && Size != TextureSize) { ControlTexture.Dispose(); } if (ControlTexture == null || ControlTexture.IsDisposed) { DXManager.ControlList.Add(this); ControlTexture = new Texture(DXManager.Device, Size.Width, Size.Height, 1, Usage.RenderTarget, Format.A8R8G8B8, Pool.Default); TextureSize = Size; } Surface oldSurface = DXManager.CurrentSurface; Surface surface = ControlTexture.GetSurfaceLevel(0); DXManager.SetSurface(surface); DXManager.Device.Clear(ClearFlags.Target, BackColour.ToRawColorBGRA(), 0, 0); BeforeDrawControl(); DrawChildControls(); AfterDrawControl(); DXManager.Sprite.Flush(); DXManager.SetSurface(oldSurface); TextureValid = true; surface.Dispose(); }
protected virtual void CreateTexture() { if (ControlTexture == null || ControlTexture.IsDisposed) { DXManager.ControlList.Add(this); ControlTexture = new Texture(DXManager.Device, Size.Width, Size.Height, 1, Usage.RenderTarget, Format.A8R8G8B8, Pool.Default); TextureSize = Size; } Surface oldSurface = DXManager.CurrentSurface; Surface surface = ControlTexture.GetSurfaceLevel(0); DXManager.SetSurface(surface); DXManager.Device.Clear(ClearFlags.Target, BackColour.ToRawColorBGRA(), 0, 0); DXManager.SetSurface(oldSurface); TextureValid = true; surface.Dispose(); }