首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式碼之家 >> 編程語言 >  >> .NET 網頁程式設計 >> ASP.NET 基礎 >> 關於ASP.NET

使用 Silverlight 建構工作流設計器(十七):資料持久化至資料庫——設計 Web Service 介面與容器網格線

     編輯:關於ASP.NET

小功能:動態繪製容器網格線

為使設計介面類似專業繪圖工具,動態生成網格線。採用 Canvas 承載 Line 元素,避免使用背景圖片。

GridLinesContainer.Children.Clear();
SolidColorBrush brush = new SolidColorBrush(Color.FromArgb(255, 160, 160, 160));
double thickness = 0.3;
double stepLength = 40;
double width = cnsDesignerContainer.Width;
double height = cnsDesignerContainer.Height;

// 垂直線
for (double x = stepLength; x < width; x += stepLength)
{
    Line line = new Line { X1 = x, Y1 = 0, X2 = x, Y2 = height, Stroke = brush, StrokeThickness = thickness };
    GridLinesContainer.Children.Add(line);
}

// 水平線
for (double y = stepLength; y < height; y += stepLength)
{
    Line line = new Line { X1 = 0, Y1 = y, X2 = width, Y2 = y, Stroke = brush, StrokeThickness = thickness };
    GridLinesContainer.Children.Add(line);
}

注意:實際專案中需處理捲軸位移與 Z-Index 層級,確保網格線永遠在最底層。

Web Service 介面規劃

定義 IWorkflowService 介面,包含 GetWorkflow(string id) 與 SaveWorkflow(WorkflowData data) 方法。WorkflowData 為資料傳輸物件(DTO),封裝流程 ID、名稱、XML 內容等欄位。Silverlight 客戶端透過非同步呼叫與伺服器互動。

  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式碼之家 All Rights Reserved