public override void Paint(PropertyGrid.PropertyGrid grid, PropertyGrid.PropertyGrid.Item item, Graphics g, Rectangle rect)
 {
     base.DrawText(this.getString(item.Value, false), grid.Font, g, rect, 2, 0, new Color?(this.getColour(item)));
     if (base.Editing == item)
     {
         rect.X     = this.mButton.X;
         rect.Width = this.mButton.Width;
         ButtonRenderer.DrawButton(g, rect, this.mState);
     }
 }
示例#2
0
 public override void CreateEditor(PropertyGrid.PropertyGrid grid, PropertyGrid.PropertyGrid.Section section, PropertyGrid.PropertyGrid.Item item, Rectangle rect)
 {
     base.CreateEditor(grid, section, item, rect);
     if (this.mTextBox == null)
     {
         return;
     }
     this.mTextBox.Text     = this.getString((GameData.Instance)item.Value);
     this.mTextBox.ReadOnly = true;
 }
        protected override void ButtonPressed()
        {
            PropertyGrid.PropertyGrid.Item item         = this.mItem;
            PropertyGrid.PropertyGrid      propertyGrid = this.mGrid;
            ItemDialog itemDialog = new ItemDialog("Referenced item", this.Source, this.TypeFilter, false, this.CustomFilter, itemType.NULL_ITEM);

            if (itemDialog.ShowDialog() == DialogResult.OK)
            {
                this.mItem = item;
                this.mGrid = propertyGrid;
                base.setValue(itemDialog.Items[0]);
                this.mItem = null;
                this.mGrid = null;
            }
        }
示例#4
0
        protected override void ButtonPressed()
        {
            PropertyGrid.PropertyGrid.Item item         = this.mItem;
            PropertyGrid.PropertyGrid      propertyGrid = this.mGrid;
            TextDialog textDialog = new TextDialog(this.mItem.Name, this.mItem.Value.ToString(), null);

            if (textDialog.ShowDialog() == DialogResult.OK)
            {
                this.mItem = item;
                this.mGrid = propertyGrid;
                char[] chrArray = new char[] { ' ', '\n', '\r' };
                base.setValue(textDialog.Value.TrimEnd(chrArray));
                this.mItem = null;
                this.mGrid = null;
            }
        }
示例#5
0
 public override void CreateEditor(PropertyGrid.PropertyGrid grid, PropertyGrid.PropertyGrid.Section section, PropertyGrid.PropertyGrid.Item item, Rectangle rect)
 {
     base.CreateEditor(grid, section, item, rect);
     foreach (KeyValuePair <string, int> keyValuePair in this.type)
     {
         //string newKey = NativeTranslte.getTransValue(keyValuePair.Key);
         //this.mList.Items.Add(newKey);
         //trans.Add(newKey, keyValuePair.Key);
         this.mList.Items.Add(keyValuePair.Key);
     }
     this.mList.SelectedItem = this.getAsString(item.Value);
     if (this.mList.SelectedItem == null)
     {
         this.mList.Text = item.Value.ToString();
     }
 }
 public override void CreateEditor(PropertyGrid.PropertyGrid grid, PropertyGrid.PropertyGrid.Section section, PropertyGrid.PropertyGrid.Item item, Rectangle rect)
 {
     base.CreateEditor(grid, section, item, rect);
     this.mList = new CheckedListBox()
     {
         CheckOnClick = true
     };
     this.mList.ItemCheck  += new ItemCheckEventHandler(this.itemChecked);
     this.mList.MinimumSize = new Size(rect.Width - 2, 16);
     this.mList.MaximumSize = new Size(400, 400);
     this.mList.BorderStyle = BorderStyle.None;
     foreach (KeyValuePair <string, int> value in this.values)
     {
         this.mList.Items.Add(value.Key);
     }
     this.mTextBox.KeyDown  += new KeyEventHandler(this.mTextBox_KeyDown);
     this.mTextBox.KeyPress += new KeyPressEventHandler(this.mTextBox_KeyPress);
     base.PopupControl       = this.mList;
 }
示例#7
0
        public override void Paint(PropertyGrid.PropertyGrid grid, PropertyGrid.PropertyGrid.Item item, Graphics g, Rectangle rect)
        {
            if (base.Editing == item)
            {
                base.Paint(grid, item, g, rect);
                return;
            }
            string str = item.Value.ToString();
            int    num = str.IndexOf('\n');

            if (num == 0)
            {
                str = "...";
            }
            else if (num > 0)
            {
                str = string.Concat(str.Substring(0, num - 1), "...");
            }
            base.DrawText(str, grid.Font, g, rect, 2, 0, new Color?(item.TextColour));
        }
示例#8
0
 public override void CreateEditor(PropertyGrid.PropertyGrid grid, PropertyGrid.PropertyGrid.Section section, PropertyGrid.PropertyGrid.Item item, Rectangle rect)
 {
     if (rect.Width < 3)
     {
         return;
     }
     base.CreateEditor(grid, section, item, rect);
     if (this.Type == ValueListProperty.ValueType.INT)
     {
         this.mTextBox.KeyPress += new KeyPressEventHandler(this.filter_int);
     }
     if (this.Type == ValueListProperty.ValueType.UINT)
     {
         this.mTextBox.KeyPress += new KeyPressEventHandler(this.filter_uint);
     }
     else if (this.Type == ValueListProperty.ValueType.FLOAT)
     {
         this.mTextBox.KeyPress += new KeyPressEventHandler(this.filter_float);
     }
     this.mTextBox.Text = this.ValueString(item.Value);
 }
示例#9
0
        protected void CreatePropertyGrid()
        {
            propertyGridScrollViewer = new ScrollViewer()
            {
                HorizontalScrollBarVisibility = ScrollBarVisibility.Auto,
                VerticalScrollBarVisibility   = ScrollBarVisibility.Auto,
                Margin = new Thickness(8),
                HorizontalAlignment = HorizontalAlignment.Right,
                VerticalAlignment   = VerticalAlignment.Top,
                MinWidth            = 200.0,
                Background          = new SolidColorBrush(Color.FromArgb(255, 255, 255, 233)),
                Visibility          = Visibility.Collapsed
            };

            PropertyGrid = new PropertyGrid.PropertyGrid();
            MEFHost.Instance.SatisfyImportsOnce(PropertyGrid);
            PropertyGrid.Margin = new Thickness(4);
            propertyGridScrollViewer.Content = PropertyGrid;
            PropertyGrid.VisibilityChanged  += PropertyGrid_VisibilityChanged;

            Canvas.SetZIndex(propertyGridScrollViewer, (int)ZOrder.StatusBar);

            PropertyGrid.ValueDiscoveryStrategy = new ExcludeByDefaultValueDiscoveryStrategy();
        }
 public override void CreateEditor(PropertyGrid.PropertyGrid grid, PropertyGrid.PropertyGrid.Section section, PropertyGrid.PropertyGrid.Item item, Rectangle rect)
 {
     base.CreateEditor(grid, section, item, rect);
     this.mTextBox.Text = this.getString(item.Value, true);
 }
        private void InitializeComponent()
        {
            this.components                 = new Container();
            this.split                      = new SplitContainer();
            this.grid                       = new PropertyGrid.PropertyGrid();
            this.contextMenu                = new ContextMenuStrip(this.components);
            this.openFile                   = new ToolStripMenuItem();
            this.openFolder                 = new ToolStripMenuItem();
            this.swapTextures               = new ToolStripMenuItem();
            this.copyKeyToolStripMenuItem   = new ToolStripMenuItem();
            this.copyValueToolStripMenuItem = new ToolStripMenuItem();
            this.resetValue                 = new ToolStripMenuItem();
            this.description                = new Label();
            this.selection                  = new Label();
            ((ISupportInitialize)this.split).BeginInit();
            this.split.Panel1.SuspendLayout();
            this.split.Panel2.SuspendLayout();
            this.split.SuspendLayout();
            this.contextMenu.SuspendLayout();
            base.SuspendLayout();
            this.split.Dock        = DockStyle.Fill;
            this.split.Location    = new Point(0, 0);
            this.split.Name        = "split";
            this.split.Orientation = Orientation.Horizontal;
            this.split.Panel1.Controls.Add(this.grid);
            this.split.Panel2.Controls.Add(this.description);
            this.split.Panel2.Controls.Add(this.selection);
            this.split.Size             = new Size(239, 281);
            this.split.SplitterDistance = 222;
            this.split.TabIndex         = 1;
            this.split.TabStop          = false;
            //this.split.IsSplitterFixed = true;


            this.grid.AutoScroll        = true;
            this.grid.AutoScrollMinSize = new Size(0, 100);
            this.grid.ContextMenuStrip  = this.contextMenu;
            this.grid.Dock                = DockStyle.Fill;
            this.grid.Location            = new Point(0, 0);
            this.grid.Name                = "grid";
            this.grid.Size                = new Size(239, 222);
            this.grid.SortSections        = true;
            this.grid.TabIndex            = 0;
            this.grid.OnPropertyChanged  += new PropertyGrid.PropertyGrid.PropertyChangedHandler(this.grid_OnPropertyChanged);
            this.grid.OnPropertySelected += new PropertyGrid.PropertyGrid.PropertySelectedHandler(this.grid_OnPropertySelected);
            this.contextMenu.Items.AddRange(new ToolStripItem[] { this.openFile, this.openFolder, this.swapTextures, this.copyKeyToolStripMenuItem, this.copyValueToolStripMenuItem, this.resetValue });
            this.contextMenu.Name                  = "contextMenu";
            this.contextMenu.Size                  = new Size(153, 158);
            this.contextMenu.Opening              += new CancelEventHandler(this.contextMenu_Opening);
            this.openFile.Name                     = "openFile";
            this.openFile.Size                     = new Size(152, 22);
            this.openFile.Text                     = "打开文件";
            this.openFile.Click                   += new EventHandler(this.openFile_Click);
            this.openFolder.Name                   = "openFolder";
            this.openFolder.Size                   = new Size(152, 22);
            this.openFolder.Text                   = "打开目录";
            this.openFolder.Click                 += new EventHandler(this.openFolder_Click);
            this.swapTextures.Name                 = "swapTextures";
            this.swapTextures.Size                 = new Size(152, 22);
            this.swapTextures.Text                 = "Swap Textures";
            this.swapTextures.Click               += new EventHandler(this.swapTextures_Click);
            this.copyKeyToolStripMenuItem.Name     = "copyKeyToolStripMenuItem";
            this.copyKeyToolStripMenuItem.Size     = new Size(152, 22);
            this.copyKeyToolStripMenuItem.Text     = "复制Key";
            this.copyKeyToolStripMenuItem.Click   += new EventHandler(this.copyKey_Click);
            this.copyValueToolStripMenuItem.Name   = "copyValueToolStripMenuItem";
            this.copyValueToolStripMenuItem.Size   = new Size(152, 22);
            this.copyValueToolStripMenuItem.Text   = "复制值";
            this.copyValueToolStripMenuItem.Click += new EventHandler(this.copyValue_Click);
            this.resetValue.Name                   = "resetValue";
            this.resetValue.Size                   = new Size(152, 22);
            this.resetValue.Text                   = "重设值";
            this.resetValue.Click                 += new EventHandler(this.resetValue_Click);
            this.description.Anchor                = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
            this.description.Location              = new Point(12, 13);
            this.description.Name                  = "description";
            this.description.Size                  = new Size(224, 42);
            this.description.TabIndex              = 1;
            this.description.Text                  = "描述";
            this.selection.AutoSize                = true;
            this.selection.Font                    = new Font("Microsoft Sans Serif", 8.25f, FontStyle.Bold, GraphicsUnit.Point, 0);
            this.selection.Location                = new Point(3, 0);
            this.selection.Name                    = "selection";
            this.selection.Size                    = new Size(85, 13);
            this.selection.TabIndex                = 0;
            this.selection.Text                    = "已选择的项目";
            base.AutoScaleDimensions               = new SizeF(6f, 13f);
            base.AutoScaleMode                     = AutoScaleMode.Font;
            base.Controls.Add(this.split);
            base.Name = "ObjectPropertyBox";
            base.Size = new Size(239, 281);
            this.split.Panel1.ResumeLayout(false);
            this.split.Panel2.ResumeLayout(false);
            this.split.Panel2.PerformLayout();
            ((ISupportInitialize)this.split).EndInit();
            this.split.ResumeLayout(false);
            this.contextMenu.ResumeLayout(false);
            base.ResumeLayout(false);
        }
示例#12
0
 public override void Paint(PropertyGrid.PropertyGrid grid, PropertyGrid.PropertyGrid.Item item, Graphics g, Rectangle rect)
 {
     base.DrawText(this.ValueString(item.Value), grid.Font, g, rect, 2, 0, new Color?(item.TextColour));
 }
        private void InitializeComponent()
        {
            this.components      = new System.ComponentModel.Container();
            this.contextMenu     = new System.Windows.Forms.ContextMenuStrip(this.components);
            this.openItem        = new System.Windows.Forms.ToolStripMenuItem();
            this.revertItem      = new System.Windows.Forms.ToolStripMenuItem();
            this.removeItem      = new System.Windows.Forms.ToolStripMenuItem();
            this.split           = new System.Windows.Forms.SplitContainer();
            this.splitContainer1 = new System.Windows.Forms.SplitContainer();
            this.addList         = new System.Windows.Forms.ComboBox();
            this.addButton       = new System.Windows.Forms.Button();
            this.grid            = new PropertyGrid.PropertyGrid();
            this.description     = new System.Windows.Forms.Label();
            this.selection       = new System.Windows.Forms.Label();
            this.contextMenu.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.split)).BeginInit();
            this.split.Panel1.SuspendLayout();
            this.split.Panel2.SuspendLayout();
            this.split.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
            this.splitContainer1.Panel1.SuspendLayout();
            this.splitContainer1.Panel2.SuspendLayout();
            this.splitContainer1.SuspendLayout();
            this.SuspendLayout();
            //
            // contextMenu
            //
            this.contextMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
                this.openItem,
                this.revertItem,
                this.removeItem
            });
            this.contextMenu.Name     = "contextMenu";
            this.contextMenu.Size     = new System.Drawing.Size(101, 70);
            this.contextMenu.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenu_Opening);
            //
            // openItem
            //
            this.openItem.Name   = "openItem";
            this.openItem.Size   = new System.Drawing.Size(100, 22);
            this.openItem.Text   = "打开";
            this.openItem.Click += new System.EventHandler(this.openItem_Click);
            //
            // revertItem
            //
            this.revertItem.Name   = "revertItem";
            this.revertItem.Size   = new System.Drawing.Size(100, 22);
            this.revertItem.Text   = "还原";
            this.revertItem.Click += new System.EventHandler(this.revertItem_Click);
            //
            // removeItem
            //
            this.removeItem.Name   = "removeItem";
            this.removeItem.Size   = new System.Drawing.Size(100, 22);
            this.removeItem.Text   = "移除";
            this.removeItem.Click += new System.EventHandler(this.removeItem_Click);
            //
            // split
            //
            this.split.Dock            = System.Windows.Forms.DockStyle.Fill;
            this.split.FixedPanel      = System.Windows.Forms.FixedPanel.Panel1;
            this.split.IsSplitterFixed = true;
            this.split.Location        = new System.Drawing.Point(0, 0);
            this.split.Name            = "split";
            this.split.Orientation     = System.Windows.Forms.Orientation.Horizontal;
            //
            // split.Panel1
            //
            this.split.Panel1.Controls.Add(this.splitContainer1);
            //
            // split.Panel2
            //
            this.split.Panel2.Controls.Add(this.description);
            this.split.Panel2.Controls.Add(this.selection);
            this.split.Panel2.Margin    = new System.Windows.Forms.Padding(3);
            this.split.Size             = new System.Drawing.Size(221, 194);
            this.split.SplitterDistance = 152;
            this.split.TabIndex         = 36;
            this.split.TabStop          = false;
            //
            // splitContainer1
            //
            this.splitContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                                                                                | System.Windows.Forms.AnchorStyles.Right)));
            this.splitContainer1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.splitContainer1.Location    = new System.Drawing.Point(0, 0);
            this.splitContainer1.Name        = "splitContainer1";
            this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
            //
            // splitContainer1.Panel1
            //
            this.splitContainer1.Panel1.Controls.Add(this.addList);
            this.splitContainer1.Panel1.Controls.Add(this.addButton);
            //
            // splitContainer1.Panel2
            //
            this.splitContainer1.Panel2.Controls.Add(this.grid);
            this.splitContainer1.Size             = new System.Drawing.Size(221, 153);
            this.splitContainer1.SplitterDistance = 35;
            this.splitContainer1.TabIndex         = 38;
            //
            // addList
            //
            this.addList.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                                                                        | System.Windows.Forms.AnchorStyles.Right)));
            this.addList.FormattingEnabled = true;
            this.addList.Location          = new System.Drawing.Point(6, 8);
            this.addList.Name                  = "addList";
            this.addList.Size                  = new System.Drawing.Size(148, 20);
            this.addList.TabIndex              = 37;
            this.addList.SelectedIndexChanged += new System.EventHandler(this.addList_SelectedIndexChanged);
            this.addList.Enter                += new System.EventHandler(this.addList_Enter);
            //
            // addButton
            //
            this.addButton.Anchor   = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.addButton.Location = new System.Drawing.Point(160, 8);
            this.addButton.Name     = "addButton";
            this.addButton.Size     = new System.Drawing.Size(56, 19);
            this.addButton.TabIndex = 34;
            this.addButton.Text     = "添加";
            this.addButton.UseVisualStyleBackColor = true;
            this.addButton.Click += new System.EventHandler(this.addButton_Click);
            //
            // grid
            //
            this.grid.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                                                                     | System.Windows.Forms.AnchorStyles.Right)));
            this.grid.AutoScroll       = true;
            this.grid.ContextMenuStrip = this.contextMenu;
            this.grid.LineHeight       = 17;
            this.grid.Location         = new System.Drawing.Point(0, 0);
            this.grid.Name             = "grid";
            this.grid.Size             = new System.Drawing.Size(221, 114);
            this.grid.TabIndex         = 0;

            //
            // description
            //
            this.description.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                                                                             | System.Windows.Forms.AnchorStyles.Left)
                                                                            | System.Windows.Forms.AnchorStyles.Right)));
            this.description.Location = new System.Drawing.Point(12, 12);
            this.description.Name     = "description";
            this.description.Size     = new System.Drawing.Size(206, 26);
            this.description.TabIndex = 1;
            this.description.Text     = "描述";
            //
            // selection
            //
            this.selection.AutoSize = true;
            this.selection.Font     = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.selection.Location = new System.Drawing.Point(3, 0);
            this.selection.Name     = "selection";
            this.selection.Size     = new System.Drawing.Size(85, 13);
            this.selection.TabIndex = 0;
            this.selection.Text     = "已选择的项目";
            //
            // ReferenceList
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
            this.AutoScaleMode       = System.Windows.Forms.AutoScaleMode.Font;
            this.Controls.Add(this.split);
            this.Name = "ReferenceList";
            this.Size = new System.Drawing.Size(221, 194);
            this.contextMenu.ResumeLayout(false);
            this.split.Panel1.ResumeLayout(false);
            this.split.Panel2.ResumeLayout(false);
            this.split.Panel2.PerformLayout();
            ((System.ComponentModel.ISupportInitialize)(this.split)).EndInit();
            this.split.ResumeLayout(false);
            this.splitContainer1.Panel1.ResumeLayout(false);
            this.splitContainer1.Panel2.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
            this.splitContainer1.ResumeLayout(false);
            this.ResumeLayout(false);
        }
    public override void OnApplyTemplate()
    {
      base.OnApplyTemplate();

      if( _newItemTypesComboBox != null )
        _newItemTypesComboBox.Loaded -= new RoutedEventHandler( this.NewItemTypesComboBox_Loaded );

      _newItemTypesComboBox = GetTemplateChild( PART_NewItemTypesComboBox ) as ComboBox;

      if( _newItemTypesComboBox != null )
        _newItemTypesComboBox.Loaded += new RoutedEventHandler( this.NewItemTypesComboBox_Loaded );

      _propertyGrid = GetTemplateChild( PART_PropertyGrid ) as PropertyGrid.PropertyGrid;
    }