Esempio n. 1
0
        private void comboRenderType_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listIcons.SelectedIndex == -1)
            {
                return;
            }
            if (SelectedIcon.renderer.Name == comboRenderType.Text)
            {
                return;
            }

            if (typeof(IRenderColorable).IsAssignableFrom(SelectedIcon.renderer.GetType()) &&
                typeof(IRenderColorable).IsAssignableFrom(RenderRegistry.GetRenderTypeFormName(comboRenderType.Text)))
            {
                Color fgColor = ((IRenderColorable)SelectedIcon.renderer).ForegroundColour;
                Color bgColor = ((IRenderColorable)SelectedIcon.renderer).BackgroundColour;

                SelectedIcon.ChangeRenderer(comboRenderType.Text);

                ((IRenderColorable)SelectedIcon.renderer).ForegroundColour = fgColor;
                ((IRenderColorable)SelectedIcon.renderer).BackgroundColour = bgColor;
            }
            else
            {
                if (MessageBox.Show("This will clear the renderer settings.\n\nAre you sure?",
                                    Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
                {
                    SelectedIcon.ChangeRenderer(comboRenderType.Text);
                }
                else
                {
                    comboRenderType.Text = SelectedIcon.renderer.Name;
                }
            }

            SetRenderInfo();
        }
        protected RenderControllerBase(ILoader loader)
        {
            Loader = loader;
            RenderRegistry.Add("circle", CircleRender.Render);
            RenderRegistry.Add("ellipse", EllipseRender.Render);
            RenderRegistry.Add("line", LineRender.Render);
            RenderRegistry.Add("path", PathRender.Render);
            RenderRegistry.Add("polygon", PolygonRender.Render);
            RenderRegistry.Add("svg", SvgRender.Render);
            RenderRegistry.Add("use", UseRender.Render);
            RenderRegistry.Add("symbol", SymbolRender.Render);
            RenderRegistry.Add("g", GRender.Render);
            RenderRegistry.Add("text", TextRender.Render);
            RenderRegistry.Add("barcode", BarcodeRender.Render);
            RenderRegistry.Add("polyline", PolyLineRender.Render);
            RenderRegistry.Add("image", ImageRender.Render);
            RenderRegistry.Add("rect", RectangleRender.Render);
            RenderRegistry.Add("px-text", PxTextRender.Render);

            D2DFactory  = new D2D1.Factory(D2D1.FactoryType.SingleThreaded);
            WicFactory  = new WIC.ImagingFactory2();
            DwFactory   = new DW.Factory();
            FontManager = new FontManager(DwFactory);
        }