Home > Back-end >  Draw a straight line problem on StringGrid,
Draw a straight line problem on StringGrid,

Time:09-25


(figure 1) above, to achieve the effect, on line is not even in a number of grid,

the current effect

Draw a straight line on the StringGrid, achieve the result of (figure 1), the line is shorter, a great god, please help,

CodePudding user response:

Draw lines of code to stick to Chou Chou?
I first thought is finished first invalidaterect update to specify the content of the cell to clear across the line

CodePudding user response:

Grid line drawing, and then draw the scarlet letter, only can

CodePudding user response:


//the begin==================span attachment code=================================
If (ACol>=span of attachment 1) and (ACol 0) and (Arow> 1) then
The begin
If TempStr<> "' then
The begin
If Arow=2 then
The begin
Span wires x1:=round ((the Rect. Left + the Rect. Right)/2);
Attachment x2 span:=round ((the Rect. Top + the Rect. Bottom)/2)
End
The else
The begin
Span wires y1:=round ((the Rect. Left + the Rect. Right)/2);
Span wires y2:=round ((the Rect. Top + the Rect. Bottom)/2)
end;
end;
If (ACol attachment 1 +=span span of attachment 2-1) and (Arow> 2) then
The begin
Canvas. Pen. Width:=2;
Canvas. Pen. Color:=ztColor;
Canvas. MoveTo (span span attachment x1, x2) attachment;
Canvas. LineTo (span span the attachment y1, y2 attachment);
Span span wires x1:=y1 attachment;
Attachment x2 span: attachment y2=span;
end;
end;
//end====================span attachment code=================================


Attachment code, when performing to the current case, the corresponding grid connected on a line, so can't draw the line, even frame again

CodePudding user response:

Can be finished, then simply draw a grid

CodePudding user response:

It will take a lot of judgment?

CodePudding user response:

reference 5 floor zmingits reply:
it will take a lot of judgment?


The same since the draw function drawall (NoLine: Boolean), by a Boolean variable to determine whether line painting
The original function is changed to:
Drawall (true);
Drawall (false);

CodePudding user response:

Thank you, still don't understand.

CodePudding user response:

refer to 7th floor zmingits response:
thank you, still don't understand.


Put your original XXX since the draw function transformation, increase a parameter NoLine: Boolean
Inside painting lines of code, instead of all to decide whether to execute by NoLine

The original painting is XXX (false);

The requirements of the new painting is
XXX (false);
XXX (true);