From 71454bb4e7ffd2474202de91e4d2e4845b918ca1 Mon Sep 17 00:00:00 2001 From: DarthAffe Date: Sun, 29 Nov 2015 09:49:53 +0100 Subject: [PATCH] Added some content --- Linear-Gradient-Brush.md | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/Linear-Gradient-Brush.md b/Linear-Gradient-Brush.md index 30404ce..e5423c4 100644 --- a/Linear-Gradient-Brush.md +++ b/Linear-Gradient-Brush.md @@ -1 +1,25 @@ -TODO \ No newline at end of file +The _LinearGradientBrush_ is one of the default brushes provided by CUE.NET. +It's used to draw a gradient as a "line" inside a rectangle. + +You are able to define a start and an end-point (both are inter- or extrapolated if needed) and the gradient which should be drawn on the virtual line between this points by either providing them as constructor-parameters or using the _StartPoint_-, _EndPoint_- and _Gradient_-Properties. +If you don't set an gradient the brush will return transparent for every key. +> The Start- and End-Point is given as the percentage from the top left corner. +> new PointF(0f, 0f) will be top left, new PointF(0,5f, 0,5f) in the center and new PointF(1f, 1f) in the bottom right. + +If you want to create a background on your keyboard looking like this + + + +you could use this code +```C# +GradientStop[] gradientStops = +{ + new GradientStop(0f, Color.Blue), + new GradientStop(1f, Color.Red) +}; +LinearGradient blueToRedGradient = new LinearGradient(gradientStops); // Gradient from blue to red +PointF startPoint = new PointF(0f, 1f); // Bottom left corner +PointF endPoint = new PointF(1f, 0f); // Top right corner +LinearGradientBrush linearBrush = new LinearGradientBrush(startPoint, endPoint, blueToRedGradient); +keyboard.Brush = linearBrush; +``` \ No newline at end of file