Home > Back-end >  Delphi canvas mapping problem.
Delphi canvas mapping problem.

Time:09-25

Question: I created a groupbox in Panel1, then to groupbox canvas drawing, the results drawn graphics how also show not to come out, and if I before drawing canvas. Unlock carried out after completion of drawing canvas. The lock, I draw the results of the image is displayed, but what other controls won't display normal, why is this?

CodePudding user response:

Sure enough to sink, who come to the water, come on

CodePudding user response:

Why don't the code? So you describe want somebody else to guess where there is something wrong with you? Suggest you look at the
reference
questions of art

CodePudding user response:

You got, should be:
Canvas. The lock;
//drawing
Canvas. Unlock;

CodePudding user response:

reference DelphiGuy reply: 3/f
you got, should be:
Canvas. The lock;
//drawing
Canvas. Unlock;


Not against, even as you said, is not enough, I've tried, but it doesn't matter, I was going to within a Groupbox manually draw a histogram, then feel no, simply use the TChart control, convenient,

CodePudding user response:

GroupBox himself will draw your map should be drawn in GroupBox control itself before they can,
You put the rendering code to move the position, or overloading GroupBox drawing process,

CodePudding user response:

This matter have to write a own groupbox, inherit groupbox, then override the paint method, the parameters of the need to pass in the groupbox some of the properties or methods,
Other practices are not the Delphi logic code is implemented,

CodePudding user response:

Too long didn't touch the DELPHI, tried, as if there's no problem of LZ said, how do you write?
I write this test, directly in the main window OnPaint, seems everything is normal, other controls also unaffected

 
Procedure TForm1. FormPaint (Sender: TObject);
Var
Cc: TControlCanvas;
The begin
Cc:=TControlCanvas. Create;
Cc. Control:=Self. Grp1;
//draw two square
Cc. Brush. Color:=clRed;
Cc. A Rectangle (80, 20, 50, 50);
Cc. Brush. Color:=clYellow;
Cc. A Rectangle (100, 20, 130, 50);
Cc. Free;
end;


CodePudding user response:

refer to 7th floor sololie response:
for a long time didn't touch the DELPHI, tried, as if there's no problem of LZ said, how do you write?
I write this test, directly in the main window OnPaint, seems everything is normal, other controls also unaffected

 
Procedure TForm1. FormPaint (Sender: TObject);
Var
Cc: TControlCanvas;
The begin
Cc:=TControlCanvas. Create;
Cc. Control:=Self. Grp1;
//draw two square
Cc. Brush. Color:=clRed;
Cc. A Rectangle (80, 20, 50, 50);
Cc. Brush. Color:=clYellow;
Cc. A Rectangle (100, 20, 130, 50);
Cc. Free;
end;



Know that because I don't have in the main Form in the paint event processing so led to my own problem,, thanks,

CodePudding user response:

refer to 7th floor sololie response:
for a long time didn't touch the DELPHI, tried, as if there's no problem of LZ said, how do you write?
I write this test, directly in the main window OnPaint, seems everything is normal, other controls also unaffected

 
Procedure TForm1. FormPaint (Sender: TObject);
Var
Cc: TControlCanvas;
The begin
Cc:=TControlCanvas. Create;
Cc. Control:=Self. Grp1;
//draw two square
Cc. Brush. Color:=clRed;
Cc. A Rectangle (80, 20, 50, 50);
Cc. Brush. Color:=clYellow;
Cc. A Rectangle (100, 20, 130, 50);
Cc. Free;
end;




By the way, ask you a question: I add in the TChart PieSeries pie charts data
PieSeries. AddPie (70, 'real-time performance, clgreen);
PieSeries. AddPie (30 'remaining effectiveness, clred);
As long as I put the Label attribute of pie charts don't written Numbers can't show the pie charts to oh,,, if I use the '1' '2' to replace "and" surplus "and" real-time performance efficiency 'and, according to the pie charts can be normal,

If this is the way I open the wrong oh? Or my attitude is wrong oh,
  • Related