public AMButton() { timer = new Timer(); timer.Interval = 10; timer.Tick += (object sender, EventArgs e) => { alpha += 10; color = Color.FromArgb(alpha, HighlightColor); if (alpha > 100) { timer.Stop(); } Invalidate(); }; this.FlatStyle = FlatStyle.Flat; this.FlatAppearance.BorderSize = 1; this.FlatAppearance.BorderColor = Color.LightGray; SKHelper = new SkiaHelper(); SKHelper.Size = new RawSize { Width = this.Width, Height = this.Height }; SKHelper.SwapChain(); }
public MainForm() { /* * using (var g = this.CreateGraphics()) * { * SizeF sngScaleFactor = new SizeF(); * if (g.DpiX > 96) * { * sngScaleFactor.Width = g.DpiX / 96; * sngScaleFactor.Height = g.DpiY / 96; * } * * if (this.AutoScaleDimensions == this.CurrentAutoScaleDimensions) * { * this.Scale(sngScaleFactor); * } * } */ SKHelper = new SkiaHelper() { Size = new RawSize { Width = this.Width, Height = this.Height }, PostChain = new SkiaHelper.CanvasDelegate((SKCanvas Canvas) => { using (var paint = new SKPaint()) using (var shader = SKShader.CreateLinearGradient( new SKPoint(SKHelper.Size.Width - 200, 200), new SKPoint(SKHelper.Size.Width, 0), new SKColor[] { SKColors.Orange, SKColors.Orange, SKColors.Gold }, null, SKShaderTileMode.Clamp)) { paint.IsAntialias = true; paint.Shader = shader; SKHelper.Skia_Canvas.DrawPaint(paint); } }) }; InitializeComponent(); DoubleBuffered = true; SKHelper.SwapChain(); }