![]() ![]() TileBrush is used to fill the area of a shape with a repeating pattern. BackgroundĪ TileBrush is an abstract WPF class derived from Brush and ancestor for ImageBrush, DrawingBrush, and VisualBrush. And the idea was born!Īccording to the analysis it was quite clear: a new custom control is necessary to encapsulate all the calculations. The second thought was: the DrawingBrush makes fine all the things listed above, but in two directions! It would be great to try forcing the DrawingBrush to draw tiles in just one direction. In this point everything becomes a little more complicated. The third goal was to allow setting the initial adjustment of the tiles relative to the viewport itself, and to allow changing this adjustment with an offset in the real time. If the original size is chosen, with the viewport resizing only the number of repetitions changes, but if scaled mode is chosen, not only the number but also the positions of the single tiles changes. The second goal was to display the single pictures in their original size or scaled proportionally to the width or height of the viewport. The problem was that every time if the viewport has changed that new number of repetitions have to be calculated and the pictures must be redrawn. The first thought was: OK, this is quite easy, I can take a picture and draw it several times in a loop at the end of the other until the viewport has felt. The first goal was to display a picture in a defined viewport as a whole series of side by side laid tiles and thus either horizontally or vertically. Various controls in the collection uses direct or indirect the Viewport rearranging of ImageBrush patterns to show and to slide image strips. The Sliding Image Control is a part of Sliding Controls, a small but useful WPF custom control collection that will be present through a series of articles here.
0 Comments
Leave a Reply. |