![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 4 of 4 total |
![]() |
Sat, May 30 2015 12:34 AM | Permanent Link |
Bruno Larochelle | g'day
this is NOT a question for Sir Tim (who is busy!), but if there is a Uri/Matthew/Raul/Chris/other expert who has run in to this.. i'd love your advice.. ![]() this is a v1 question, and I know that things have changed in v2 with TCanvas (so it does not apply to v2 at all) I'm trying to draw using on the canvas using a pattern (image) : pntMain.canvas.fillStyle := dsPattern; pntMain.canvas.fillPattern.imageName := 'clouds.png'; pntMain.canvas.fillPattern.repeatStyle := rsBoth; pntMain.canvas.fillRect(0,0,300,300); this gives an error at run-time saying 'clouds.png' not loaded If however, in the same mini project, I use a simple TImage, with similar specification, that works fine and it loads the image: image1.imageName := 'clouds.png'; so.. somehow, the 'imageName' is being treated differently for the TCanvas.fillPattern.imageName vs. the TImage.imageName. regards.. Bruno |
Sat, May 30 2015 6:14 PM | Permanent Link |
Chris Holland SEC Solutions Ltd. ![]() | You are not giving the image time to load.
Either try this: procedure TForm1.Form1Create(Sender: TObject); begin pntMain.canvas.fillStyle := dsPattern; pntMain.canvas.fillPattern.imageName := 'house.png'; pntMain.canvas.fillPattern.repeatStyle := rsBoth; CanvasTimer.Enabled := true; end; procedure TForm1.CanvasTimerTimer(Sender: TObject); begin CanvasTimer.Enabled := false; pntMain.canvas.fillRect(0,0,300,300); end; I set the Timer delay to 10ms and it worked. The other option would be to use a TCanvasImage and keep calling the timer until the 'Loaded' flag for the TCanvasImage is set to true. Hope this helps. Chris Holland [Team Elevate] On 30/05/2015 05:34, Bruno Larochelle wrote: > g'day > > this is NOT a question for Sir Tim (who is busy!), but if there is a Uri/Matthew/Raul/Chris/other expert who has run in to this.. i'd love your advice.. ![]() > > this is a v1 question, and I know that things have changed in v2 with TCanvas (so it does not apply to v2 at all) > > > I'm trying to draw using on the canvas using a pattern (image) : > > pntMain.canvas.fillStyle := dsPattern; > pntMain.canvas.fillPattern.imageName := 'clouds.png'; > pntMain.canvas.fillPattern.repeatStyle := rsBoth; > pntMain.canvas.fillRect(0,0,300,300); > > this gives an error at run-time saying 'clouds.png' not loaded > > If however, in the same mini project, I use a simple TImage, with similar specification, that works fine and it loads the image: > > image1.imageName := 'clouds.png'; > > > so.. somehow, the 'imageName' is being treated differently for the TCanvas.fillPattern.imageName vs. the TImage.imageName. > > > regards.. Bruno > |
Sat, May 30 2015 11:54 PM | Permanent Link |
Bruno Larochelle | thanks Chris, I keep learning the tricks from the masters! that worked exactly as described
.. Bruno Chris Holland wrote: You are not giving the image time to load. Either try this: procedure TForm1.Form1Create(Sender: TObject); begin pntMain.canvas.fillStyle := dsPattern; pntMain.canvas.fillPattern.imageName := 'house.png'; pntMain.canvas.fillPattern.repeatStyle := rsBoth; CanvasTimer.Enabled := true; end; procedure TForm1.CanvasTimerTimer(Sender: TObject); begin CanvasTimer.Enabled := false; pntMain.canvas.fillRect(0,0,300,300); end; I set the Timer delay to 10ms and it worked. The other option would be to use a TCanvasImage and keep calling the timer until the 'Loaded' flag for the TCanvasImage is set to true. Hope this helps. Chris Holland [Team Elevate] On 30/05/2015 05:34, Bruno Larochelle wrote: > g'day > > this is NOT a question for Sir Tim (who is busy!), but if there is a Uri/Matthew/Raul/Chris/other expert who has run in to this.. i'd love your advice.. ![]() > > this is a v1 question, and I know that things have changed in v2 with TCanvas (so it does not apply to v2 at all) > > > I'm trying to draw using on the canvas using a pattern (image) : > > pntMain.canvas.fillStyle := dsPattern; > pntMain.canvas.fillPattern.imageName := 'clouds.png'; > pntMain.canvas.fillPattern.repeatStyle := rsBoth; > pntMain.canvas.fillRect(0,0,300,300); > > this gives an error at run-time saying 'clouds.png' not loaded > > If however, in the same mini project, I use a simple TImage, with similar specification, that works fine and it loads the image: > > image1.imageName := 'clouds.png'; > > > so.. somehow, the 'imageName' is being treated differently for the TCanvas.fillPattern.imageName vs. the TImage.imageName. > > > regards.. Bruno > |
Sun, May 31 2015 4:10 AM | Permanent Link |
Rick | On 30/05/15 14:34, Bruno Larochelle wrote:
> I'm trying to draw using on the canvas using a pattern (image) : > > pntMain.canvas.fillStyle := dsPattern; > pntMain.canvas.fillPattern.imageName := 'clouds.png'; > pntMain.canvas.fillPattern.repeatStyle := rsBoth; > pntMain.canvas.fillRect(0,0,300,300); > > this gives an error at run-time saying 'clouds.png' not loaded > > Have a look at TCanvasImage for pre-loading images to be used by the canvas. It has an OnLoad event that you can use once the image has completed loading. -- Rick |
This web page was last updated on Thursday, April 3, 2025 at 06:55 PM | Privacy Policy![]() © 2025 Elevate Software, Inc. All Rights Reserved Questions or comments ? ![]() |