Exemplo n.º 1
0
        private bool AddRegion(TRegion Region)
        {
            if (m_xOverlay != null)
            {
                float[] p       = Region.p;
                XRegion xRegion = new XRegion(Region.m_eRShape, p[0], p[1], p[2], p[3], p[4]);
                m_xOverlay.Add(xRegion);
                xRegion.ID           = Region.m_nID;
                xRegion.BorderColor  = Color.FromArgb(Region.m_cBorderColor);
                xRegion.FillColor    = Color.FromArgb(Region.m_cFillColor);
                xRegion.BorderStyle  = Region.m_dBorderStyle;
                xRegion.ControlStyle = (REGION_CONTROL_STYLES)Region.m_RCS;
                xRegion.Caption      = Region.m_sCaption;

                string sImagePath = Region.m_sFillImagePath;
                if (sImagePath != null && sImagePath != "")
                {
                    Image FillImage = Image.FromFile(sImagePath);
                    if (xRegion.FillImage != null)
                    {
                        xRegion.FillImage.Dispose();
                    }
                    xRegion.FillImage = new Bitmap(FillImage);
                    FillImage.Dispose();
                }
                return(true);
            }
            return(false);
        }