Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Programming
»
Graphics and Multimedia
»
Graphics
(Moderator:
Ask
) »
Redrawing form
Free Pascal
Website
Downloads
Wiki
Documentation
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Documentation (RTL/FCL/LCL)
Bugtracker
CCR Bugs
IRC channel
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
IsManagedType problem, do...
by
marcov
[
Today
at 12:31:33 pm]
Lazarus character map
by
dseligo
[
Today
at 12:22:41 pm]
F8 step-over sometimes go...
by
ad1mt
[
Today
at 12:13:42 pm]
Using WebAssemblies
by
Laprado
[
Today
at 12:11:11 pm]
[Solved] Help with sql
by
magleft
[
Today
at 12:08:27 pm]
android
by
BlueIcaro
[
Today
at 11:41:53 am]
Combined pointer style
by
wp
[
Today
at 11:40:45 am]
Initiaiizing records by c...
by
Molochnik
[
Today
at 11:38:56 am]
Square Fractal: A bit dif...
by
Boleeman
[
Today
at 10:47:20 am]
Tpagecontrol descendant
by
dseligo
[
Today
at 10:29:02 am]
Here's some Pong game. Su...
by
Seenkao
[
Today
at 10:16:13 am]
lamw
by
dseligo
[
Today
at 09:35:00 am]
"fpc.cfg is missing" (not...
by
Thaddy
[
Today
at 08:55:31 am]
Fairtris 2: The Ultimate ...
by
TRon
[
Today
at 08:48:08 am]
A question on Modula2 vs ...
by
MarkMLl
[
Today
at 08:39:26 am]
Offical launch of the 1 B...
by
Thaddy
[
Today
at 08:37:40 am]
Indeed TCustomApplication...
by
Gustavo 'Gus' Carreno
[
Today
at 08:22:53 am]
Hypocycloid Program (incl...
by
speter
[
Today
at 05:33:19 am]
Designer
by
SandyG
[
Today
at 03:20:24 am]
Best way to exchange data...
by
cdbc
[
Today
at 03:00:24 am]
scanline example
by
speter
[
Today
at 12:12:12 am]
Pack
by
domasz
[March 18, 2024, 10:24:35 pm]
Conflict when static link...
by
tetrastes
[March 18, 2024, 10:05:28 pm]
Interesting discovery wit...
by
wp
[March 18, 2024, 09:11:23 pm]
Use Lazarus 3.2 with FPC ...
by
AxBen
[March 18, 2024, 08:56:42 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: Redrawing form (Read 1231 times)
pascal111
Sr. Member
Posts: 423
Un trabajo en equipo para programas serias.
Redrawing form
«
on:
April 21, 2021, 03:38:06 am »
I'm trying in the next piece of code to delay the drawing of line of pixels to see some motion, but I failed to make the form to redraw itself again each determined time of "delay" procedure:
Code: Pascal
[Select]
[+]
[-]
procedure
TForm1
.
FormPaint
(
Sender
:
TObject
)
;
var
i
:
integer
;
begin
for
i
:
=
1
to
100
do
begin
canvas
.
Pixels
[
i
,
10
]
:
=
clblue
;
self
.
update
;
delay
(
100
)
;
end
;
end
;
Logged
La chose par la chose est rappelé.
engkin
Hero Member
Posts: 3112
Re: Redrawing form
«
Reply #1 on:
April 21, 2021, 04:11:11 am »
After delay call Application.ProcessMessages.
The correct way is to use a timer.
If you draw on the form, it will not retain the image when covered with some other window.
«
Last Edit: April 21, 2021, 04:17:35 am by engkin
»
Logged
engkin
Hero Member
Posts: 3112
Re: Redrawing form
«
Reply #2 on:
April 21, 2021, 04:59:46 am »
Check attached project
Logged
pascal111
Sr. Member
Posts: 423
Un trabajo en equipo para programas serias.
Re: Redrawing form
«
Reply #3 on:
April 21, 2021, 01:25:57 pm »
I made some changes depending on attached project "simple", and it works.
Code: Pascal
[Select]
[+]
[-]
var
Form1
:
TForm1
;
x
:
integer
;
procedure
TForm1
.
FormPaint
(
Sender
:
TObject
)
;
begin
canvas
.
Pixels
[
x
,
10
]
:
=
clblue
;
end
;
procedure
TForm1
.
Timer1Timer
(
Sender
:
TObject
)
;
begin
if
x>
=
100
then
exit
else
inc
(
x
)
;
Invalidate
;
end
;
With modifying "interval" property of the timer.
Logged
La chose par la chose est rappelé.
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
Graphics and Multimedia
»
Graphics
(Moderator:
Ask
) »
Redrawing form
TinyPortal
© 2005-2018