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

使用 Silverlight 建構工作流設計器(二十):新增標籤功能(上)

     編輯:關於ASP.NET

需求背景

原有的規則註釋(TextBlock)位置會隨規則自動調整,無法手動拖曳定位。為解決此問題,新增獨立的「標籤」類別,專門用於流程圖上的文字說明,不涉及流程屬性,僅儲存於 XML 設定檔中。

標籤類別設計

新建 Label.xaml 使用者控制項,包含顯示用的 TextBlock 與編輯用的 TextBox(預設隱藏):

<UserControl x:Class="Shareidea.Web.UI.Control.Workflow.Designer.Label"
 xmlns="https://schemas.microsoft.com/winfx/2006/xaml/presentation"
 xmlns:x="https://schemas.microsoft.com/winfx/2006/xaml"
 MouseLeftButtonDown="UserControl_MouseLeftButtonDown"
 MouseMove="UserControl_MouseMove"
 MouseLeftButtonUp="UserControl_MouseLeftButtonUp"
 MouseLeave="UserControl_MouseLeave"
 Width="400" Height="20">
 <Grid x:Name="LayoutRoot" Background="Transparent">
   <TextBlock Name="txtLabelName" />
   <TextBox Name="tbLabelName" TextChanged="TextBox_TextChanged" Visibility="Collapsed" />
 </Grid>
</UserControl>

核心功能支援

  • 拖曳佈局
  • XML 匯入/匯出
  • 標籤名稱編輯
  • 選取與群組移動
  • 複製、貼上、刪除
  • 滑鼠右鍵選單

本節將詳細說明拖曳、XML 序列化與編輯功能的實作細節。

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