void DrawGradientButton(Xwt.Drawing.Context G, GradientButton B) { DrawingPath P = new DrawingPath(); P.Rectangle(new Xwt.Rectangle(B.Position, B.Size)); LinearGradient gr; G.AppendPath(P); Pattern pat = gr = new LinearGradient(B.Position.X, B.Position.Y, B.Position.X + B.Size.Width, B.Position.Y + B.Size.Height); gr.AddColorStop(0, B.Color.BlendWith(Colors.White, 0.8)); gr.AddColorStop(0.5, B.Color); gr.AddColorStop(1, B.Color.BlendWith(Colors.White, 0.8)); G.Pattern = pat; G.Fill(); G.AppendPath(P); G.SetColor(Xwt.Drawing.Colors.Black); G.SetLineWidth(1); G.Stroke(); TextLayout L = new TextLayout() { Font = B.Font, Text = B.Text }; Size TextSize = new Size(0.6 * L.Font.Size * L.Text.Count(), L.Font.Size); G.DrawTextLayout(L, new Xwt.Point(B.Position.X + B.Size.Width / 2 - TextSize.Width / 2, B.Position.Y + B.Size.Height / 2 - TextSize.Height / 2)); }