Home > Back-end >  Dynamic creation form, Canvas. Pixels failure
Dynamic creation form, Canvas. Pixels failure

Time:10-10

First of all, I created a tform1, tform2
Then put the tform2 as the main window
Form1:=tform1. Create (nil);
Form1. ShowModal;
Form1. Free;
Form1:=nil;
Program is running after the problem, in the form1 image1 controls
Before image1. Canvas. Pixels [I, j] :=RGB (0, 0); Can
But now after the operation, no effect, the program is not an error don't know what this is

CodePudding user response:

Image1. Canvas. Pixels [I, j] :=RGB (0, 0); This sentence is written in the where?

CodePudding user response:


reference 1st floor LastAvengers response:
image1. Canvas. The Pixels [I, j] :=RGB (0, 0); This sentence is written in the where?


Write in form1

CodePudding user response:

Procedure TForm1. FormCreate (Sender: TObject);
Var
I, j: integer;
The begin
For I:=0 to 50 do
For j:=0 to 20 do
Image1. Canvas. Pixels [I, j] :=RGB (0, 0);
end;
Effectively, the above code to draw a black rectangle.

CodePudding user response:

The
reference 3 floor Oraclers response:
procedure TForm1. FormCreate (Sender: TObject);
Var
I, j: integer;
The begin
For I:=0 to 50 do
For j:=0 to 20 do
Image1. Canvas. Pixels [I, j] :=RGB (0, 0);
end;
Effectively, the above code to draw a black rectangle.

Create time is allowed, but put the code in the button will have no effect

CodePudding user response:

On the function of use and strange

CodePudding user response:

reference 5 floor jinpual111 reply:
on the function of use, strange

Procedure TForm1. Button1Click (Sender: TObject);
Var
I, j: integer;
The begin
For I:=0 to 50 do
For j:=0 to 20 do
Image1. Canvas. Pixels [I, j] :=RGB (0, 0);
end;

Procedure TForm1. FormCreate (Sender: TObject);
Var
I, j: integer;
The begin
For I:=100 to 200 the do
For j:=10 to 30 do
Image1. Canvas. Pixels [I, j] :=RGB (0255, 0);
end;
I put in a button can also, in the above code displayed when set up a green rectangle, click on the button shows black rectangle.

CodePudding user response:

refer to 6th floor Oraclers response:
Quote: refer to the fifth floor jinpual111 reply:

On the function of use, strange

Procedure TForm1. Button1Click (Sender: TObject);
Var
I, j: integer;
The begin
For I:=0 to 50 do
For j:=0 to 20 do
Image1. Canvas. Pixels [I, j] :=RGB (0, 0);
end;

Procedure TForm1. FormCreate (Sender: TObject);
Var
I, j: integer;
The begin
For I:=100 to 200 the do
For j:=10 to 30 do
Image1. Canvas. Pixels [I, j] :=RGB (0255, 0);
end;
I put in a button can also, in the above code displayed when set up a green rectangle, click on the button shows black rectangle.

This though useful, but I add the contents of an array to the cycle judgment is useless, and if not it's no problem for me to dynamically create a form, a dynamically created after the title of the window, the image pictures showed not to come out

CodePudding user response:

refer to 7th floor jinpual111 response:
Quote: refer to the sixth floor Oraclers response:

Quote: refer to the fifth floor jinpual111 reply:

On the function of use, strange

Procedure TForm1. Button1Click (Sender: TObject);
Var
I, j: integer;
The begin
For I:=0 to 50 do
For j:=0 to 20 do
Image1. Canvas. Pixels [I, j] :=RGB (0, 0);
end;

Procedure TForm1. FormCreate (Sender: TObject);
Var
I, j: integer;
The begin
For I:=100 to 200 the do
For j:=10 to 30 do
Image1. Canvas. Pixels [I, j] :=RGB (0255, 0);
end;
I put in a button can also, in the above code displayed when set up a green rectangle, click on the button shows black rectangle.

This though useful, but I add the contents of an array to the cycle judgment is useless, and if not it's no problem for me to dynamically create a form, a dynamically created after the title of the window, the image pictures couldn't show


Given the source code

CodePudding user response:

no code, no truth,

CodePudding user response:

My friend and I were stunned!
  • Related