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


C# Region.GetRegionData方法代码示例

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


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

示例1: Region_Ctor_RegionData

		public void Region_Ctor_RegionData ()
		{
			Region region = new Region (new GraphicsPath ());
			RegionData data = region.GetRegionData ();
			Region r2 = new Region (data);
			CheckEmpty ("RegionData.", region);
		}
开发者ID:nlhepler,项目名称:mono,代码行数:7,代码来源:RegionNonRectTest.cs

示例2: Region_Empty

		public void Region_Empty ()
		{
			Region region = new Region ();
			CheckEmpty ("Empty.", region);

			Region clone = region.Clone ();
			CheckEmpty ("Clone.", region);

			RegionData data = region.GetRegionData ();
			Region r2 = new Region (data);
			CheckEmpty ("RegionData.", region);
		}
开发者ID:Profit0004,项目名称:mono,代码行数:12,代码来源:TestRegion.cs

示例3: PdnRegion

        public PdnRegion(SerializationInfo info, StreamingContext context)
        {
            byte[] data = (byte[])info.GetValue("data", typeof(byte[]));

            using (Region region = new Region())
            {
                RegionData regionData = region.GetRegionData();
                regionData.Data = data;
                this.gdiRegion = new Region(regionData);
            }

            this.lockObject = new object();
            this.cachedArea = -1;
            this.cachedBounds = Rectangle.Empty;
            this.changed = true;
            this.cachedRects = null;
            this.cachedRectsF = null;
        }
开发者ID:BackupTheBerlios,项目名称:molecule-svn,代码行数:18,代码来源:PdnRegion.cs

示例4: EmptyRegion

		public void EmptyRegion ()
		{
			// note: an empty region is (for libgdiplus) a rectangular based region
			Region empty = new Region ();
			RegionData data = empty.GetRegionData ();
			Assert.IsNotNull (data.Data, "Data");
			Region region = new Region (data);
		}
开发者ID:nlhepler,项目名称:mono,代码行数:8,代码来源:RegionDataTest.cs

示例5: PathRegion

		public void PathRegion ()
		{
			GraphicsPath path = new GraphicsPath ();
			path.AddCurve (new Point[2] { new Point (1, 1), new Point (2, 2) });
			Region r = new Region (path);
			RegionData data = r.GetRegionData ();
			Assert.IsNotNull (data.Data, "Data");
			Region region = new Region (data);
			Assert.IsTrue (r.GetBounds (graphic).Equals (region.GetBounds (graphic)), "Bounds");
		}
开发者ID:nlhepler,项目名称:mono,代码行数:10,代码来源:RegionDataTest.cs

示例6: Dispose

        /*
        protected override void Dispose( bool disposing )
        {
            if( disposing )
            {
                if(components != null)
                {
                    components.Dispose();
                }
            }
            base.Dispose( disposing );
        }
        */
        protected override void OnPaint(PaintEventArgs e)
        {
            Rectangle r = ClientRectangle;
            Graphics g = e.Graphics;
            Region originalClip = new Region(g.Clip.GetRegionData());

            DrawBackground(g, r);
            g.Clip = new Region(originalClip.GetRegionData());
            DrawRows(g, r);
            g.Clip = new Region(originalClip.GetRegionData());
            DrawHeaders(g, r);
            g.Clip = new Region(originalClip.GetRegionData());
            DrawExtra(g, r);
            g.Clip = new Region(originalClip.GetRegionData());
            DrawBorder(g, r);
            g.Clip = new Region(originalClip.GetRegionData());
        }
开发者ID:vangan123,项目名称:rift-sunrise,代码行数:30,代码来源:ContainerListView.cs

示例7: CombinedPathRegion

		public void CombinedPathRegion ()
		{
			// note: seems identical to PathRegion but it test another code path inside libgdiplus
			Region r = new Region (sp1);
			r.Xor (sp2);
			RegionData data = r.GetRegionData ();
			Assert.IsNotNull (data.Data, "Data");
			Region region = new Region (data);
			Assert.IsTrue (r.GetBounds (graphic).Equals (region.GetBounds (graphic)), "Bounds");
		}
开发者ID:nlhepler,项目名称:mono,代码行数:10,代码来源:RegionDataTest.cs

示例8: ctor_RectangleF

		public void ctor_RectangleF () {
			Region r1 = new Region (rect);
			Assert.AreEqual (r.GetRegionData ().Data,
				r1.GetRegionData ().Data);
		}
开发者ID:nlhepler,项目名称:mono,代码行数:5,代码来源:Region.cs

示例9: ctor_Rectangle

		public void ctor_Rectangle () {
			Region r1 = new Region (new Rectangle ((int)rect.X, (int)rect.Y,
				(int)rect.Width, (int)rect.Height));
			Assert.AreEqual (r.GetRegionData ().Data,
				r1.GetRegionData ().Data);
		}
开发者ID:nlhepler,项目名称:mono,代码行数:6,代码来源:Region.cs

示例10: ctor_RegionData

		public void ctor_RegionData () {
			RegionData rgnData = r.GetRegionData ();
			Region r1 = new Region (rgnData);
			Assert.AreEqual (rgnData.Data, r1.GetRegionData ().Data);
		}
开发者ID:nlhepler,项目名称:mono,代码行数:5,代码来源:Region.cs

示例11: LoadData

        public void LoadData(string path)
        {
            Console.WriteLine("LoadData >>");
            System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
            doc.Load(path);
            XmlNodeList dataNodes = doc.GetElementsByTagName("data");
            if (dataNodes.Count > 0)
            {
                XmlNode dataNode = dataNodes[0];
                int x = 0;
                int y = 0;
                int w = 0;
                int h = 0;
                if (dataNode.Attributes["x"] != null && dataNode.Attributes["y"] != null)
                {
                    x = Int32.Parse(dataNode.Attributes["x"].Value);
                    y = Int32.Parse(dataNode.Attributes["y"].Value);
                }
                if (dataNode.Attributes["width"] != null && dataNode.Attributes["height"] != null)
                {
                    w = Int32.Parse(dataNode.Attributes["width"].Value);
                    h = Int32.Parse(dataNode.Attributes["height"].Value);
                }
                x = x < 0 ? 0 : x;
                x = (x + w) > Screen.PrimaryScreen.WorkingArea.Width ? Screen.PrimaryScreen.WorkingArea.Width - w : x;
                y = y < 0 ? 0 : y;
                y = (y + h) > Screen.PrimaryScreen.WorkingArea.Height ? Screen.PrimaryScreen.WorkingArea.Height - h : y;
                this.Location = new Point(x, y);
                this.Size = new Size(w, h);

                if (dataNode.Attributes["bgcolor"] != null)
                {
                    try
                    {
                        this.mBgColor = Color.FromArgb(Int32.Parse(dataNode.Attributes["bgcolor"].Value));
                    }
                    catch (Exception e)
                    {
                        this.mBgColor = Color.Wheat;
                    }
                }
            }
            XmlNodeList strokeNodes = doc.GetElementsByTagName("stroke");
            if (strokeNodes.Count > 0)
            {
                XmlNode strokeNode = strokeNodes[0];
                XmlCDataSection cdata_stroke = (XmlCDataSection)strokeNode.FirstChild;
                byte[] decoded = System.Convert.FromBase64String(cdata_stroke.Data);
                mInkPicture.Ink.Load(decoded);
                mInkPicture.Refresh();
            }

            XmlNodeList imageNodes = doc.GetElementsByTagName("image");
            foreach(XmlNode imageNode in imageNodes)
            {
                Bitmap bmp = null;
                Region rgn = null;
                Point loc = new Point();
                Point[] ptPolygon = null;
                loc.X = Int32.Parse(imageNode.Attributes["x"].Value);
                loc.Y = Int32.Parse(imageNode.Attributes["y"].Value);

                foreach(XmlNode node in imageNode.ChildNodes)
                {
                    if (node.Name == "region")
                    {
                        XmlCDataSection cdata_region = (XmlCDataSection)node.FirstChild;
                        byte[] decoded = System.Convert.FromBase64String(cdata_region.Data);
                        Region regionTmp = new Region();
                        System.Drawing.Drawing2D.RegionData region2Data = regionTmp.GetRegionData();
                        region2Data.Data = decoded;
                        rgn = new Region(region2Data);
                        regionTmp.Dispose();
                    }
                    else if (node.Name == "polygon")
                    {
                        string[] xdata = null;
                        string[] ydata = null;
                        foreach (XmlNode c in node.ChildNodes)
                        {
                            if(c.Name == "xdata")
                            {
                                xdata = c.InnerText.Split(',');
                            }
                            else if (c.Name == "ydata")
                            {
                                ydata = c.InnerText.Split(',');
                            }
                        }
                        if (xdata != null && ydata != null)
                        {
                            int count = xdata.Length;
                            ptPolygon = new Point[count];
                            for (int i = 0; i < count; i++)
                            {
                                int x = Convert.ToInt32(xdata[i]);
                                int y = Convert.ToInt32(ydata[i]);
                                ptPolygon[i] = new Point(x, y);
                            }
                        }
//.........这里部分代码省略.........
开发者ID:stndstn,项目名称:InkNote,代码行数:101,代码来源:FormNote.cs

示例12: PaintSelection

        // Paints the selection.
        void PaintSelection( Region rgn )
        {
            if (null == rgn) return;

             Region rgnPaint = new Region( rgn.GetRegionData() );
             if (null != _rgnSelLast) {
            rgnPaint.Exclude(_rgnSelLast);
             }

             lock(_mapLock) {
            using (var g = picMap.CreateGraphics()) {
               Brush br = new SolidBrush(CR_SELECTION);
               g.FillRegion(br, rgnPaint);
            }
             }

             _rgnSelLast = new Region(rgn.GetRegionData());
        }
开发者ID:jbirkel,项目名称:MapRL,代码行数:19,代码来源:Form1.cs


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