Mega Code Archive

 
Categories / Delphi / Ide Indy
 

Making TabControls work on XP with Delphi 4

Title: Making TabControls work on XP with Delphi 4 Question: Matteo Riso posted an solution for creating transparent Tabsheets in his article http://www.delphi3000.com/articles/article_2843.asp, unfortunately it does not work for Delphi 4. The solution is described below. Answer: { Before I begin I should mention that you will need to enable XP theming by adding a manifest to your own project. An easy way to do this is either through the TWinXP component (mentioned in Matteo's article) or through Jordan Russell's XPTheme.pas which can be downloaded from the misc section on: http://www.jrsoftware.org/ That should be it for starters! Now add a new event procedure to the delphi form that contains the TabControl: } TfrmOptions = class(TForm) ... procedure SetTransparent(Sender: TObject); { private { Private declarations } ... public { Public declarations } ... end; { Now add the procedure definition at the end of your form's unit: } procedure TMyForm.SetTransparent(Sender: TObject); var style : integer; begin if Sender is TWinControl then with Sender as TWinControl do begin style := GetWindowLong(Handle,GWL_EXSTYLE); if not ((style or WS_EX_TRANSPARENT) = style) then SetWindowLong(Handle,GWL_EXSTYLE, style or WS_EX_TRANSPARENT); end; end; { Now click on each TabSheet (TabSheet as opposed to the TabControl itself) and set its OnShow Event to SetTransparent. That should do the trick. }