English 中文(简体)
Delphi IDE - How to make disabled toolbar buttons grayscaled?
原标题:

Seams like this one is for real Delphi geeks only.

This is how it looks (sorry, can t post images)
Delphi IDE ugly toolbar

alt text
(source: piccy.info)

What s wrong - disabled Delphi IDE toolbar and menu buttons are ugly black/white images.
What I want to do - make them look gray-scaled.

How? I made some research. Main problem in virtual TCustomImageList.DoDraw method. When paramater Enabled = False it paints ugly things (see disabled buttons on screenshot). I created my own override for this function and it paints gray-scaled images when Enabled = False

Now I want to replace default DoDraw with my own in IDE (using design-time package):

  1. I figured out that unit ImgList is compiled-in bds.exe, so trick with patching this function in rtlXXX.bpl will not work.
  2. Searching for function s body content gave no result. Looks like bds.exe s implementation (I m talikng about machine codes) of DoDraw is a bit different.

Any suggestions or ideas of how can I make this possible? As base example of runtime code patching I took Andy s Midas Speed Fix: FindMethodPtr, HookProc, UnhookProc

最佳回答

I made it :) Thanks to everyone who participated or viewed this question!

This is how my IDE looks now:
Fixed toolbar http://blog.frantic.im/wp-content/uploads/2009/11/delphi-ide-after.PNG

I just messed up with vclXXX.pbl, my fault. Sources can be found here. Gradient toolbars must be enabled to make it work. If you are interested in further development of this idea - read this topic

问题回答

Maybe I m understanding the problem badly but if you just want to override the DoDraw function why don t you just create your own component that inherits from TCustomImageList, override the desired function so that it does what you want and register it into the IDE?

If you don t want to make your own overriden components, you can change the realization directly in [DelphiPath]sourceWin32vclImgList.pas.

But it is really not a good way.

I ve always disliked the way Delphi creates default disabled images from enabled one. This not only manifests itself in the IDE, but it does persist down to the application you re developing. The disabled images in your application look just as bad.

I have in the past tried to figure out what Delphi did to derive the disabled images and build on that. But it still is on my "things to do" list to finish that off.

None-the-less, these are some articles about the Delphi "glitch" that I encountered quite a while ago that may or may not help you:

  1. Indistinguishable gray blobs in disabled menu items, by Vladimir S.

  2. MenuImgList.pas

  3. Fixing a Buttons Drawing Glitch in Delphi 5

  4. Fixing a Menu Drawing Glitch in Delphi 4





相关问题
determining the character set to use

my delphi 2009 app has a basic translation system that uses GNUGetText. i had used some win API calls to prepare the fonts. i thought it was working correctly until recently when someone from Malta ...

Help with strange Delphi 5 IDE problems

Ok, I m going nuts here. For the last (almost) four years, I ve been putting up with some extremely bad behavior from my Delphi 5 IDE. Problems include: Seemingly random errors in coride50.bpl ...

How to write a Remote DataModule to run on a linux server?

i would like to know if there are any solution to do this. Does anyone? The big picture: I want to access data over the web, using my delphi thin clients. But i´would like to keep my server/service ...

How convert string to integer in Oxygene

In Delphi, there is a function StrToInt() that converts a string to an integer value; there is also IntToStr(), which does the reverse. These functions doesn t appear to be part of Oxygene, and I can ...

Quick padding of a string in Delphi

I was trying to speed up a certain routine in an application, and my profiler, AQTime, identified one method in particular as a bottleneck. The method has been with us for years, and is part of a "...

热门标签