PropertyGrid image Selection while Property is ReadOnly Problem
-
Readonly with Editor is not working as readonly after setting the image and it is working as readonly but not setting the iMage to picture <[ReadOnly](True)> <Editor(GetType(ImageOpenFileDialog), GetType(System.Drawing.Design.UITypeEditor))> _ Public Property BackgroundPicture() As String Public Class ImageOpenFileDialog Inherits UITypeEditor Dim openFileDialog As OpenFileDialog Public Overrides Function EditValue(ByVal context As System.ComponentModel.ITypeDescriptorContext, ByVal provider As System.IServiceProvider, ByVal value As Object) As Object openFileDialog = New OpenFileDialog() openFileDialog.FileName = "" openFileDialog.Filter = "JPEG Images|*.jpg|GIF Images|*.gif|Bitmaps|*.bmp" openFileDialog.InitialDirectory = My.Computer.FileSystem.SpecialDirectories.MyPictures If openFileDialog.ShowDialog() = DialogResult.OK Then Return openFileDialog.FileName End If Return MyBase.EditValue(context, provider, value) End Function Public Overrides Function GetEditStyle(ByVal context As System.ComponentModel.ITypeDescriptorContext) As System.Drawing.Design.UITypeEditorEditStyle Return UITypeEditorEditStyle.Modal End Function End Class I am creating a readonly Property and if i click i open the Images to select the image . as it is a readonly property i am not able to set teh image to picture box . ---------- Working on Visual Studio 2005 PropertyGrid . I want to lock all the keys not to enter in the propertygrid at the Picture Property like in Visual Basic 6.0 after selecting the image . Only Delete has to work PictureBox -- Picture Property -- (Bitmap) after setting the image so that the user shouldnot change the value Presently i got the (None) in this way . Now i want to set the ReadOnly and only Delete key has to work and i want to set the Picture to PictureBox.