コード例 #1
0
        protected override void OnStartDemo(SampleViewport viewport)
        {
            //----------------------------------------------------------------
            {
                var scbar = new LayoutFarm.CustomWidgets.ScrollBar(15, 200);
                scbar.SetLocation(10, 10);
                scbar.MinValue = 0;
                scbar.MaxValue = 100;
                scbar.SmallChange = 50;
                viewport.AddContent(scbar);
            }
            //----------------------------------------------------------------
            {
                var scbar = new LayoutFarm.CustomWidgets.ScrollBar(15, 200);
                scbar.SetLocation(30, 10);
                scbar.MinValue = 0;
                scbar.MaxValue = 100;
                scbar.SmallChange = 25;
                viewport.AddContent(scbar);
            }
            //----------------------------------------------------------------
            {
                var scbar = new LayoutFarm.CustomWidgets.ScrollBar(15, 200);
                scbar.SetLocation(50, 10);
                scbar.MinValue = 0;
                scbar.MaxValue = 1000;
                scbar.SmallChange = 100;
                viewport.AddContent(scbar);
            }
            //-------------------------------------
            {
                //horizontal scrollbar
                var scbar = new LayoutFarm.CustomWidgets.ScrollBar(200, 15);
                scbar.ScrollBarType = CustomWidgets.ScrollBarType.Horizontal;
                scbar.SetLocation(80, 10);
                scbar.MinValue = 0;
                scbar.MaxValue = 100;
                scbar.SmallChange = 50;
                viewport.AddContent(scbar);
            }
            {
                //horizontal scrollbar
                var scbar = new LayoutFarm.CustomWidgets.ScrollBar(200, 15);
                scbar.ScrollBarType = CustomWidgets.ScrollBarType.Horizontal;
                scbar.SetLocation(80, 40);
                scbar.MinValue = 0;
                scbar.MaxValue = 100;
                scbar.SmallChange = 25;
                viewport.AddContent(scbar);
            }

            {
                //horizontal scrollbar
                var scbar = new LayoutFarm.CustomWidgets.ScrollBar(200, 15);
                scbar.ScrollBarType = CustomWidgets.ScrollBarType.Horizontal;
                scbar.SetLocation(80, 80);
                scbar.MinValue = 0;
                scbar.MaxValue = 1000;
                scbar.SmallChange = 100;
                viewport.AddContent(scbar);
            }
        }
コード例 #2
0
        protected override void OnStartDemo(SampleViewport viewport)
        {
            //----------------------------------------------------------------
            {
                var slideBox = new LayoutFarm.CustomWidgets.SliderBox(15, 200);
                slideBox.SetLocation(10, 400);
                slideBox.MinValue    = 0;
                slideBox.MaxValue    = 100;
                slideBox.SmallChange = 50;
                viewport.AddContent(slideBox);
                slideBox.ScrollValue = 150;
            }
            //----------------------------------------------------------------


            //----------------------------------------------------------------
            {
                var scbar = new LayoutFarm.CustomWidgets.ScrollBar(15, 200);
                scbar.SetLocation(10, 10);
                scbar.MinValue    = 0;
                scbar.MaxValue    = 100;
                scbar.SmallChange = 50;
                scbar.ScrollValue = 150;
                viewport.AddContent(scbar);
            }
            //----------------------------------------------------------------
            {
                var scbar = new LayoutFarm.CustomWidgets.ScrollBar(15, 200);
                scbar.SetLocation(30, 10);
                scbar.MinValue    = 0;
                scbar.MaxValue    = 100;
                scbar.SmallChange = 25;
                viewport.AddContent(scbar);
            }
            //----------------------------------------------------------------
            {
                var scbar = new LayoutFarm.CustomWidgets.ScrollBar(15, 200);
                scbar.SetLocation(50, 10);
                scbar.MinValue    = 0;
                scbar.MaxValue    = 1000;
                scbar.SmallChange = 100;
                viewport.AddContent(scbar);
            }
            //-------------------------------------
            {
                //horizontal scrollbar
                var scbar = new LayoutFarm.CustomWidgets.ScrollBar(200, 15);
                scbar.ScrollBarType = CustomWidgets.ScrollBarType.Horizontal;
                scbar.SetLocation(80, 10);
                scbar.MinValue    = 0;
                scbar.MaxValue    = 100;
                scbar.SmallChange = 50;
                viewport.AddContent(scbar);
            }
            {
                //horizontal scrollbar
                var scbar = new LayoutFarm.CustomWidgets.ScrollBar(200, 15);
                scbar.ScrollBarType = CustomWidgets.ScrollBarType.Horizontal;
                scbar.SetLocation(80, 40);
                scbar.MinValue    = 0;
                scbar.MaxValue    = 100;
                scbar.SmallChange = 25;
                viewport.AddContent(scbar);
            }

            {
                //horizontal scrollbar
                var scbar = new LayoutFarm.CustomWidgets.ScrollBar(200, 15);
                scbar.ScrollBarType = CustomWidgets.ScrollBarType.Horizontal;
                scbar.SetLocation(80, 80);
                scbar.MinValue    = 0;
                scbar.MaxValue    = 1000;
                scbar.SmallChange = 100;
                viewport.AddContent(scbar);
            }
        }
コード例 #3
0
        protected override void OnStartDemo(SampleViewport viewport)
        {
            colorMatch = new ColorMatch();
            colorMatch.VariationsRGB = new RGB[7];
            colorMatch.VariationsHSV = new RGB[9];
            blenderAlgo = colorMatch.Algorithms[0];
            //

            {
                lstvw_blendAlgo = new ListView(200, 400);
                lstvw_blendAlgo.SetLocation(500, 20);
                viewport.AddContent(lstvw_blendAlgo);
                lstvw_blendAlgo.ListItemMouseEvent += (s, e) =>
                {
                    if (lstvw_blendAlgo.SelectedIndex > -1)
                    {
                        blenderAlgo = colorMatch.Algorithms[lstvw_blendAlgo.SelectedIndex];
                        UpdateAllComponents();
                    }
                };

                //add item
                foreach (IAlgorithm algo in colorMatch.Algorithms)
                {
                    ListItem listItem = new ListItem(200, 20);
                    listItem.Text = algo.GetType().Name;
                    listItem.Tag  = algo;
                    lstvw_blendAlgo.AddItem(listItem);
                }
            }

            //start RGB value
            byte r_value = 200;
            byte g_value = 46;
            byte b_value = 49;


            CreateRBGVarBoxes(viewport, 20, 250);
            CreateHsvVarBoxes(viewport, 20, 300);
            CreateSwatchBoxes(viewport, 20, 350);

            {
                pure_rgbBox           = new SimpleBox(50, 50);
                pure_rgbBox.BackColor = new PixelFarm.Drawing.Color(
                    (byte)r_value,
                    (byte)b_value,
                    (byte)g_value);
                pure_rgbBox.SetLocation(0, 0);
                viewport.AddContent(pure_rgbBox);
            }

            //R
            {
                CreateRBGScrollBarAndSampleColorBox(80, 80, out r_sc, out r_sampleBox, (n_scrollBar, n_sampleBox) =>
                {
                    if (_component_ready)
                    {
                        n_sampleBox.BackColor = new PixelFarm.Drawing.Color((byte)(n_scrollBar.ScrollValue / 10), 0, 0);
                        UpdateAllComponents();
                    }
                });
                viewport.AddContent(r_sc);
                viewport.AddContent(r_sampleBox);
            }
            //G
            {
                CreateRBGScrollBarAndSampleColorBox(80, 120, out g_sc, out g_sampleBox, (n_scrollBar, n_sampleBox) =>
                {
                    if (_component_ready)
                    {
                        n_sampleBox.BackColor = new PixelFarm.Drawing.Color(0, (byte)(n_scrollBar.ScrollValue / 10), 0);
                        UpdateAllComponents();
                    }
                });
                viewport.AddContent(g_sc);
                viewport.AddContent(g_sampleBox);
            }
            //B
            {
                CreateRBGScrollBarAndSampleColorBox(80, 160, out b_sc, out b_sampleBox, (n_scrollBar, n_sampleBox) =>
                {
                    if (_component_ready)
                    {
                        n_sampleBox.BackColor = new PixelFarm.Drawing.Color(0, 0, (byte)(n_scrollBar.ScrollValue / 10));
                        UpdateAllComponents();
                    }
                });
                viewport.AddContent(b_sc);
                viewport.AddContent(b_sampleBox);
            }
            _component_ready = true;
        }
コード例 #4
0
 protected override void OnStartDemo(SampleViewport viewport)
 {
     var textbox = new LayoutFarm.CustomWidgets.TextBox(400, 30, false);
     viewport.AddContent(textbox);
     textbox.InvalidateGraphics();
 }