2015-06-19 62 views
0

我想將自定義圖像添加到網格單元是RepositoryItemButtonEdit devexpress按鈕。將自定義圖像添加到網格單元是RepositoryItemButtonEdit devexpress按鈕

當我執行下面的代碼時,我在按鈕上看不到任何東西。

  Dim image As System.Drawing.Image = System.Drawing.Image.FromFile("C:\carl\addAccount.png") 

      Dim buttonAdd As New RepositoryItemButtonEdit   
      buttonAdd.TextEditStyle = TextEditStyles.HideTextEditor 
      buttonAdd.Buttons(0).Kind = ButtonPredefines.Ellipsis 
      buttonAdd.Buttons(0).Image = image 

      AddHandler buttonAdd.Click, AddressOf Me.Button_Click 


      Dim unbColumn As GridColumn = gvView.Columns.AddField("Button") 
      unbColumn.VisibleIndex = gvgvView.Columns.Count 
      unbColumn.ColumnEdit = buttonAdd 

      gvView.OptionsView.ShowButtonMode = DevExpress.XtraGrid.Views.Base.ShowButtonModeEnum.ShowAlways 

回答

0

我想你會看到省略號而不是你的圖像。這是因爲您將EditorButton.Kind屬性設置爲ButtonPredefines.Ellipsis。你需要它成爲雕文。請參閱ButtonPredefines Enumeration處的可能值。

Dim image As System.Drawing.Image = System.Drawing.Image.FromFile("C:\carl\addAccount.png") 

    Dim buttonAdd As New RepositoryItemButtonEdit   
    buttonAdd.TextEditStyle = TextEditStyles.HideTextEditor 
    buttonAdd.Buttons(0).Kind = ButtonPredefines.Glyph 
    buttonAdd.Buttons(0).Image = image 

    AddHandler buttonAdd.Click, AddressOf Me.Button_Click 


    Dim unbColumn As GridColumn = gvView.Columns.AddField("Button") 
    unbColumn.VisibleIndex = gvgvView.Columns.Count 
    unbColumn.ColumnEdit = buttonAdd 

    gvView.OptionsView.ShowButtonMode = DevExpress.XtraGrid.Views.Base.ShowButtonModeEnum.ShowAlways