Building a Workflow Designer (17) with Silverlight-persisting data to a database

Source: Internet
Author: User
Tags silverlight

Building a workflow Designer using Silverlight (17)-Persisting data to database-designing webservices interfaces

In the beginning, the program added a small function, is to the container to increase the function of the grid line, so that the container looks like the following look

Of course, there are two ways to achieve, one is to use the background image, but the consistent primary colors of this article is to use less pictures, the use of Silverlight's drawing function to achieve, these grids can use the line object in XAML to implement. For this we need to dynamically set a canvas, and then add these dynamically generated line objects to the canvas, and finally add canvas to the container, which is simpler, but in the program, you need to consider rollback, zindex effect. The following code describes the ability to dynamically increase grid lines.

Code
GridLinesContainer.Children.Clear ();
SolidColorBrush brush = new SolidColorBrush ();
Brush. Color = Color.FromArgb (255, 160, 160, 160);
Brush. Color = Color.FromArgb (255, 255, 255, 255);
Double thickness = 0.3;
Double top = 0;
Double left = 0;
Double width = cnsdesignercontainer.width;
Double height = cnsdesignercontainer.height;
Double steplength = 40;
Double x, y;
x = left + steplength;
y = top;
while (x < width + left)
{
Line line = new Line ();
Line. X1 = x;
Line. Y1 = y;
Line. X2 = x;
Line. Y2 = y + height;

Line. Stroke = brush;
Line. StrokeThickness = thickness;
Line. Stretch = Stretch.fil;
GRIDLINESCONTAINER.CHILDREN.ADD (line);
x + + steplength;
}
x = left;
y = top + steplength;
while (Y < height + top)
{
Line line = new Line ();
Line. X1 = x;
Line. Y1 = y;
Line. X2 = x + width;
Line. Y2 = y;

Line. Stroke = brush;
Line. Stretch = Stretch.fil;
Line. StrokeThickness = thickness;
GRIDLINESCONTAINER.CHILDREN.ADD (line);
Y + + steplength;
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.