示例#1
0
        private void BuildPanelProjectSettings()
        {
            _rb_projectName                   = new RibbonTextBox();
            _rb_projectName.Text              = "Name : ";
            _rb_projectName.LabelWidth        = 70;
            _rb_projectName.TextBoxWidth      = 170;
            _rb_projectName.TextBoxValidated += rb_projectUpdated;

            _rb_projectStartDate                   = new RibbonTextBox();
            _rb_projectStartDate.Text              = "End date : ";
            _rb_projectStartDate.LabelWidth        = 70;
            _rb_projectStartDate.TextBoxWidth      = 170;
            _rb_projectStartDate.TextBoxValidated += rb_projectUpdated;

            _rb_projectEndDate                   = new RibbonTextBox();
            _rb_projectEndDate.Text              = "Start date : ";
            _rb_projectEndDate.LabelWidth        = 70;
            _rb_projectEndDate.TextBoxWidth      = 170;
            _rb_projectEndDate.TextBoxValidated += rb_projectUpdated;

            _panelProjectSettings      = new RibbonPanel();
            _panelProjectSettings.Text = "Project settings";
            _panelProjectSettings.Items.Add(_rb_projectName);
            _panelProjectSettings.Items.Add(_rb_projectStartDate);
            _panelProjectSettings.Items.Add(_rb_projectEndDate);
        }
示例#2
0
        private void BuildPanelCurrency()
        {
            _rb_add_devise            = new RibbonButton("Add devise");
            _rb_add_devise.Click     += new EventHandler(rb_add_devise_Click);
            _rb_add_devise.SmallImage = ((System.Drawing.Image)(Tools4Libraries.Resources.ResourceIconSet16Default.conversion_of_currency));
            _rb_add_devise.Image      = ((System.Drawing.Image)(Tools4Libraries.Resources.ResourceIconSet32Default.conversion_of_currency));

            _rb_textbox_change                   = new RibbonTextBox();
            _rb_textbox_change.Text              = "Value : ";
            _rb_textbox_change.LabelWidth        = 70;
            _rb_textbox_change.TextBoxWidth      = 130;
            _rb_textbox_change.TextBoxValidated += rb_textbox_change_TextBoxTextChanged;

            _rb_cb_currency = new RibbonComboBox();
            _rb_cb_currency.AllowTextEdit     = false;
            _rb_cb_currency.TextBoxValidated += rb_cb_currency_TextBoxTextChanged;
            _rb_cb_currency.Text              = "Used currency : ";
            _rb_cb_currency.LabelWidth        = 100;
            _rb_cb_currency.TextBoxWidth      = 100;

            _rb_cb_change = new RibbonComboBox();
            _rb_cb_change.AllowTextEdit       = false;
            _rb_cb_change.TextBoxTextChanged += rb_cb_change_TextBoxTextChanged;
            _rb_cb_change.Text         = "Changes taux : ";
            _rb_cb_change.LabelWidth   = 100;
            _rb_cb_change.TextBoxWidth = 100;

            _panelCurrency      = new RibbonPanel();
            _panelCurrency.Text = "Currency - change";
            _panelCurrency.Items.Add(_rb_cb_currency);
            _panelCurrency.Items.Add(_rb_cb_change);
            _panelCurrency.Items.Add(_rb_textbox_change);
            _panelCurrency.Items.Add(_rb_add_devise);
        }
 public static string get_Text_Wpf(this RibbonTextBox textBox)
 {
     return((string)textBox.wpfInvoke(
                () =>
     {
         return textBox.Text;
     }));
 }
 public static RibbonTextBox set_Text_Wpf(this RibbonTextBox textBox, string text)
 {
     return((RibbonTextBox)textBox.wpfInvoke(
                () =>
     {
         textBox.Text = text;
         return textBox;
     }));
 }
示例#5
0
            public void Execute(object parameter)
            {
                RibbonButton ribBtn = parameter as RibbonButton;

                if (ribBtn != null)
                {
                    Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.SendStringToExecute((String)ribBtn.CommandParameter, true, false, true);
                }
                RibbonTextBox ribTxt = parameter as RibbonTextBox;

                if (ribTxt != null)
                {
                    System.Windows.Forms.MessageBox.Show(ribTxt.TextValue);
                }
            }
        void IInvokeProvider.Invoke()
        {
            RibbonTextBox rtb = (RibbonTextBox)Owner;

            if (!rtb.IsEnabled)
            {
                throw new ElementNotEnabledException();
            }

            Dispatcher.BeginInvoke(DispatcherPriority.Input, new DispatcherOperationCallback(delegate(object param)
            {
                RibbonTextBox textBox = (RibbonTextBox)Owner;
                CommandHelpers.InvokeCommandSource(textBox.CommandParameter, null, textBox, CommandOperation.Execute);
                return(null);
            }), null);
        }
示例#7
0
        private static void OnCommandChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            RibbonTextBox textBox    = (RibbonTextBox)d;
            ICommand      oldCommand = (ICommand)e.OldValue;
            ICommand      newCommand = (ICommand)e.NewValue;

            if (oldCommand != null)
            {
                textBox.UnhookCommand(oldCommand);
            }
            if (newCommand != null)
            {
                textBox.HookCommand(newCommand);
            }

            RibbonHelper.OnCommandChanged(d, e);
        }
示例#8
0
        private static void AddPanel2(RibbonTab ribTab)
        {
            //create the panel source
            Autodesk.Windows.RibbonPanelSource ribSourcePanel = new RibbonPanelSource();
            ribSourcePanel.Title = "裤长";
            //now the panel
            RibbonPanel ribPanel = new RibbonPanel();

            ribPanel.Source = ribSourcePanel;
            ribTab.Panels.Add(ribPanel);

            //create a Ribbon text
            Autodesk.Windows.RibbonTextBox ribTxt = new RibbonTextBox();
            ribTxt.Width            = 100;
            ribTxt.IsEmptyTextValid = false;
            ribTxt.InvokesCommand   = true;
            ribTxt.CommandHandler   = new AdskCommandHandler();

            //create a Ribbon List Button
            Autodesk.Windows.RibbonSplitButton ribListBtn = new RibbonSplitButton();
            Autodesk.Windows.RibbonButton      ribButton1 = new RibbonButton();
            ribButton1.Text             = "长裤";
            ribButton1.ShowText         = true;
            ribButton1.CommandParameter = "LINE ";
            ribButton1.CommandHandler   = new AdskCommandHandler();
            Autodesk.Windows.RibbonButton ribButton2 = new RibbonButton();
            ribButton2.Text             = "九分裤";
            ribButton2.ShowText         = true;
            ribButton2.CommandParameter = "CIRCLE ";
            ribButton2.CommandHandler   = new AdskCommandHandler();
            ribListBtn.Text             = "Some options";
            ribListBtn.ShowText         = true;
            ribListBtn.Items.Add(ribButton1);
            ribListBtn.Items.Add(ribButton2);

            ribSourcePanel.Items.Add(ribTxt);
            ribSourcePanel.Items.Add(new RibbonRowBreak());
            ribSourcePanel.Items.Add(ribListBtn);
        }
示例#9
0
        private void InitializeRibbon()
        {
            Ribbon ribbon = new Ribbon();

            RibbonTab ribbonTab = new RibbonTab();

            ribbonTab.Header = "地图浏览";

            RibbonGroup ribbonGroup = new RibbonGroup();

            ribbonGroup.Header = "三维";
            RibbonButton rbtn = new RibbonButton();

            rbtn.Label = "三维飞行";
            Bitmap bmp = new Bitmap(string.Format("{0}\\images\\3DFlyAlong32.png", System.Windows.Forms.Application.StartupPath));
            IntPtr ptr = bmp.GetHbitmap();

            rbtn.LargeImageSource = Imaging.CreateBitmapSourceFromHBitmap(ptr, IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
            ribbonGroup.Items.Add(rbtn);
            ribbonTab.Items.Add(ribbonGroup);

            ribbonGroup        = new RibbonGroup();
            ribbonGroup.Header = "属性查询";

            ribbonGroup.Width = 80;

            RibbonTextBox rtb = new RibbonTextBox();

            rtb.Style = FindResource("RoundCornerRibbonTextBoxStyle") as Style;
            rtb.Width = 60;
            ribbonGroup.Items.Add(rtb);

            rtb       = new RibbonTextBox();
            rtb.Width = 60;
            ribbonGroup.Items.Add(rtb);

            ribbonTab.Items.Add(ribbonGroup);

            ribbon.Items.Add(ribbonTab);


            #region 根据插件创建控件UI

            RibbonTab pluginTab = new RibbonTab();
            pluginTab.Header = "插件测试";

            RibbonGroup pluginGroup = new RibbonGroup();
            pluginGroup.Header = "插件测试";

            RibbonButton pluginBtn = new RibbonButton();
            pluginBtn.Label = "三维飞行";
            Bitmap pluginBmp = new Bitmap(string.Format("{0}\\images\\3DFlyAlong32.png", System.Windows.Forms.Application.StartupPath));
            IntPtr pluginPtr = pluginBmp.GetHbitmap();
            pluginBtn.LargeImageSource = Imaging.CreateBitmapSourceFromHBitmap(pluginPtr, IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
            pluginGroup.Items.Add(pluginBtn);

            pluginTab.Items.Add(pluginGroup);
            ribbon.Items.Add(pluginTab);

            #endregion

            mainGrid.Children.Add(ribbon);


            DeleteObject(ptr);
        }
 /// <summary>
 ///   Initialize Automation Peer for RibbonTextBox.
 /// </summary>
 public RibbonTextBoxAutomationPeer(RibbonTextBox owner) : base(owner)
 {
 }