Exemplo n.º 1
0
 /// <summary>
 /// Set button design Enable like / Disable like
 /// </summary>
 /// <param name="button"></param>
 /// <param name="sw"></param>
 private void ButtonEnable(TButton button, bool sw = true)
 {
     if (sw)
     {
         button.Foreground = new SolidColorBrush(ButtonForegroundColor);
     }
     else
     {
         button.Foreground = new SolidColorBrush(ColorUtil.ChangeAlpha(ButtonForegroundColor, 0.25f));
     }
 }
Exemplo n.º 2
0
        //procedure CreateButton(ALeft, ATop: Integer; ACaption: String; ANotifyEvent: TNotifyEvent);
        //begin
        //    with TButton.Create(WizardForm) do begin
        //        Left := ALeft;
        //        Top := ATop;
        //        Width := WizardForm.CancelButton.Width;
        //        Height := WizardForm.CancelButton.Height;
        //        Caption := ACaption;
        //        OnClick := ANotifyEvent;
        //        Parent := WizardForm.WelcomePage;
        //    end;
        //end;
        private void CreateButton(int ALeft, int ATop, string ACaption, TNotifyEvent ANotifyEvent)
        {
            var button = new TButton(WizardForm);

            button.Left     = ALeft;
            button.Top      = ATop;
            button.Width    = WizardForm.CancelButton.Width;
            button.Height   = WizardForm.CancelButton.Height;
            button.Caption  = ACaption;
            button.OnClick += ANotifyEvent;
            button.Parent   = WizardForm.WelcomePage;
        }
Exemplo n.º 3
0
        public override void OnInitialInstance()
        {
            UndoButton = (TButton)ControlUtil.FindControl(View, "UndoButton");
            RedoButton = (TButton)ControlUtil.FindControl(View, "RedoButton");
            if (UndoButton.Foreground is SolidColorBrush scb)
            {
                ButtonForegroundColor = scb.Color;
            }
            ButtonEnable(UndoButton, false);
            ButtonEnable(RedoButton, false);

            JacInterpreter.RegisterJacTarget(typeof(FeatureGuiJacBroker).Assembly);
        }
Exemplo n.º 4
0
        public static void ApplyButton(Button Button, TButton ThemeButton)
        {
            if (!string.IsNullOrWhiteSpace(ThemeButton.Image.Path))
            {
                Button.Background = new ImageBrush(ConvertImage(ThemeButton.Image));
            }
            else
            {
                Button.Background = ConvertColor(ThemeButton.BackColor);
            }

            Button.Foreground = ConvertColor(ThemeButton.TextColor);
            Button.FontFamily = new FontFamily(ThemeButton.Font.Name);
            Button.FontSize   = ThemeButton.Font.Size;
            Button.Content    = ThemeButton.Text;
        }
        /// <summary>
        /// </summary>
        protected void CreateButtons <TButton>()
            where TButton : NuGenButton, new()
        {
            IDesignerHost host = (IDesignerHost)this.GetService(typeof(IDesignerHost));

            Debug.Assert(host != null, "host != null");

            Control hostCtrl = host.RootComponent as Control;

            Debug.Assert(hostCtrl != null, "hostCtrl != null");

            DesignerTransaction transaction = host.CreateTransaction("DialogBlock initialization");

            TButton okButton     = (TButton)host.CreateComponent(typeof(TButton), this.GetName(_dialogBlock, "okButton", 0));
            TButton cancelButton = (TButton)host.CreateComponent(typeof(TButton), this.GetName(_dialogBlock, "cancelButton", 0));

            okButton.Text     = Resources.Text_DialogBlock_okButton;
            cancelButton.Text = Resources.Text_DialogBlock_cancelButton;

            cancelButton.Left = _dialogBlock.Right - cancelButton.Width - OFFSET;
            okButton.Left     = cancelButton.Left - okButton.Width - OFFSET;

            this.InitializeDialogButton(okButton);
            this.InitializeDialogButton(cancelButton);

            Debug.Assert(_dialogBlock != null, "this.dialogBlock != null");

            _dialogBlock.Controls.Add(okButton);
            _dialogBlock.Controls.Add(cancelButton);

            Form hostForm = hostCtrl as Form;

            if (hostForm != null)
            {
                hostForm.AcceptButton = okButton;
                hostForm.CancelButton = cancelButton;
            }

            transaction.Commit();
        }
Exemplo n.º 6
0
        public void CreateComponents()
        {
            Application = new TApplication(null);
            Application.Initialize();
            Application.Run();

            var el    = Browser.GetElementById("helloWorld");
            var lForm = new TForm(null);

            lForm.Width = 800;
            // el it's a div element in html file, we are using as container for our form
            lForm.Show(el);

            var lFontsPanel = new TPanel(lForm);

            lFontsPanel.Height = 150;
            lFontsPanel.Width  = 800;
            lFontsPanel.Parent = lForm;

            var lFontsCombo = new TComboBox(lForm);

            lFontsCombo.Left  = 30;
            lFontsCombo.Top   = 50;
            lFontsCombo.Width = 130;
            // Add combo inside TPanel
            lFontsCombo.Parent = lFontsPanel;

            lFontsCombo.Items.Add("Arial");
            lFontsCombo.Items.Add("Verdana");
            lFontsCombo.Items.Add("Helvetica");
            lFontsCombo.Items.Add("Times");

            var lFontSize = new TComboBox(lForm);

            lFontSize.Left   = 200;
            lFontSize.Top    = 50;
            lFontSize.Width  = 80;
            lFontSize.Parent = lFontsPanel;
            for (var i = 8; i <= 72; i += 4)
            {
                lFontSize.Items.Add(i.ToString());
            }

            var lLabel = new TLabel(lForm);

            lLabel.Left    = 320;
            lLabel.Top     = 50;
            lLabel.Caption = "Choose font name and size!";
            lLabel.Parent  = lFontsPanel;

            // Assign combo events
            lFontsCombo.OnSelect = (a) => { lLabel.Font.Name = lFontsCombo.Text; };
            lFontSize.OnSelect   = (a) => { lLabel.Font.Size = StrToInt(lFontSize.Text); };

            var lSecondPanel = new TPanel(lForm);

            lSecondPanel.Top    = 220;
            lSecondPanel.Height = 150;
            lSecondPanel.Width  = 800;
            lSecondPanel.Parent = lForm;

            var lCheckBox = new TCheckBox(lForm);

            lCheckBox.Top     = 20;
            lCheckBox.Left    = 30;
            lCheckBox.Caption = "CheckBox control";
            lCheckBox.Parent  = lSecondPanel;

            var lRadioButton = new TRadioButton(lForm);

            lRadioButton.Top     = 80;
            lRadioButton.Left    = 30;
            lRadioButton.Caption = "RadioButton control";
            lRadioButton.Parent  = lSecondPanel;

            var lChangeButton = new TButton(lForm);

            lChangeButton.Left    = 220;
            lChangeButton.Top     = 20;
            lChangeButton.Caption = "Change progress bar mode";
            lChangeButton.Parent  = lSecondPanel;
            lChangeButton.OnClick = @ChangeButtonClick;

            var lIncButton = new TButton(lForm);

            lIncButton.Left    = 220;
            lIncButton.Top     = 80;
            lIncButton.Caption = "Increase progress bar value";
            lIncButton.Parent  = lSecondPanel;
            lIncButton.OnClick = (a) => { fProgress.Position = fProgress.Position + 5; if (fProgress.Position >= fProgress.Max)
                                          {
                                              fProgress.Position = 0;
                                          }
            };

            fProgress        = new TProgressBar(lForm);
            fProgress.Top    = 55;
            fProgress.Left   = 420;
            fProgress.Max    = 100;
            fProgress.Parent = lSecondPanel;
        }
Exemplo n.º 7
0
        public void HelloWorld()
        {
            Application = new TApplication(null);
            Application.Initialize();
            Application.Run();

            // Create form
            var lForm = new TForm(null);

            lForm.Width = 800;
            // we can display the form in an existing div element. If Show parameter is nil, a new div is created
            lForm.Show(null);

            var lTopLabel = new TLabel(lForm);

            lTopLabel.Left    = 1;
            lTopLabel.Parent  = lForm;
            lTopLabel.Caption = "Write the item caption on the edit and press Add New button to add to ListBox:";

            var lButton = new TButton(lForm);

            lButton.Left    = 50;
            lButton.Top     = 50;
            lButton.Caption = "Add New";
            lButton.Parent  = lForm;

            var lEdit = new TEdit(lForm);

            lEdit.Left   = 150;
            lEdit.Top    = 50;
            lEdit.Parent = lForm;

            var lListBox = new TListBox(lForm);

            lListBox.Left        = 350;
            lListBox.Top         = 50;
            lListBox.Parent      = lForm;
            lListBox.Width       = 250;
            lListBox.MultiSelect = true;

            lButton.OnClick = (s) => { lListBox.Items.Add(lEdit.Text); };

            var lChangeLabel = new TLabel(lForm);

            lChangeLabel.Top     = 165;
            lChangeLabel.Parent  = lForm;
            lChangeLabel.Caption = "Press button to change label font:";

            var lChangeButton = new TButton(lForm);

            lChangeButton.Left    = 50;
            lChangeButton.Top     = 200;
            lChangeButton.Caption = "Change font";
            lChangeButton.Parent  = lForm;

            var lLabel = new TLabel(lForm);

            lLabel.Left    = 150;
            lLabel.Top     = 200;
            lLabel.Caption = "Sample text!";
            lLabel.Parent  = lForm;

            lChangeButton.OnClick = (s) => { lLabel.Font.Name = "Verdana"; lLabel.Font.Size = 24; };

            var lMemo = new TMemo(lForm);

            lMemo.Left   = 50;
            lMemo.Top    = 300;
            lMemo.Width  = 250;
            lMemo.Height = 150;
            lMemo.Parent = lForm;

            var lMemoButton = new TButton(lForm);

            lMemoButton.Left    = 350;
            lMemoButton.Top     = 325;
            lMemoButton.Caption = "Add text";
            lMemoButton.Parent  = lForm;
            var lList = TStringList.Create();

            lList.Add("one line");
            lList.Add("another one");
            lMemoButton.OnClick = (s) => { lMemo.Lines.AddStrings(lList); };

            var lDisplayButton = new TButton(lForm);

            lDisplayButton.Top     = lMemoButton.Top;
            lDisplayButton.Left    = 450;
            lDisplayButton.Caption = "Show memo text";
            lDisplayButton.Parent  = lForm;
            lDisplayButton.OnClick = (s) => { ShowMessage(lMemo.Lines.Text); };
        }