private void RepaintElement(UIElement element) { if (_buffer == null) return; ClearBuffer(_buffer, element.Bounds); element.Draw(_buffer.DrawingGraphics.CreateChild( element.Location, element.TransformationScaling, element.TransformationCenter)); }
public void DirectDrawElement(int verticalOffset, UIElement element) { if (_buffer == null) return; var rect = new Rectangle(0, -verticalOffset, Size.Width, Parent.Size.Height.ToLogic()); if (!element.Bounds.IntersectsWith(rect)) return; if (_updating) return; _updating = true; var location = ScreenRoutines.ScreenLocaton(Parent); // scale to real screen coords from logical var clipRect = new Rectangle( element.Location.X, element.Location.Y + verticalOffset, element.Size.Width, element.Size.Height).ToPixels(); try { // draw background _buffer.Graphics.FillRectangle(new SolidBrush(MetroTheme.PhoneBackgroundBrush), clipRect); var oldclip = _buffer.Graphics.Clip; _buffer.Graphics.Clip = new Region(clipRect); _background.Draw(_drawingGraphics.CreateChild(new Point(-location.X, -location.Y))); _buffer.Graphics.Clip = oldclip; // draw tile // here use logical coords because Flueux will recalc coords inside element.Draw(_drawingGraphics.CreateChild(new Point(element.Location.X, element.Location.Y + verticalOffset))); // draw buffer directly to screen _controlGraphics.DrawImage(_buffer.Image, location.X + clipRect.Left, location.Y + clipRect.Top, clipRect, GraphicsUnit.Pixel); } catch (Exception) { } _updating = false; }