Exemplo n.º 1
0
        private void buttonColours_Click(object sender, EventArgs e)
        {
            Primitive col = LDColours.SetOpacity("Orange", 100);

            TextWindow.WriteLine(col);
            TextWindow.WriteLine(LDColours.GetOpacity(col));
            TextWindow.WriteLine(LDColours.GetRed(col));
            TextWindow.WriteLine(LDColours.GetGreen(col));
            TextWindow.WriteLine(LDColours.GetBlue(col));

            TextWindow.WriteLine(LDColours.GetHue(col));
            TextWindow.WriteLine(LDColours.GetSaturation(col));
            TextWindow.WriteLine(LDColours.GetLightness(col));
            col = LDColours.HSLtoRGB(LDColours.GetHue(col), LDColours.GetSaturation(col), LDColours.GetLightness(col));
            TextWindow.WriteLine(col);

            for (int i = 0; i < 360; i++)
            {
                GraphicsWindow.BackgroundColor = LDColours.HSLtoRGB(i, 1, 0.5);
                SBProgram.Delay(20);
            }
            LDUtilities.PauseUpdates();
            GraphicsWindow.PenWidth = 0;
            Primitive colour = "Blue";
            Primitive ball   = Shapes.AddEllipse(300, 300);

            Shapes.Move(ball, GraphicsWindow.Width / 2 - 150, GraphicsWindow.Height / 2 - 150);
            LDShapes.BrushColour(ball, LDColours.SetOpacity(colour, 0));
            LDUtilities.ResumeUpdates();
            for (int i = 0; i < 255; i++)
            {
                LDShapes.BrushColour(ball, LDColours.SetOpacity(colour, i));
                SBProgram.Delay(10);
            }
        }
Exemplo n.º 2
0
        private void buttonDialogs_Click(object sender, EventArgs e)
        {
            int i;

            GraphicsWindow.Show();
            Primitive items  = "";
            Primitive images = "";

            for (i = 1; i <= 5; i++)
            {
                items[i]  = "Item " + i;
                images[i] = "C:\temp\test.jpg";
            }
            LDDialogs.AddRightClickMenu(items, images);

            TextWindow.WriteLine(System.Windows.Media.RenderCapability.Tier >> 16);
            Primitive a1 = LDArray.Create(1000);

            Shapes.AddEllipse(50, 50);
            FormPropertyGrid grid = new FormPropertyGrid();

            grid.Display("_mainCanvas");
            Primitive properties = grid.GetProperties("_mainCanvas");

            for (i = 1; i <= SBArray.GetItemCount(properties); i++)
            {
                TextWindow.WriteLine(properties[i]);
            }

            grid.SetProperty("_mainCanvas.Children.Ellipse1.Opacity", 0.5);

            Primitive font     = LDDialogs.Font("");
            Primitive font2    = LDDialogs.Font(font);
            Primitive fileName = LDDialogs.OpenFile("Small Basic File (*.sb) |*.sb", "");

            LDUtilities.Version();
            GraphicsWindow.Show();
            TextWindow.WriteLine(LDDialogs.Calendar(LDDateTime.Add(LDDateTime.Now(), 7))); //Now + 7 days
            //LDUtilities.PauseUpdates();
            LDDialogs.Wait("Please wait for a few seconds while I draw something...", LDColours.SetOpacity(LDColours.Violet, 200));
            double start = Clock.ElapsedMilliseconds;

            i = 1;
            while (Clock.ElapsedMilliseconds < start + 5000)
            {
                Primitive ball = Shapes.AddEllipse(20, 20);
                Shapes.Move(ball, SBMath.GetRandomNumber(GraphicsWindow.Width) - 10, SBMath.GetRandomNumber(GraphicsWindow.Height) - 10);
                LDDialogs.ToolTip(ball, "Ball " + i++);
                SBProgram.Delay(100);
            }
            //LDUtilities.ResumeUpdates();
            LDDialogs.EndWait();
        }