Board index » delphi » Canvas' STRIKE ?!

Canvas' STRIKE ?!

Hi All!

I having a most wierd situation :

------ Delphi code ------

Type
 TDialogForm = Record
   Form : TForm;
   Prompt : TLabel;
  End;

Function Confirm (Const ACaption, APrompt: string; AnIcon : TGraphic ; Buttons: TDialogBtns) : Boolean;

Var
  DialogForm : TDialogForm;

Begin
Result := False;
With DialogForm do
 Begin
  Form := TForm.Create(Application);
  With Form do
    Try
     Caption := ACaption; // works well
     Prompt.Caption := APrompt; // works well
     Canvas.Draw (30 , 30 , AnIcon); // Does not work!!!
     IF ShowModal = MrOk Then Result := True;
    Finally
     Form.Free;
    End;
 End; // With DialogForm
End;

----- end o' code ---------

Now!!!

I tried to Write DialogForm.form. Canvas.Draw (30 , 30 , AnIcon),
I tried anything! to unlock canvas, set copymode, tried to paint the icon on program's form (and It works).
I tried to paint the Icon with TImage. Nothing!!!

Can anyone help me ???

10x,

 Lior.

 

Re:Canvas' STRIKE ?!


Are you sure that the anIcon actual parameter is a tGraphic descendant (e.g.
tBitmap, tIcon, tMetafile, or tPicture), and that it contains a valid
graphic?

Also, instead of

if ShowModal = mrOk then result := True;

why not

result := ShowModal = mrOk;

Quote
lior <ro...@zahav.net.il> wrote in message

news:7jeu9q$ash$1@news2.inter.net.il...
Hi All!

I having a most wierd situation :

------ Delphi code ------

Type
 TDialogForm = Record
   Form : TForm;
   Prompt : TLabel;
  End;

Function Confirm (Const ACaption, APrompt: string; AnIcon : TGraphic ;
Buttons: TDialogBtns) : Boolean;

Var
  DialogForm : TDialogForm;

Begin
Result := False;
With DialogForm do
 Begin
  Form := TForm.Create(Application);
  With Form do
    Try
     Caption := ACaption; // works well
     Prompt.Caption := APrompt; // works well
     Canvas.Draw (30 , 30 , AnIcon); // Does not work!!!
     IF ShowModal = MrOk Then Result := True;
    Finally
     Form.Free;
    End;
 End; // With DialogForm
End;

----- end o' code ---------

Now!!!

I tried to Write DialogForm.form. Canvas.Draw (30 , 30 , AnIcon),
I tried anything! to unlock canvas, set copymode, tried to paint the icon on
program's form (and It works).
I tried to paint the Icon with TImage. Nothing!!!

Can anyone help me ???

10x,

 Lior.

Re:Canvas' STRIKE ?!


In article <7jeu9q$as...@news2.inter.net.il>,
  "lior" <ro...@zahav.net.il> wrote:
Quote
> This is a multi-part message in MIME format.

[...]
>      Canvas.Draw (30 , 30 , AnIcon); // Does not work!!!

[...]

    What is AnIcon? A valid TIcon instance? I doubt it.

Then "lior" <ro...@zahav.net.il> wrote again:

[...]

Quote
> Canvas.Draw (30 , 30 , AnIcon); <FONT color=3D#ff0000>// Does not=20
> work!!!</FONT></FONT></DIV>

[...]

     Once would be enough.

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.

Re:Canvas' STRIKE ?!


Hi there,

first, please don't crosspost messages, and post only in plain text.

Second: you're drawing on the canvas, after that you're showing the form.
The form gets drawn, but without the icon 'cause the canvas gets
invalidated. Maybe you can subclass TDialogForm, override the .Paint method,
or, attach an OnPaint eventhandler to it that does the icon drawing...

good luck!
--
Martijn Tonies

<- remove some characters from my email adress to reply ->
m.ton...@somecharacters.upscene.demon.nl
http://www.upscene.demon.nl

    lior heeft geschreven in bericht <7jeu9q$as...@news2.inter.net.il>...
    Hi All!

    I having a most wierd situation :

    ------ Delphi code ------

    Type
    TDialogForm = Record
       Form : TForm;
       Prompt : TLabel;
      End;

Re:Canvas' STRIKE ?!


In article <7jiptb$mr...@news1.xs4all.nl>,
  "Martijn Tonies" <sea...@dds.nl> wrote:
Quote
> Hi there,

> first, please don't crosspost messages, and post only in plain text.

> Second: you're drawing on the canvas, after that you're showing the

form.

      That's exactly the problem. Looking back I see I'm not the
only one who wasn't paying attention here.

Quote
> The form gets drawn, but without the icon 'cause the canvas gets
> invalidated. Maybe you can subclass TDialogForm, override the .Paint
method,
> or, attach an OnPaint eventhandler to it that does the icon drawing...

      An OnPaint would be the traditional way to handle this.

Quote
> good luck!
> --
> Martijn Tonies

> <- remove some characters from my email adress to reply ->
> m.ton...@somecharacters.upscene.demon.nl
> http://www.upscene.demon.nl

>     lior heeft geschreven in bericht

<7jeu9q$as...@news2.inter.net.il>...

Quote
>     Hi All!

>     I having a most wierd situation :

>     ------ Delphi code ------

>     Type
>     TDialogForm = Record
>        Form : TForm;
>        Prompt : TLabel;
>       End;

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.

Re:Canvas' STRIKE ?!


Thank you all!
You've been very helpfull and I've passed it thru ;)

Bye,

--

 Lior.
----------------> cr...@zahav.net.il

Other Threads