[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.vb.general.discussion

How to display at design time an Open dialog when an item is clicked in the Properties window?

Paulo

2/16/2012 2:30:00 AM

Hello,

I wrote an OCX with a LoadBitmap method that allows to load of BMP, PNG and
JPG graphics at run time. Recently I added to the UserControl a Bitmap
property such as the Pitcture property of a PictureBox control that enables
the addition of BMP and JPG graphics at design time but not PNG files
because they are not available in the dropdown list of file types, and the
VB6 automation doesn't support this type of graphics.

The question is:
Is it possible to popup an Open dialog with the file types I want when the
Bitmap property is clicked in the Properties window of the IDE?

Thank you in advance for any advice or example.

--
Paulo
Don't steal my Classic VB!



--- Posted via news://freenews.netfront.net/ - Complaints to news@netfront.net ---
7 Answers

Karl E. Peterson

2/16/2012 5:35:00 PM

0

Paulo explained :
> The question is:
> Is it possible to popup an Open dialog with the file types I want when the
> Bitmap property is clicked in the Properties window of the IDE?

If you declare the property pair like this:

Public Property Set Bitmap(ByVal NewBmp As StdPicture)

Public Property Get Bitmap() As StdPicture

You'll get a dialog with all supported types. Not sure there's any way
to twiddlet that list, though.

--
..NET: It's About Trust!
http://vfre...


Paulo

2/17/2012 3:22:00 AM

0

> Karl E. Peterson wrote:
> You'll get a dialog with all supported types. Not sure there's any way to
> twiddlet that list, though.

Because of the PNG type I'm considering to add a property page and use the
GetOpenFileName API with my list of graphic types to allow the programmer to
load also PNG graphics at design time.

--
Paulo
Don't steal my Classic VB!



--- Posted via news://freenews.netfront.net/ - Complaints to news@netfront.net ---

mm

2/17/2012 9:42:00 AM

0

"Paulo" <pmpcosta.nospam@netcabo.pt> escribió en el mensaje
news:jhhpni$6en$1@adenine.netfront.net...
> Hello,
>
> I wrote an OCX with a LoadBitmap method that allows to load of BMP, PNG
> and JPG graphics at run time. Recently I added to the UserControl a Bitmap
> property such as the Pitcture property of a PictureBox control that
> enables the addition of BMP and JPG graphics at design time but not PNG
> files because they are not available in the dropdown list of file types,
> and the VB6 automation doesn't support this type of graphics.
>
> The question is:
> Is it possible to popup an Open dialog with the file types I want when the
> Bitmap property is clicked in the Properties window of the IDE?
>
> Thank you in advance for any advice or example.

Hello Paulo,

I think that you can do that with Eduardo Morcillo's technique of hooking
the extender. You can find it in this page:
http://www.mvps.org/emorcillo/en/code/vb6/i... (scroll down to
"Hooking the Extender object in UserControls".

When you are able to catch the user click on the property, then show your
custom common dialog to allow to load PNG files.

The problem is that you'll have to add dependencies. I see that it needs
"Edanmo's Extender callback v 1.0" and "Edanmo's OLE Interfaces & functions
1.0".

The direct link to the sample file is
http://www.mvps.org/emorcillo/download/vb6/c...

mm

2/17/2012 9:54:00 AM

0

> The direct link to the sample file is
> http://www.mvps.org/emorcillo/download/vb6/c...

But I doesn't work here, I get a message "Error loading DLL".

mm

2/17/2012 10:05:00 AM

0

"Eduardo" <mm@mm.com> escribió en el mensaje
news:jhl82j$u0q$1@speranza.aioe.org...
>> The direct link to the sample file is
>> http://www.mvps.org/emorcillo/download/vb6/c...
>
> But I doesn't work here, I get a message "Error loading DLL".

I think that the best solution is to add a propery page, and then in the
Procedure Attributes window, select that propery page for your Bitmap
property.

Then, in the propery page, you can show the image (if it's already set) and
add a button to show a common dialog to allow to load another image.

Then program the common dialog to allow all the files types that you want to
allow.

You can show a common dialog without using the VB's one, just by code, to
avoid adding a dependency.

Paulo

2/17/2012 11:23:00 PM

0

Thanks Eduardo,
I will try the way you pointed. I didn´t know it.

--
Paulo
Don't steal my Classic VB!



--- Posted via news://freenews.netfront.net/ - Complaints to news@netfront.net ---

Paulo

2/17/2012 11:31:00 PM

0

> Eduardo wrote:
> You can show a common dialog without using the VB's one, just by code, to
> avoid adding a dependency.

Hi Eduardo,

Yes, I can use the GetOpenFileName API directly form the comdlg32.dll
avoiding the COMDLG32.OCX dependency.

Thanks again.

--
Paulo
Don't steal my Classic VB!



--- Posted via news://freenews.netfront.net/ - Complaints to news@netfront.net ---