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


C# Ellipse.MoveNext方法代码示例

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


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

示例1: Window_Loaded


//.........这里部分代码省略.........

                colors[i / COLOR_NUM_PER_SEGMENT].Add(cp);

                Ellipse e = new Ellipse();
                e.Fill = new SolidColorBrush(c);
                e.Height = 16;
                e.Width = 16;

            #if DISP_ASTAR_LSTAR
                // a*L*平面
                var pos = new Thickness((lab.a) * 10 + originOffsetX, (-lab.L) * 10 + originOffsetY, 0, 0);
            #else
                // a*b*平面
                var pos = new Thickness((lab.a) * 10 + originOffsetX, (-lab.b) * 10 + originOffsetY, 0, 0);
            #endif

                e.Margin = pos;
                canvas1.Children.Add(e);
                Canvas.SetZIndex(e, -1);

                bool collision = false;
                int hashValue = r * 65536 + g * 256 + b;
                if (rgbHash.Contains(hashValue)) {
                    collision = true;
                }
                rgbHash.Add(hashValue);

                Label l = new Label();
                l.Content = string.Format("{0}", i + 1);
                l.FontSize = 8;
                l.Foreground = new SolidColorBrush(Colors.White);

                l.Margin = pos;
                if (collision) {
                    l.Margin = new Thickness(pos.Left, pos.Top + l.FontSize, pos.Right, pos.Bottom);
                }

                canvas1.Children.Add(l);
            }

            for (int segment = 0; segment < SEGMENT_NUM; ++segment) {
                for (int i = 0; i < COLOR_NUM_PER_SEGMENT; ++i) {
                    var cpFrom = colors[segment].ElementAt(i);
                    var cpSort = new Dictionary<float, ColorPatch>();
                    for (int j = 0; j < COLOR_NUM_PER_SEGMENT; ++j) {
                        if (i == j) {
                            continue;
                        }
                        var cpTo = colors[segment].ElementAt(j);
                        cpSort.Add(cpFrom.lab.DistanceSquared(cpTo.lab), cpTo);
                    }

                    var sorted = (from entry in cpSort orderby entry.Key ascending select entry).ToDictionary(pair => pair.Key, pair => pair.Value);
                    var e = sorted.GetEnumerator();
                    e.MoveNext();
                    cpFrom.neighbor = e.Current.Value;
                    e.MoveNext();
                    cpFrom.neighbor2 = e.Current.Value;
                    e.MoveNext();
                    cpFrom.neighbor3 = e.Current.Value;
                }
            }

            Console.WriteLine("graph g {");
            Console.WriteLine("    graph [bgcolor=\"#484848\"]");
            Console.WriteLine("    node [style=filled, fontsize=32, fontcolor=white]");
            Console.WriteLine("    edge [fontsize=32, fontcolor=white]");
            Console.WriteLine("    rankdir=LR;");

            for (int segment = 0; segment < SEGMENT_NUM; ++segment) {
                Console.WriteLine("    subgraph cluster{0} {{", segment);
                Console.WriteLine("        style=invis;");

                for (int i = 0; i < COLOR_NUM_PER_SEGMENT; ++i) {
                    var cp = colors[segment].ElementAt(i);

                    string shape = "color=\"#484848\", shape=ellipse";
                    if (i == 0 || i == COLOR_NUM_PER_SEGMENT - 1) {
                        shape = ", color=white, shape=doublecircle";
                    }

                    Console.WriteLine("        {4} [fillcolor=\"#{0:x2}{1:x2}{2:x2}\"{3}];",
                        (int)(cp.rgb.r),
                        (int)(cp.rgb.g),
                        (int)(cp.rgb.b),
                        shape,
                        cp.id + 1); //< ★★★★★ 要注意 1足して表示 ★★★★★
                }

                for (int i = 0; i < COLOR_NUM_PER_SEGMENT; ++i) {
                    var cp = colors[segment].ElementAt(i);
                    WriteLink(segment * COLOR_NUM_PER_SEGMENT, colors[segment], cp.id, cp.neighbor.id,  "style=bold,  ");
                    WriteLink(segment * COLOR_NUM_PER_SEGMENT, colors[segment], cp.id, cp.neighbor2.id, "             ");
                    WriteLink(segment * COLOR_NUM_PER_SEGMENT, colors[segment], cp.id, cp.neighbor3.id, "style=dotted,");
                }
                Console.WriteLine("    }");
            }

            Console.WriteLine("}");
        }
开发者ID:kekyo,项目名称:PlayPcmWin,代码行数:101,代码来源:MainWindow.xaml.cs


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