![]() Geometry = new RectangleGeometry(new Rect(bounds. Transform = new TranslateTransform(bounds.Left, bounds.Top), ![]() New LineGeometry(tileRect.BottomLeft, tileRect.TopRight) New LineGeometry(tileRect.TopLeft, tileRect.BottomRight), ViewportUnits = BrushMappingMode.Absolute, If you want to generate the brush dynamically, here's an equivalent function based on the above XAML: static Brush CreateGridBrush(Rect bounds, Size tileSize) Then finally to use it, just set it as the background of your grid (or other panel): So to have a starting position of (30, 45) (corresponding to startX and startY) with the width and height, 130x120: Now to be able to draw them offset in your grid from the edges, you need to have another brush where you draw a rectangle with the desired dimensions, filled with your tiles. (p.s., the slope slop is redundant since you already have the horizontal and vertical step sizes) So to have a 20x10 tile (which corresponds to stepX and stepY): To draw your tile, you could think of it as drawing X's. ![]() ![]() You're just drawing a grid so you could just create a DrawingBrush to draw a single grid square and tile it to fill in the rest. Make 2D masterpieces or 3D models that you can. Classic Paint has been reimagined, with an updated look and feel and a ton of new brushes and tools. If you want to draw lines, use the appropriate geometries to draw them. Whether you’re an artist or just want to try out some doodlesPaint 3D makes it easy to unleash your creativity and bring your ideas to life. You don't really have to "draw" anything with WPF.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |