• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Grid类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Grid的典型用法代码示例。如果您正苦于以下问题:C# Grid类的具体用法?C# Grid怎么用?C# Grid使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Grid类属于命名空间,在下文中一共展示了Grid类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: HeatMapUpdater

	public HeatMapUpdater(int _index,Node[] _nodes,Grid _grid){
		index = _index;
		nodes = _nodes;
		grid = _grid;
		a = new Thread(UpdateHeatMap);
		a.Start();
	}
开发者ID:Cestt,项目名称:Swarmpositorio,代码行数:7,代码来源:HeatMapUpdater.cs


示例2: Init

 public void Init(Legs legs,Grid grid)
 {
     base.Init(legs);
     this.grid = grid;
     this.auxiliarySteering = new Arrive();
     this.auxiliarySteering.Init(getLegs());
 }
开发者ID:Syclamoth,项目名称:GamesAI6,代码行数:7,代码来源:PathfindToPoint.cs


示例3: Square

    public Vector3 wloc; // 3D location coordinates in Unity's world units

    #endregion Fields

    #region Constructors

    public Square(Grid gr, Vector2 loc, Vector3 wloc)
    {
        this.plane = GameObject.CreatePrimitive(PrimitiveType.Plane);
        plane.name = "Grid plane";
        plane.transform.position = wloc;
        plane.transform.localScale = new Vector3(0.1f, 1.0f, 0.1f);
        plane.transform.Rotate(-90.0f, 0.0f, 0.0f);
        plane.renderer.material.mainTexture = Resources.Load("Textures/Tile2") as Texture;
        plane.renderer.material.color = Color.white;
        colors = new Dictionary<Color, int>();
        colors[Color.red] = 0;
        colors[Color.green] = 0;
        colors[Color.blue] = 0;
        colors[Color.yellow] = 0;
        this.loc = loc;
        this.wloc = wloc;
        objects = new List<GameObject>();
        board = new Square[8];
        int count = 0;
        for(int xof = -1; xof <= 1; xof++) {
            for(int yof = -1; yof <= 1; yof++) {
                int x = (int)loc.x;
                int y = (int)loc.y;
                if(!(xof == 0 && yof == 0)) {
                    if(x+xof >= 0 && x+xof < gr.width && y+yof >= 0 && y+yof < gr.height)
                        board[count] = gr.grid[x+xof, y+yof];
                    count++;
                }
            }
        }
    }
开发者ID:oshoham,项目名称:RPFOD2,代码行数:37,代码来源:Square.cs


示例4: CreateControls

        /// <summary>Creates the UI elements for the given HTML node and HTML view.</summary>
        /// <param name="node">The HTML node.</param>
        /// <param name="htmlView">The HTML view.</param>
        /// <returns>The UI elements.</returns>
        public DependencyObject[] CreateControls(HtmlNode node, IHtmlView htmlView)
        {
            var controls = new List<Grid>();
            foreach (var child in node.Children.OfType<HtmlTagNode>().Where(c => c.Name == "li"))
            {
                var grid = new Grid();
                grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(20)});
                grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) });

                var textBlock = CreateBulletSymbol(htmlView);
                                grid.Children.Add(textBlock);
                Grid.SetColumn(textBlock, 0);

                var panel = new StackPanel();

                child.WrapWithHtmlTag();
                foreach (var c in child.GetChildControls(htmlView).OfType<UIElement>())
                {
                    var frameworkElement = c as FrameworkElement;
                    if (frameworkElement != null)
                        frameworkElement.HorizontalAlignment = HorizontalAlignment.Stretch;

                    panel.Children.Add(c);
                }

                grid.Children.Add(panel);
                Grid.SetColumn(panel, 1);

                controls.Add(grid);
            }

            AdjustMargins(htmlView, controls);
            return controls.OfType<DependencyObject>().ToArray();
        }
开发者ID:RareNCool,项目名称:MyToolkit,代码行数:38,代码来源:UlGenerator.cs


示例5: GenerateGrounds

    //FOR N_Back!
    public void GenerateGrounds(Grid grid, TerrainChunk tc, int y = 0, 
	                             bool ceiling = false)
    {
        // Generate ground and potholes
        //First and last cannot be a hole.
        for (int i = 0; i < grid.numCellsX; ++i) {
            if (grid.containsObject(i, y)) {
                continue;
            }

            //level is chance that there is a hole! Do not spawnground!
            //int rand = Random.Range (0, 101);

            //if(!(i ==0 || i == grid.numCellsX))
            //{
            if (initCeiling == 0) {
                initCeiling++;
                continue;
            }
            //}

            // Generate random width ground pieces varying from 1-3
            int cap, roll;
            do {
                //cap = Mathf.Min (4, grid.numCellsX - i + 1);
                roll = 3;
            } while (!GenerateWideGround(i, y, roll, grid, tc, ceiling));
        }
    }
开发者ID:nchou001,项目名称:NC-Popz,代码行数:30,代码来源:GroundGenerator.cs


示例6: GetVisualParents

        public void GetVisualParents() {
#endif
            Grid grid = new Grid();
            ContentControl contentControl = new ContentControl();
            TextBox textBox;
            Window.Content = grid;
            grid.Children.Add(contentControl);
            contentControl.ContentTemplate = textBoxTemplate;
#if NETFX_CORE
            await
#endif
            EnqueueShowWindow();
            EnqueueCallback(() => {
                textBox = (TextBox)LayoutHelper.FindElement(contentControl, x => x is TextBox);
                Assert.AreSame(contentControl, LayoutTreeHelper.GetVisualParents(textBox).Where(x => x is ContentControl).First());
                Assert.AreSame(grid, LayoutTreeHelper.GetVisualParents(textBox).Where(x => x is Grid).First());
                Assert.AreSame(Window, LayoutTreeHelper.GetVisualParents(textBox).Where(x => x.GetType() == Window.GetType()).First());

                Assert.AreSame(contentControl, LayoutTreeHelper.GetVisualParents(textBox, contentControl).Where(x => x is ContentControl).First());
                Assert.IsNull(LayoutTreeHelper.GetVisualParents(textBox, contentControl).Where(x => x is Grid).FirstOrDefault());

                var presenter = LayoutTreeHelper.GetVisualChildren(contentControl).First();
                Assert.IsTrue(new[] { presenter }.SequenceEqual(LayoutTreeHelper.GetVisualParents(textBox, presenter)));
            });
            EnqueueTestComplete();
        }
开发者ID:sk8tz,项目名称:DevExpress.Mvvm.Free,代码行数:26,代码来源:LayoutTreeHelperTests.cs


示例7: Calling_AutoGenerateColumns_should_add_columns

        public void Calling_AutoGenerateColumns_should_add_columns()
        {
            IGrid<Person> grid = new Grid<Person>(new Person[0], new ViewContext());
            grid.AutoGenerateColumns();

            ((Grid<Person>)grid).Model.Columns.Count.ShouldEqual(2);
        }
开发者ID:atomicobject,项目名称:mvccontrib,代码行数:7,代码来源:AutoColumnBuilderTester.cs


示例8: Grid_SetsName

        public void Grid_SetsName()
        {
            String actual = new Grid<GridModel>(new GridModel[0]).Name;
            String expected = "Grid";

            Assert.Equal(expected, actual);
        }
开发者ID:NonFactors,项目名称:MVC6.Grid,代码行数:7,代码来源:GridTests.cs


示例9: Generate

            public override TerrainGrid Generate(Vector size, FreqDict freqs = null, Random rand = null)
            {
                freqs = freqs ?? _defaultFreqs;
                UpdateFreqs(ref freqs);
                NormalizeFreqs(ref freqs);

                rand = rand ?? new Random();

                var terrain = new Grid<TerrainType>(size);

                var heightGrid = _topographyGenerator.Generate(terrain.Size, rand);
                heightGrid = _filters.OpenClose(heightGrid);
                var sortedPoints = heightGrid.GetPoints().ToList();
                sortedPoints.Sort((lhs, rhs) => (heightGrid[lhs] - heightGrid[rhs]));

                int numTiles = size.x * size.y;
                int numWaterTiles = (int)(numTiles * freqs[TerrainTypes.Water]);
                var waterTiles = sortedPoints.Take(numWaterTiles);
                foreach (var point in waterTiles)
                    terrain[point] = TerrainTypes.Water;

                int numMountainTiles = (int)(numTiles * freqs[TerrainTypes.Mountain]);
                var mountainTiles = sortedPoints.Skip(numTiles - numMountainTiles);
                foreach (var point in mountainTiles)
                    terrain[point] = TerrainTypes.Mountain;

                var landTiles = new HashSet<Vector>(terrain.GetPoints());
                landTiles.ExceptWith(waterTiles);
                landTiles.ExceptWith(mountainTiles);

                AddLandTiles(ref terrain, landTiles.ToList(), freqs, rand);

                return terrain;
            }
开发者ID:jonkensta,项目名称:KnightGame,代码行数:34,代码来源:Generators.cs


示例10: Start

 void Start()
 {
     _root = (Grid)GetComponent<NoesisGUIPanel>().GetContent();
     _root.ManipulationStarting += this.ManipulationStarting;
     _root.ManipulationInertiaStarting += this.ManipulationInertiaStarting;
     _root.ManipulationDelta += this.ManipulationDelta;
 }
开发者ID:nastajus,项目名称:Tutorials,代码行数:7,代码来源:Touch.cs


示例11: Grid_SetsSource

        public void Grid_SetsSource()
        {
            IQueryable<GridModel> expected = new GridModel[2].AsQueryable();
            IQueryable<GridModel> actual = new Grid<GridModel>(expected).Source;

            Assert.Same(expected, actual);
        }
开发者ID:NonFactors,项目名称:MVC6.Grid,代码行数:7,代码来源:GridTests.cs


示例12: Init

		protected override void Init ()
		{
			var rootGrid = new Grid {
				RowDefinitions = new RowDefinitionCollection
														  {
															 new RowDefinition { Height = new GridLength(1, GridUnitType.Star) },
															 new RowDefinition { Height = new GridLength(1, GridUnitType.Auto) },
														 },
			};


			_mainContent = new ContentView { Content = new ScrollView { Content = new Label { Text = Description } } };
			rootGrid.AddChild (_mainContent, 0, 0);


			var buttons = new StackLayout { Orientation = StackOrientation.Horizontal };

			var button1A = new Button { Text = "View 1A" };
			button1A.Clicked += (sender, args) => ShowView (_view1A);
			buttons.Children.Add (button1A);

			var button1B = new Button { Text = "View 1B" };
			button1B.Clicked += (sender, args) => ShowView (_view1B);
			buttons.Children.Add (button1B);

			var button2 = new Button { Text = "View 2" };
			button2.Clicked += (sender, args) => ShowView (_view2);
			buttons.Children.Add (button2);

			rootGrid.AddChild (buttons, 0, 1);


			Content = rootGrid;
		}
开发者ID:Costo,项目名称:Xamarin.Forms,代码行数:34,代码来源:Bugzilla27642.cs


示例13: AddDetailGrid

    protected void AddDetailGrid(Grid grid)
    {
        DetailGrid detail = new DetailGrid();
        detail.ID = "grid" + level.ToString();
        detail.AutoGenerateColumns = false;
        detail.Serialize = false;
        detail.AllowPageSizeSelection = false;
        detail.AllowPaging = false;
        detail.PageSize = -1;
        detail.AllowAddingRecords = true;
        detail.Width = Unit.Percentage(97);

        detail.ForeignKeys = "CategoryID";

        detail.ClientSideEvents.ExposeSender = true;
        detail.ClientSideEvents.OnClientPopulateControls = "onPopulateControls";
        detail.ClientSideEvents.OnBeforeClientDelete = "onBeforeClientDelete";

        foreach (Column column in grid.Columns)
        {
            Column newColumn = column.Clone() as Column;
            newColumn.SortOrder = SortOrderType.None;
            detail.Columns.Add(newColumn);
        }

        detail.MasterDetailSettings = grid.MasterDetailSettings;

        detail.DataSourceNeeded += Grid1_DataSourceNeeded;
        detail.InsertCommand += Grid1_InsertCommand;
        detail.UpdateCommand += Grid1_UpdateCommand;
        detail.DeleteCommand += Grid1_DeleteCommand;

        grid.DetailGrids.Add(detail);
    }
开发者ID:veraveramanolo,项目名称:power-show,代码行数:34,代码来源:aspnet_master_detail_self_reference.aspx.cs


示例14: Grid_Encode

        public void Grid_Encode()
        {
            Mapnik.RegisterDatasource(Path.Combine(Mapnik.Paths["InputPlugins"], "shape.input"));
            Map m = new Map(256, 256);
            m.Load(@".\data\test.xml");
            m.ZoomAll();
            Grid g = new Grid(256, 256);
            var options = new Dictionary<string, object>()
            {
                {"Fields", new List<string>() { "FIPS" } },
                {"Layer", "world" }
            };

            m.Render(g, options);
            Dictionary<string, object> UTFGridDict = g.Encode();

            Assert.AreEqual(UTFGridDict.Keys.Count, 3);

            //Test for keys
            List<string> keyList = (List<string>)UTFGridDict["keys"];
            Assert.AreNotEqual(keyList.Count, 0);

            //Test for data
            Dictionary<string, object> dataDict = (Dictionary<string, object>)UTFGridDict["data"];
            Assert.AreNotEqual(dataDict.Count, 0);

            //data count should equal keys + 1
            Assert.AreEqual(keyList.Count, dataDict.Count + 1);
        }
开发者ID:rouen-sk,项目名称:NET-Mapnik,代码行数:29,代码来源:GridTests.cs


示例15: GridCellInstantiationTest

        public void GridCellInstantiationTest()
        {
            Grid grid;

            // Assert each cell in grid is instantiated and initialized with expected default chemical concentrations
            grid = new Grid(4);
            for (int column = 0; column < grid.Size; column++)
            {
                for (int row = 0; row < grid.Size; row++)
                {
                    Assert.AreEqual(grid[column, row]["A"], 0);
                    Assert.AreEqual(grid[column, row]["B"], 0);
                }
            }

            // Assert each cell in grid is instantiated and initialized with given chemical concentrations
            Cell cell = new Cell
            {
                { "A", 0.25 },
                { "B", 0.75 }
            };
            grid = new Grid(4, cell);
            for (int column = 0; column < grid.Size; column++)
            {
                for (int row = 0; row < grid.Size; row++)
                {
                    Assert.AreEqual(grid[column, row]["A"], 0.25);
                    Assert.AreEqual(grid[column, row]["B"], 0.75);
                }
            }
        }
开发者ID:Clarksj4,项目名称:GrayScottDiffusionReaction,代码行数:31,代码来源:GridTests.cs


示例16: Grid_Key

 public void Grid_Key()
 {
     Grid g = new Grid(256, 256);
     Assert.AreEqual("__id__", g.Key);
     g.Key = "key";
     Assert.AreEqual("key", g.Key);
 }
开发者ID:rouen-sk,项目名称:NET-Mapnik,代码行数:7,代码来源:GridTests.cs


示例17: Click

 public override void Click(float mouseX, float mouseY, int gridX, int gridY, Grid grid, GridPiece piece)
 {
     if (piece == null)
     {
         grid.AddPiece(new Battery(new ChargeColor(R, G, B)), gridX, gridY);
     }
 }
开发者ID:LukaHorvat,项目名称:Electric,代码行数:7,代码来源:BatteryPlacer.cs


示例18: Init

        protected override void Init()
        {
            var label = new Label { Text = "Label" };
            var entry = new Entry { AutomationId = "entry" };
            var grid = new Grid();

            grid.Children.Add(label, 0, 0);
            grid.Children.Add(entry, 1, 0);
            var tableView = new TableView
            {
                Root = new TableRoot
                {
                    new TableSection
                    {
                        new ViewCell
                        {
                            View = grid
                        }
                    }
                }
            };

            Content = new StackLayout
            {
                Children = { tableView }
            };
        }
开发者ID:Costo,项目名称:Xamarin.Forms,代码行数:27,代码来源:Bugzilla36559.cs


示例19: AddPages

    public static void AddPages(TabControl tabControl, string tabName, bool maxSize, params Page[] pages)
    {
        Grid grid = new Grid();
        grid.Width = double.NaN;
        grid.Height = double.NaN;
        grid.Margin = new Thickness(0);
        grid.VerticalAlignment = VerticalAlignment.Top;

        if (maxSize)
        {
            grid.HorizontalAlignment = HorizontalAlignment.Stretch;
            grid.VerticalAlignment = VerticalAlignment.Stretch;
        }

        int index = 0;
        foreach (var item in pages)
        {
            ColumnDefinition col = new ColumnDefinition();
            col.Width = GridLength.Auto;
            grid.ColumnDefinitions.Add(col);
            SetPageToGrid(item, grid, 0, index);
            index++;
        }

        TabItem tabItem = new TabItem();
        tabItem.Header = tabName;
        tabItem.Content = grid;
        tabControl.Items.Add(tabItem);
    }
开发者ID:vesteksoftware,项目名称:VT5025,代码行数:29,代码来源:UIUtility.cs


示例20: Find

            public override HashSet<Vector> Find(TerrainGrid terrain)
            {
                var interestPoints = new HashSet<Vector>();

                var blocking = new Grid<bool>(terrain.Size);
                foreach (var point in terrain.GetPoints())
                {
                    var terrainType = terrain[point];
                    blocking[point] = TerrainTypes.Blocking.Contains(terrainType);
                }

                blocking = _filters.Close(blocking);

                var areas = _areaFinder.Find(blocking).ToList();
                areas.RemoveAll((area) => area.Count <= 20);
                foreach (var area in areas)
                {
                    var areaList = area.ToList();
                    int xMean = (int)areaList.Average((p) => p.x);
                    int yMean = (int)areaList.Average((p) => p.y);
                    Vector centroid = new Vector(xMean, yMean);
                    interestPoints.Add(centroid);
                }

                return interestPoints;
            }
开发者ID:jonkensta,项目名称:KnightGame,代码行数:26,代码来源:InterestPoint.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# GridCell类代码示例发布时间:2022-05-24
下一篇:
C# GreyedOutTooltipCallback类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap