Пример #1
0
    public MainPage(ContexUI context) : base("main", context)
    {
        text       = new Label($"Clicked 0 times!", 400, 200, 24);
        text.Color = SKColors.Blue;



        btn1                 = new Button("Click Me!", 400, 400, 150, 70);
        btn1.Color           = SKColors.CornflowerBlue;
        btn1.Label.FonstSize = 24;
        btn1.Round           = 12;
        btn1.OnClickCallback = (e) =>
        {
            clickCount++;
            text.Text = $"Clicked {clickCount} vezes!";
        };

        btn                 = new Button("Second Page!", 400, 505, 150, 70);
        btn.Color           = SKColors.IndianRed;
        btn.Label.FonstSize = 24;
        btn.OnClickCallback = (e) =>
        {
            context.GotoPage("SecondPage");
        };



        AddComponent(btn1);
        AddComponent(btn);
        AddComponent(text);
    }
Пример #2
0
        /// <summary>
        /// Instantiate an new SharpWindow object.
        /// </summary>
        /// <param name="title">The title of thw window.</param>
        /// <param name="Width">The width of the window.</param>
        /// <param name="Height">The height of the window.</param>
        public SharpWindow(string title = "Sharp Window", uint Width = 800, uint Height = 600)
        {
            native  = new NativeWindow((int)Width, (int)Height, title);
            context = GenerateSkiaContext(native);
            surface = GenerateSkiaSurface(context, native.ClientSize);

            canvas = surface.Canvas;
            windowBackgroundColor     = SKColor.Parse("#F0F0F0");
            contextUI                 = new ContexUI(surface, native.ClientSize);
            contextUI.ContextChanged += ContextUpdated;
            SubscribeDefaultEvents();
        }
Пример #3
0
        /// <summary>
        /// Instantiate an new SharpWindow object.
        /// </summary>
        /// <param name="options">An object with options to construct window</param>
        public SharpWindow(SharpWindowOptions options)
        {
            native = new NativeWindow((int)options.Widht, (int)options.Height, options.title);

            context = GenerateSkiaContext(native);
            surface = GenerateSkiaSurface(context, native.ClientSize);
            canvas  = surface.Canvas;

            windowBackgroundColor     = options.windowBackgroundColor;
            runOptions                = options.runOptions;
            contextUI                 = new ContexUI(surface, native.ClientSize);
            contextUI.ContextChanged += ContextUpdated;
            SubscribeDefaultEvents();
        }
Пример #4
0
    public SecondPage(ContexUI context) : base("SecondPage", context)
    {
        Label text = new Label("Digitou: ", 400, 250, 24);

        text.Color = SKColors.Blue;

        Label     text1 = new Label("Digite: ", 400, 350, 24);
        TextField tf    = new TextField("Input Text", 400 + text1.Position.W / 2, 350, 20);

        tf.Position.RelativeCenter = RelativePosition.Right;

        tf.OnChangedValue = (v) =>
        {
            text.Text = $"Digitou: {v}";
        };

        Button btn = new Button("Main Page!", 400, 505, 150, 70);

        btn.Color           = SKColors.IndianRed;
        btn.Label.FonstSize = 24;
        btn.OnClickCallback = (e) =>
        {
            context.GotoPage("main");
        };

        Button btnt = new Button("Test!", 570, 505, 150, 70);

        btnt.Color           = SKColors.Indigo;
        btnt.Label.FonstSize = 24;

        AddComponent(text);
        AddComponent(text1);
        AddComponent(tf);
        AddComponent(btn);
        AddComponent(btnt);
    }