-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #186 from swharden/winforms-scroll
WinForms.GDI Sample: Add Scrolling
- Loading branch information
Showing
6 changed files
with
122 additions
and
129 deletions.
There are no files selected for viewing
142 changes: 74 additions & 68 deletions
142
src/Graphics/samples/GraphicsTester.GDI/Form1.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/Graphics/samples/GraphicsTester.Portable/Scenarios/DimensionTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using Microsoft.Maui.Graphics; | ||
|
||
namespace GraphicsTester.Scenarios | ||
{ | ||
public class DimensionTest : AbstractScenario | ||
{ | ||
public DimensionTest() : base(400, 300) | ||
{ | ||
} | ||
|
||
public override void Draw(ICanvas canvas) | ||
{ | ||
// like array Length, image Width and Height are 1 unit larger than zero-indexed positions. | ||
PointF topLeft = new PointF(0, 0); | ||
PointF topRight = new PointF(Width - 1, 0); | ||
PointF bottomLeft = new PointF(0, Height - 1); | ||
PointF bottomRight = new PointF(Width - 1, Height - 1); | ||
|
||
canvas.FillColor = Colors.LightSlateGray; | ||
canvas.FillRectangle(0, 0, Width, Height); | ||
|
||
// draw lines instead of a rectangle becuase it's more obvious which pixel row/column is filled | ||
canvas.StrokeColor = Colors.Black; | ||
canvas.DrawLine(topLeft, topRight); | ||
canvas.DrawLine(topRight, bottomRight); | ||
canvas.DrawLine(bottomRight, bottomLeft); | ||
canvas.DrawLine(bottomLeft, topLeft); | ||
canvas.DrawLine(topLeft, bottomRight); | ||
canvas.DrawLine(topRight, bottomLeft); | ||
|
||
canvas.FontColor = Colors.Black; | ||
canvas.FontSize = 16f; | ||
canvas.DrawString($"{Width}x{Height}", Width / 2, 50, HorizontalAlignment.Center); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters