天天看點

利用xaml和C#實作工作流

運作結果圖:

利用xaml和C#實作工作流

點選左上角圖框的Here之後,跳轉:

利用xaml和C#實作工作流

進來需要制作一個顯示土地流轉資訊的部件,一開始利用華麗的Dev控件,GarreryControl,效果自認為不錯,拿給上司看後遭到痛批。由于本來水準有限,加之美工圖示的不給力,我認了。隻好自己從頭來做,換一種思路。

在網上找到一個Demo,認真研讀後,找到了方向:XAML加C#的Canvas控件,接下來就開始動手吧:

首先,我設計了自己的思路,Dia做出UML圖,即整體架構:

利用xaml和C#實作工作流

第一次做UML圖,和最終的結構還是有很大差距,比如類與類之間的嵌套關系不清,點選事件由StatusCanvas傳出到最外層,即調用LayoutElement的函數中的事件,一開始做就沒有考慮到,等到快做完時才亡羊補牢,好歹是做完了。

好了,UML設計完成後,開始代碼的編輯:

首先是儲存資訊的圖框,我使用的是Rectangle和TextBlock互相配合的方式,傳值隻需要傳入圖框的中心位置點位坐标即可。到編碼結束時,還考慮到了,如果做不出來動态效果,客戶必然不好發現那一個是他之前點選選擇的那個框,是以我設計了讓他将目前選擇的框體邊緣加粗顯示,代碼如下:

//狀态框
    public partial class StatusCanvas : Canvas
    {
        RectangleGeometry rectangle;
        TextBlock textBlock;
        public TextBlock LinkBlock;
        Point topLeft;
        public double RectangleWidth;
        public double RectangleHeight;
        public define.fieldInfo fieldInfo;
        public delegate void ClickDelegate(string strSomeWhenRegionCodeOut, int intAfterTurnStageOut);
        public event ClickDelegate ClickEvent;
        public int StrokeThickness;

        public StatusCanvas(Point topCentrolIn, double RectangleWidthIn, double RectangleHeightIn, define.fieldInfo fieldInfoIn, FindPareOrChild PareOrChild)
        {
            topLeft.X = topCentrolIn.X - RectangleWidthIn / 2;
            topLeft.Y = topCentrolIn.Y - RectangleHeightIn / 2;
            RectangleWidth = RectangleWidthIn;
            RectangleHeight = RectangleHeightIn;
            fieldInfo = fieldInfoIn;
            if (PareOrChild == FindPareOrChild.FindSelf)
            {
                StrokeThickness = 4;
            }
            else
            {
                StrokeThickness = 1;
            }
            //圖形框
            double x = topLeft.X;
            double y = topLeft.Y;
            rectangle = new RectangleGeometry(new Rect(x, y, RectangleWidth, RectangleHeight), 5, 5);
            LinearGradientBrush b3 = new LinearGradientBrush(Colors.Yellow, Colors.Black,100);
            System.Windows.Shapes.Path myPath = new System.Windows.Shapes.Path();
            myPath.Fill = Brushes.LemonChiffon;
            myPath.Stroke = b3;
            myPath.StrokeThickness = StrokeThickness;
            myPath.Data = rectangle;
            this.Children.Add(myPath);
            //文本框
            textBlock = new TextBlock();
            textBlock.TextWrapping = TextWrapping.WrapWithOverflow;
            textBlock.MaxWidth = RectangleWidth - 15;
            textBlock.MaxHeight = RectangleHeight - 10;
            {
                textBlock.Inlines.Add(new Bold(new Run("\r宗地名稱:")));
                textBlock.Inlines.Add(new Run(fieldInfo.strFieldName));
                textBlock.Inlines.Add(new Bold(new Run("\r現承包方名稱:")));
                textBlock.Inlines.Add(new Run(fieldInfo.strNowCBFName));
                textBlock.Inlines.Add(new Bold(new Run("\r現宗地号:")));
                textBlock.Inlines.Add(new Run(fieldInfo.strOriginalCde));
                textBlock.Inlines.Add(new Bold(new Run("\r宗地東至:")));
                textBlock.Inlines.Add(new Run(fieldInfo.strToEast));
                textBlock.Inlines.Add(new Bold(new Run("\r宗地西至:")));
                textBlock.Inlines.Add(new Run(fieldInfo.strToSouth));
                textBlock.Inlines.Add(new Bold(new Run("\r宗地南至:")));
                textBlock.Inlines.Add(new Run(fieldInfo.strToWest));
                textBlock.Inlines.Add(new Bold(new Run("\r宗地北至:")));
                textBlock.Inlines.Add(new Run(fieldInfo.strToNorth));
            }
            Canvas.SetLeft(textBlock, x + 10);
            Canvas.SetTop(textBlock, y + 5);
            this.Children.Add(textBlock);

            LinkBlock = new TextBlock();
            LinkBlock.Foreground = Brushes.Blue;
            LinkBlock.Inlines.Add(new Underline(new Run("Here")));
            Canvas.SetLeft(LinkBlock, x + RectangleWidthIn - 30);
            Canvas.SetTop(LinkBlock, y + RectangleHeightIn - 20);
            LinkBlock.Focusable = true;
            this.Children.Add(LinkBlock);
            LinkBlock.MouseUp += new MouseButtonEventHandler(LinkBlock_MouseUp);
        }
        public RectangleGeometry _rectangle()
        {
            return rectangle;
        }
        public TextBlock _textBlock()
        {
            return textBlock;
        }
        private void LinkBlock_MouseUp(object sender, MouseButtonEventArgs e)
        {
            ClickEvent(fieldInfo.strOriginalCde, fieldInfo.strToStageNum);
        }
    }  
           

其次我設計連接配接兩個狀态框之間的箭頭,傳入參數一樣很簡單,隻需要起始的點位和終止點位的坐标資訊即可:

//箭頭
    public partial class ProcessCanvas : Canvas
    {
        Point BeginPoint;
        Point EndPoint;
        Line myLineGeo;
        Line myEndLine;
        public ProcessCanvas(Point Begin,Point end)
        {
            BeginPoint = Begin;
            EndPoint = end;
            initLine();
        }
        public void  initLine()
        {
            double slope = (BeginPoint.X - EndPoint.X) / (BeginPoint.Y - EndPoint.Y);
            myLineGeo = new Line();
            myLineGeo.Stroke = Brushes.Blue;
            myLineGeo.StrokeThickness = 2;
            myLineGeo.X1 = BeginPoint.X;
            myLineGeo.Y1 = BeginPoint.Y;
            myLineGeo.X2 = EndPoint.X - 3 * slope;
            myLineGeo.Y2 = EndPoint.Y - 3;
            myEndLine = new Line();
            myEndLine.Stroke = Brushes.Blue;
            myEndLine.StrokeThickness = 15;
            myEndLine.X1 = EndPoint.X - 3 * slope;
            myEndLine.Y1 = EndPoint.Y - 3;
            myEndLine.X2 = EndPoint.X;
            myEndLine.Y2 = EndPoint.Y;
            myEndLine.StrokeEndLineCap = PenLineCap.Triangle;
            this.Children.Add(myLineGeo);
            this.Children.Add(myEndLine);
        }
    }     
           

接下來是做主要的畫布類,上面放置了該節點(也就是Focuse節點)的資訊,還有parents節點和children節點的資訊:

//畫布
    public partial class LayoutElement : Canvas
    {
        private LayoutElement ParentElement;
        private LayoutElement ChildrenElement;
        private string strRegCodeNow;
        private string strRegCodeOrig;
        private int intAfterTurnStage;
        define.fieldInfo FieldInfo;
        double m_horizantalGap;
        double m_verticalGap;
        double m_RectangleHeight;
        double m_RectangleWidth;
        StatusCanvas focusedStatusCanvas;//狀态框
        ProcessCanvas processCanvas;//流轉箭頭
        public delegate void ClickDelegate(string strSomeWhenRegionCodeOut, int intAfterTurnStageOut);
        public event ClickDelegate ClickEvent;
        //構造函數。focuse節點
        public LayoutElement(string RegCodeNowIn,string RegCodeOrigIn,int AfterTurnStageIn)
        {
            initLayoutElement( RegCodeNowIn, RegCodeOrigIn, AfterTurnStageIn);
        }
        //初始化
        private void initLayoutElement(string RegCodeNowIn, string RegCodeOrigIn, int AfterTurnStageIn)
        {
            strRegCodeNow = RegCodeNowIn;
            //strRegCodeOrig = RegCodeOrigIn;
            intAfterTurnStage = AfterTurnStageIn;
            ArrayList SomeWhenParentsStatus = getSomeWhenStatus(FindPareOrChild.FindParents);
            ArrayList SomeWhenChildrenStatus = getSomeWhenStatus(FindPareOrChild.FindChildren);
            Point centrol = setComposing( SomeWhenChildrenStatus.Count,SomeWhenParentsStatus.Count);
            FieldInfo = getTurnInfoByLandCode(strRegCodeNow, intAfterTurnStage);
            focusedStatusCanvas = new StatusCanvas(centrol, m_RectangleWidth, m_RectangleHeight, FieldInfo,FindPareOrChild.FindSelf);
            focusedStatusCanvas.Focusable = true;
            focusedStatusCanvas.ForceCursor = true;
            focusedStatusCanvas.ClickEvent += new StatusCanvas.ClickDelegate(focusedStatusCanvas_ClickEvent);
            this.Children.Add(focusedStatusCanvas);
            InitParents(centrol, SomeWhenParentsStatus);
            InitChildren(centrol, SomeWhenChildrenStatus);
        }
        //構造函數。父子節點
        public LayoutElement(Point tCentrolPointIn, define.fieldInfo FieldInfoIn, double RectangleWidth, double RectangleHeight, Point ArrowEndPoint, FindPareOrChild findPareOrChild)
        {
            Point tCentrolPoint = tCentrolPointIn;
            FieldInfo = FieldInfoIn;
            m_RectangleWidth = RectangleWidth;
            m_RectangleHeight = RectangleHeight;
            focusedStatusCanvas = new StatusCanvas(tCentrolPoint, m_RectangleWidth, m_RectangleHeight, FieldInfo, findPareOrChild);
            this.Children.Add(focusedStatusCanvas);
            if (tCentrolPoint.Y > ArrowEndPoint.Y)
            {
                processCanvas = new ProcessCanvas(ArrowEndPoint, new Point((tCentrolPoint.X), (tCentrolPoint.Y - RectangleHeight / 2)));
            }
            else
            {
                processCanvas = new ProcessCanvas(new Point((tCentrolPoint.X), (tCentrolPoint.Y + RectangleHeight / 2)), ArrowEndPoint);
            }
            focusedStatusCanvas.ClickEvent += new StatusCanvas.ClickDelegate(focusedStatusCanvas_ClickEvent);
            this.Children.Add(processCanvas);
        }
        //設定排版資訊中心點
        public Point setComposing(int ChildrenCount,int ParentsCount)
        {
            int maxNum;
            Point centrol;
            if (ChildrenCount > ParentsCount)
            {
                maxNum =ChildrenCount;
            }
            else
            {
                maxNum =ParentsCount;
            }
            m_horizantalGap = 50;
            m_verticalGap = 80;
            m_RectangleHeight = 190;
            m_RectangleWidth = 180;
            if (maxNum == 0)
            {
                this.Width = m_RectangleWidth;
            }
            else
            {
                this.Width = maxNum * (m_RectangleWidth + m_horizantalGap) - m_horizantalGap;
            }
            //無父節點,整體上移
            if (ParentsCount <= 0)
            {
                this.Height = m_RectangleHeight * 2 + m_verticalGap;
                centrol = new Point((this.Width / 2), (m_RectangleHeight/2));
            }
            else if (ChildrenCount <= 0)
            {
                this.Height = m_RectangleHeight * 2 + m_verticalGap;
                centrol = new Point((this.Width / 2), (this.Height - m_RectangleHeight * 0.5));
            }
            else
            {
                this.Height = m_RectangleHeight * 3 + m_verticalGap * 2;
                centrol = new Point((this.Width / 2), (this.Height / 2));
            }
            return centrol;
        }
        //初始化父節點樹
        private void InitParents(Point centrol, ArrayList SomeWhenParentsStatus)
        {
            double StatusCount = SomeWhenParentsStatus.Count;
            double couLeftMax = ((StatusCount - 1) / 2) * (m_horizantalGap + m_RectangleWidth);
            for (int ii = 0; ii < StatusCount; ii++)
            {
                double centrolPositionX = centrol.X-couLeftMax + ii * (m_horizantalGap + m_RectangleWidth);
                double centrolPositionY = centrol.Y -  (m_verticalGap + m_RectangleHeight);
                ParentElement = new LayoutElement(new Point(centrolPositionX, centrolPositionY), (define.fieldInfo)SomeWhenParentsStatus[ii], m_RectangleWidth, m_RectangleHeight, new Point((centrol.X), (centrol.Y - m_RectangleHeight / 2)),FindPareOrChild.FindParents);
                ParentElement.ClickEvent += new ClickDelegate(focusedStatusCanvas_ClickEvent);
                this.Children.Add(ParentElement);
            }
        }
        //初始化子節點樹
        private void InitChildren(Point centrol, ArrayList SomeWhenChildrenStatus)
        {
            double StatusCount = SomeWhenChildrenStatus.Count;
            double couLeftMax = ((StatusCount - 1) / 2) * (m_horizantalGap + m_RectangleWidth);
            for (int ii = 0; ii < StatusCount; ii++)
            {
                double centrolPositionX = centrol.X - couLeftMax + ii * (m_horizantalGap + m_RectangleWidth);
                double centrolPositionY = centrol.Y +  (m_verticalGap + m_RectangleHeight);
                ChildrenElement = new LayoutElement(new Point(centrolPositionX, centrolPositionY), (define.fieldInfo)SomeWhenChildrenStatus[ii], m_RectangleWidth, m_RectangleHeight, new Point((centrol.X), (centrol.Y + m_RectangleHeight / 2)),FindPareOrChild.FindChildren);
                ChildrenElement.ClickEvent += new ClickDelegate(focusedStatusCanvas_ClickEvent);
                this.Children.Add(ChildrenElement);
            }
        }
        //擷取目前宗地的父節點或子節點的資訊
        private ArrayList getSomeWhenStatus(FindPareOrChild findPareOrChild)
        {
            ArrayList SomeWhenStatus=new ArrayList();
            ArrayList SomeWhenStatusCode = new ArrayList();
            SomeWhenStatusCode = getSomeWhenCode(findPareOrChild);
            foreach (string strSomeWhenStatusCode in SomeWhenStatusCode)
            {
                if (findPareOrChild == FindPareOrChild.FindChildren)
                {
                    int intAfterTurn = intAfterTurnStage + 1;
                    if (intAfterTurn == 100000001)
                        intAfterTurn = 1;
                    SomeWhenStatus.Add(getTurnInfoByLandCode(strSomeWhenStatusCode, intAfterTurn));
                }
                else
                {
                    //通過to_stated來進行判斷,當to_stated為0時,自動轉成100000000
                    int intAfterTurn=intAfterTurnStage - 1;
                    if (intAfterTurn == 0)
                        intAfterTurn = 100000000;
                    SomeWhenStatus.Add(getTurnInfoByLandCode(strSomeWhenStatusCode, intAfterTurn));
                }

            }
            return SomeWhenStatus;
        }
        //擷取父節點或子節點的編碼清單
        private ArrayList getSomeWhenCode(FindPareOrChild findPareOrChild)
        {
            ArrayList SomeWhenStatusCode = new ArrayList();
            ContractDataConnection contractDataConnection = ContractDataConnection.getInstance();
            //select  ZDBM  from  CB_BG_LAND  where BGQZDBM ='42068311200501015J0018'  AND YZDBM='42068311200501015J0018'  AND BGID='1'
            string strSQL = "";
            if (findPareOrChild == FindPareOrChild.FindChildren)
            {
                //為初始節點時
                int intAfterTurn = intAfterTurnStage + 1;
                if (intAfterTurnStage == 100000000)
                    intAfterTurn = 1;
                strSQL = "select  ZDBM as result  from  CB_BG_LAND  where BGQZDBM =  \'" + strRegCodeNow.ToString() + "\'  AND BGID=\'" + (intAfterTurn).ToString() + "\'";
            }
            else
            {
                strSQL = "select  BGQZDBM as result  from  CB_BG_LAND  where ZDBM =  \'" + strRegCodeNow.ToString() + "\'  AND BGID=\'" + intAfterTurnStage.ToString() + "\'";
            }
            OleDbCommand oleDbCommand = new OleDbCommand(strSQL, contractDataConnection.DbConnection);
            OleDbDataAdapter oleDbDataAdapter = new OleDbDataAdapter(oleDbCommand);
            DataTable landMaxTable = new DataTable();
            try
            {
                oleDbDataAdapter.Fill(landMaxTable);
            }
            catch (System.Exception ex)
            {
                XtraMessageBox.Show(ex.ToString());
                contractDataConnection.Close();
            }
            if (landMaxTable.Rows.Count <= 0)
            {
                contractDataConnection.Close();
            }
            foreach (DataRow dr in landMaxTable.Rows)
            {
                SomeWhenStatusCode.Add(dr["result"].ToString());
            }
            return SomeWhenStatusCode;
        }
        //擷取Land表節點資訊,通過to_stated來進行判斷
        private define.fieldInfo getTurnInfoByLandCode(string strFieldCode, int turnStage)
        {
            define.fieldInfo fieldInfo = new Contract.Archive.define.fieldInfo();
            fieldInfo.strOriginalCde = "";
            ContractDataConnection contractDataConnection = ContractDataConnection.getInstance();
            //SELECT * FROM CB_LAND where ZDBM ="42068300401402009J0001" and FROM_STATEID=0
            string strSQL;
            //if (turnStage == 0)
            //{
            //    strSQL = "select *  from " + Contract.Data.ContractDefine.TABLE_CB_LAND + " where ZDBM =  '" + strFieldCode + "' and FROM_STATEID=" + turnStage;
            //}
            //else
            //{
                strSQL="select *  from " + Contract.Data.ContractDefine.TABLE_CB_LAND + " where ZDBM =  '" + strFieldCode + "' and TO_STATEID=" + turnStage;
            //}
            OleDbCommand oleDbCommand = new OleDbCommand(strSQL, contractDataConnection.DbConnection);
            OleDbDataAdapter oleDbDataAdapter = new OleDbDataAdapter(oleDbCommand);
            DataTable landMaxTable = new DataTable();
            try
            {
                oleDbDataAdapter.Fill(landMaxTable);
            }
            catch (System.Exception ex)
            {
                XtraMessageBox.Show(ex.ToString());
                contractDataConnection.Close();
                return fieldInfo;
            }
            if (landMaxTable.Rows.Count <= 0)
            {
                contractDataConnection.Close();
                return fieldInfo;
            }
            fieldInfo.strNowCBFName = CBFCodeToName(landMaxTable.Rows[0]["BFDBZJHM"].ToString());
            fieldInfo.strOriginalCde = landMaxTable.Rows[0]["ZDBM"].ToString();
            fieldInfo.strFieldName = landMaxTable.Rows[0]["ZDMC"].ToString();//宗地名稱ZDMC
            fieldInfo.strRegionCode = landMaxTable.Rows[0]["XZQDM"].ToString();//行政區代碼XZQDM
            fieldInfo.strContractType = landMaxTable.Rows[0]["CBFS"].ToString();//承包方式CBFS
            fieldInfo.strToEast = landMaxTable.Rows[0]["ZDDZ"].ToString();//東至ZDDZ
            fieldInfo.strToWest = landMaxTable.Rows[0]["ZDXZ"].ToString();//西至ZDXZ
            fieldInfo.strToNorth = landMaxTable.Rows[0]["ZDBZ"].ToString();//北至ZDBZ
            fieldInfo.strToSouth = landMaxTable.Rows[0]["ZDNZ"].ToString();//南至ZDNZ
            fieldInfo.strToStageNum = turnStage;
            return fieldInfo;
        }
        //擷取承包人姓名
        private string CBFCodeToName(string cbfCode)
        {
            Contract.Data.CBaseOleDb OleDb = new CBaseOleDb(Contract.Data.ContractDefine.TABLE_CB_CBF);
            string strSQL = " BFDBZJHM =\"" + cbfCode + "\"";
            DataRow[] dtRow = new DataRow[1];
            try
            {
                dtRow = OleDb.GetDataRow(strSQL, true);
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.ToString());
                OleDb.Close();
                return null;
            }
            OleDb.Close();
            string regionName;
            if (dtRow == null || dtRow.Count() <= 0)
                return "";
            else
            {
                regionName = dtRow[0]["CBFDBXM"].ToString();
                return regionName;
            }
        }
        //單擊節點時
        public void focusedStatusCanvas_ClickEvent(string strSomeWhenRegionCodeOut, int intAfterTurnStageOut)
        {
            ClickEvent( strSomeWhenRegionCodeOut,  intAfterTurnStageOut);
        }
    }      
           

設計一個Design類來使用這個畫布:

public class Designer : Canvas
    {
        public Designer()
        {
        }
        public void DesignerSetUp(string strSomeWhenRegionCodeOut, int intAfterTurnStageOut)
        {
            lye = null;
            lye = new LayoutElement(strSomeWhenRegionCodeOut, "", intAfterTurnStageOut);
            lye.ClickEvent += new LayoutElement.ClickDelegate(lye_ClickEvent);
            this.Children.Add(lye);
            this.Width = lye.Width;
            this.Height = lye.Height;
        }
        LayoutElement lye;
        public string strSomeWhenRegionCodeOut;
        public int intAfterTurnStageOut;
        private void lye_ClickEvent(string strSomeWhenRegionCodeOut, int intAfterTurnStageOut)
        {
            this.Children.Clear();
            lye = new LayoutElement(strSomeWhenRegionCodeOut, "", intAfterTurnStageOut);
            lye.ClickEvent += new LayoutElement.ClickDelegate(lye_ClickEvent);
            this.Children.Add(lye);
            this.Width = lye.Width;
            this.Height = lye.Height;
        }
    }
           

接下來是XAML語言,做一個WPF的UserControl控件,就可以将它拖放到你想要的窗體上使用了:

xaml語言:
<UserControl x:Class="Contract.Archive.UCCanvas"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:s="clr-namespace:Contract.Archive"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="295*" />
            <RowDefinition Height="16*" />
        </Grid.RowDefinitions>
        <ScrollViewer HorizontalScrollBarVisibility="Auto"
                      VerticalScrollBarVisibility="Auto" Grid.RowSpan="2" CanContentScroll="False">
            <s:Designer Focusable="true" x:Name="MyDesigner"
                            Margin="10" FocusVisualStyle="{x:Null}" ></s:Designer>
        </ScrollViewer>
    </Grid>
</UserControl> 
           

還有和它一起的XAML。CS的代碼:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Contract.Archive
{
    /// <summary>
    /// UCCanvas.xaml 的互動邏輯
    /// </summary>
    public partial class UCCanvas : UserControl
    {
        public UCCanvas(string strSomeWhenRegionCodeOut, int intAfterTurnStageOut)
        {
            InitializeComponent();
            this.MyDesigner.Children.Clear();
            this.MyDesigner.DesignerSetUp(strSomeWhenRegionCodeOut, intAfterTurnStageOut);
        }
        public UCCanvas()
        {
            InitializeComponent();
        }
    }
} 
           

最後是外部調用它的一小段代碼:

//輕按兩下gridControl
        private void gridView1_DoubleClick(object sender, EventArgs e)
        {
            Point pt;
            Point ptClient;
            pt = MousePosition;
            ptClient = gridControl1.PointToClient(pt);
            DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitInfo hi = this.gridView1.CalcHitInfo(ptClient);
            string strZDBM = "";
            Int32 intTurnStage=0;
            if (hi != null && hi.RowHandle >= 0)
            {
                strZDBM = this.gridView1.GetDataRow(hi.RowHandle)["初始宗地編号"].ToString();
                intTurnStage = Convert.ToInt32(this.gridView1.GetDataRow(hi.RowHandle)["變更次數"]);
                groupControl2.Visible = true;
                //新方法
                this.ucCanvas1 = new UCCanvas(strZDBM, intTurnStage);
                this.elementHost1.Child = this.ucCanvas1;
                this.elementHost1.BackColor = System.Drawing.Color.White;
            }
        }