当前位置: 首页>>代码示例>>C#>>正文


C# TextBox.Layout方法代码示例

本文整理汇总了C#中TextBox.Layout方法的典型用法代码示例。如果您正苦于以下问题:C# TextBox.Layout方法的具体用法?C# TextBox.Layout怎么用?C# TextBox.Layout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TextBox的用法示例。


在下文中一共展示了TextBox.Layout方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Render

    public void Render()
    {
        items = new List<CanvasItem>();
        lifeLines = new List<LifeLine>();
        Dictionary<string, LifeLine> llDict = new Dictionary<string, LifeLine>();
        double x_where = 50.5;
        double y_step = 25;
        y_current = 0;

        width = 0;
        height = 0;

        foreach(ElemObj elem in diagram.elements)
        {
            TextBox tb = new TextBox();
            tb.YTop = 10.5;
            tb.XCenter = x_where;
            x_where += 100;
            width += 100;
            tb.Width = 70;
            tb.BorderWidth = 3;
            tb.Text = elem.text;

            tb.Layout(cr);
            items.Add(tb);
            LifeLine ll = new LifeLine(elem.label, this, tb.XCenter, tb.Y1);
            lifeLines.Add(ll);
            llDict.Add(elem.label, ll);
            if(tb.Y1 > YCurrent)
            {
                YCurrent = tb.Y1;
            }
        }

        foreach(Step step in diagram.sequence)
        {
            if(step.amount == 0)
            {
                step.amount = (int)y_step;
            }

            YCurrent += step.amount;

            foreach(LifeLine ll in lifeLines)
            {
                ll.BeforeActivations();
            }

            foreach(Activation a in step.activations)
            {
                LifeLine ll = llDict[a.label];

                if(a.on)
                {
                    ll.Activate();
                }
                else
                {
                    ll.Deactivate();
                }
            }

            foreach(LifeLine ll in lifeLines)
            {
                ll.AfterActivations();
            }

            foreach(Arrow arrow in step.arrows)
            {
                TextArrow ta;
                LifeLine to = llDict[arrow.to];
                LifeLine from = llDict[arrow.from];

                if(to != from)
                {
                    ta = new TextArrow();
                    bool right = to.X > from.X;
                    ta.Y0 = YCurrent;
                    if(right)
                    {
                        ta.X0 = from.XRightAfter;
                        ta.X1 = to.XLeftAfter;
                        ta.XText = from.XClearRight;
                    }
                    else
                    {
                        ta.X0 = from.XLeftAfter;
                        ta.X1 = to.XRightAfter;
                        ta.XText = from.XClearLeft;
                    }
                }
                else
                {
                    SelfTextArrow sta = new SelfTextArrow();
                    sta.Y0 = YCurrent - 10;
                    sta.Y1 = YCurrent;
                    sta.X0 = from.XRightBefore;
                    sta.X0b = from.XRightAfter;
                    sta.X1 = from.XRightBefore + 30;
                    sta.XText = from.XClearRight;
//.........这里部分代码省略.........
开发者ID:jonasoster,项目名称:smul,代码行数:101,代码来源:DiagramRenderer.cs


注:本文中的TextBox.Layout方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。