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


C# PointF.SetValue方法代码示例

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


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

示例1: CreateCanvas

        private static void CreateCanvas(string baseurl, string geohex, IEnumerable<TileInfo> tiles, int width, int height, float hexLeft, float hexTop, int[] cols, int[] rows, bool isBase)
        {
            //create an object that will do the drawing operations
            int x = 0;
            int y = 0;
            int count = 0;
            int col = 0;
            int row = 0;
            string tile = string.Empty;

            using (var canvas = new Bitmap(width, height))
            {
                using (var artist = Graphics.FromImage(canvas))
                {
                    artist.InterpolationMode = InterpolationMode.HighQualityBicubic;
                    foreach (TileInfo tileInfo in tiles.OrderBy(t => t.Index.Col).ThenByDescending(t => t.Index.Row))
                    {
                        if (count > 0)
                        {
                            x = Array.IndexOf(cols, tileInfo.Index.Col) * 256;
                            y = Array.IndexOf(rows, tileInfo.Index.Row) * 256;
                        }

                        tile = string.Format("{0}/{1}/{2}/{3}.png", baseurl, tileInfo.Index.Level, tileInfo.Index.Col, tileInfo.Index.Row);
                        //System.Diagnostics.Debug.WriteLine(tile);

                        var request = WebRequest.Create(tile);
                        using (var response = request.GetResponse())
                        {
                            using (var stream = response.GetResponseStream())
                            {
                                var imageTile = Bitmap.FromStream(stream);
                                artist.DrawImage(imageTile, new PointF(x, y));
                            }
                        }

                        col = tileInfo.Index.Col;
                        row = tileInfo.Index.Row;
                        count++;
                    }

                    //Dibujo el Hexágono
                    if (includeHexagon)
                    {
                        PointF[] points = new PointF[7];
                        points.SetValue(new PointF(hexLeft + 0, hexTop + 32f), 0);
                        points.SetValue(new PointF(hexLeft + 19f, hexTop + 0), 1);
                        points.SetValue(new PointF(hexLeft + 54f, hexTop + 0), 2);
                        points.SetValue(new PointF(hexLeft + 73f, hexTop + 32f), 3);
                        points.SetValue(new PointF(hexLeft + 54f, hexTop + 64f), 4);
                        points.SetValue(new PointF(hexLeft + 19f, hexTop + 64f), 5);
                        points.SetValue(new PointF(hexLeft + 0, hexTop + 32f), 6);

                        SolidBrush fillbrush = new SolidBrush(Color.FromArgb(0, 255, 165, 0));
                        SolidBrush borderbrush = new SolidBrush(Color.FromArgb(255, 0, 128, 0));
                        artist.FillPolygon(fillbrush, points);
                        artist.DrawPolygon(new Pen(borderbrush, 5), points);
                        artist.Save();
                    }
                }
                try
                {
                    //Crop y Márgenes
                    int rectx = 0;
                    if (width > 256)
                    {
                        rectx = (int)hexLeft - 74;
                    }

                    if (rectx < 0)
                        rectx = 0;

                    int recty = 0;
                    if (height > 256)
                    {
                        recty = (int)hexTop - 80;
                    }

                    if (recty < 0)
                        recty = 0;

                    Rectangle cropArea = new Rectangle(rectx, recty, 256, 256);


                    string filePath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "SatelliteImages", includeHexagon ? "demand" : "game1", string.Format("{0}{1}.jpg", geohex, isBase ? "-a" : "-d"));
                    using (Bitmap canvasCropped = canvas.Clone(cropArea, canvas.PixelFormat))
                    {
                        //canvasCropped.Save(filePath, ImageFormat.Jpeg);
                        canvasCropped.Save(filePath, jgpEncoder, myEncoderParameters);
                    }

                    //Quedo obsoleto al no tener que usar Azure
                    /*
                    //Azure Blob
                    string filePath = string.Format("{0}{1}.jpg", geohex, isBase ? "-a" : "-d");
                    CloudBlockBlob blockBlob = container.GetBlockBlobReference(filePath);
                    // Create or overwrite the "myblob" blob with contents from a local file.
                    using (var fileStream = new System.IO.MemoryStream())
                    {
                        using (Bitmap canvasCropped = canvas.Clone(cropArea, canvas.PixelFormat))
//.........这里部分代码省略.........
开发者ID:HackatonArGP,项目名称:Guardianes,代码行数:101,代码来源:ImagesGeneratorTool.cs

示例2: Generate2D

        /// <summary>
        /// Generate 2D data for preview pane.
        /// </summary>
        private void Generate2D()
        {
            ArrayList tempArray = new ArrayList();
            double xMin = 0;
            double xMax = 0;
            double yMin = 0;
            double yMax = 0;

            foreach (Curve c in Profile)
            {
               List<XYZ> xyzArray = c.Tessellate() as List<XYZ>;
               foreach (Autodesk.Revit.DB.XYZ xyz in xyzArray)
                {
                    Autodesk.Revit.DB.XYZ temp = new Autodesk.Revit.DB.XYZ (xyz.X, -xyz.Y, xyz.Z);
                    FindMinMax(temp, ref xMin, ref xMax, ref yMin, ref yMax);
                    tempArray.Add(temp);
                }
            }

            MaxLength = ((xMax - xMin) > (yMax - yMin)) ? (xMax - xMin) : (yMax - yMin);

            Points = new PointF[tempArray.Count / 2 + 1];
            for (int i = 0; i < tempArray.Count; i = i + 2)
            {
                Autodesk.Revit.DB.XYZ point = (Autodesk.Revit.DB.XYZ)tempArray[i];
                Points.SetValue(new PointF((float)(point.X - xMin), (float)(point.Y - yMin)), i / 2);
            }
            PointF end = (PointF)Points.GetValue(0);
            Points.SetValue(end, tempArray.Count / 2);
        }
开发者ID:AMEE,项目名称:revit,代码行数:33,代码来源:Data.cs


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