Beispiel #1
0
        protected override void WndProc(ref Message m)
        {
            if (m.Msg == 15)
            {
                var now = Stopwatch.Elapsed;
                if ((now - _lastFps).Seconds >= 1)
                {
                    _fps     = _frames;
                    _frames  = 0;
                    _lastFps = now;
                    UpdateTitle();
                }
                _frames++;

                _renderTarget.Resize(ClientSize.Width, ClientSize.Height);
                using (var ctx = _renderTarget.CreateDrawingContext())
                {
                    ctx.FillRectangle(Brushes.White, new Rect(0, 0, Width, Height));
                    ctx.FillRectangle(Brushes.Green, new Rect(_textPos, _text.Measure()));
                    ctx.FillRectangle(Brushes.Blue, _textRect);
                    ctx.DrawText(Brushes.Red, _textPos, _text);


                    /*for(var x=0; x<Width; x+=40)
                     *  for (var y = 0; y < Height; y += 20)
                     *      ctx.FillRectangle(Brushes.Gray, new Rect(x + (y/20)%2*20, y, 20, 20));
                     */
                    /*
                     * _geometry.Transform = new MatrixTransform(GetTransform());
                     * var rad = CreateRadialGradient();
                     * rad.Opacity = 0.5;
                     * ctx.DrawGeometry(rad, new Pen(CreateLinearGradient(), 4),
                     *  _geometry);*/
                    /*
                     * using (ctx.PushPostTransform(GetTransform()))
                     * {
                     *  ctx.DrawImage(_rbitmap, 1, new Rect(0, 0, 50, 50), new Rect(0, 0, 50, 50));
                     *  using(ctx.PushPostTransform(Matrix.CreateTranslation(200, 0)))
                     *  ctx.DrawImage(_bitmap, 1, new Rect(0, 0, _bitmap.PixelWidth, _bitmap.PixelHeight),
                     *      new Rect(0, 0, 100, 100));
                     * }*/
                }
                m.Result = new IntPtr(1);
                return;
            }
            base.WndProc(ref m);
        }
Beispiel #2
0
 private void SealControl_Resize(object sender, EventArgs e)
 {
     target.Resize(this.Width, this.Height);
 }