Atul Guest
|
Posted: Tue Jan 10, 2006 9:27 am Post subject: Problem in implementing a Transparent TMonthCalendar |
|
|
Hi All,
I am trying to implement a Transparent TMonthCalendar, but not able to
get it done proper.
Scenario:
I am using an MDI Form application. On the form i have an image control
with .jpg image. On the image i have to place TMonthCalendar which
should be transparant. The TMonthCalendar should be transparent in such
a way that on the image only days/month/year should appear...as if it
was watermarked on the image.
I am trying to achieve that as follows but not able to get what i have
described in the above scenario.
I thought this way it would work but i am getting the Forms colour when
my calendar control is getting transparent.
---------------------------------------------------------------------------------------------------------------------------------------
Following is my code:
unit MYMonthCalendar;
interface
uses
Windows, Messages, SysUtils, Classes, Controls, ComCtrls,forms;
type
TMYMonthCalendar = class(TMonthCalendar)
private
function GetTransparent: Boolean;
procedure SetTransparent(const Value: Boolean);
{ Private declarations }
protected
{ Protected declarations }
public
{ Public declarations }
published
{ Published declarations }
property Transparent: Boolean read GetTransparent write
SetTransparent default False;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Samples', [TMYMonthCalendar]);
end;
{ TMYMonthCalendar }
function TMYMonthCalendar.GetTransparent: Boolean;
begin
Result := not (csOpaque in ControlStyle);
end;
procedure TMYMonthCalendar.SetTransparent(const Value: Boolean);
begin
if Transparent <> Value then
begin
if Value then
CalColors.TitleBackColor := TForm(Self.Parent).Color;
CalColors.MonthBackColor := TForm(Self.Parent).Color;
Invalidate;
end;
end;
end.
---------------------------------------------------------------------------------------------------------------------------------------
waiting for your reply soon as earliest possible. your help is
appreciated.
thanks in advance,
regards,
Atul |
|