Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.3k views
in Technique[技术] by (71.8m points)

delphi - Need help with deriving from TImage (to store the path to image's file)

I have an Object Inspector, just like Delphi's, which I show at run-time to allow the user to change properties of components displayed in my app.

I would like to create a component derived from TImage with one extra property where I can store the path from which the image was loaded. To do so, I presume that I can subclass TImage, have an event to select the image by using something like ...

   var OpenPictureDialog: TPictureEditorDlg;
    if OpenPictureDialog1.Execute then
       OpenPictureDialog1.FileName  <-- contains what I want 

But, if I wrap that in a proc/fn, what's the signature and how do I get it to be called when the user clicks on the ellipsis next to the Picture property in the Object Inspector?


Or perhaps my question ought to have been whether there is an existing 3rd party component which already does this ...


50 point bounty for a free component which can be used in commercial applications (I will increase the bounty for an very good component)


If anyone can give the URL of a component that does this then I will start another bounty, 100 this time, and award it to them

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

That depends on how your Object Inspector works. It would help if we knew where you got it from.

The way it works in Delphi's Object Inspector is that BPL packages can register property designers with the IDE, so when it sees a certain type, such as your custom TImage, it opens that designer instead of whatever it would normally open. See if your Object Inspector supports this, or if not, if you can add the functionality.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...