Solved

Canvas resize problem

Posted on 2007-03-30
6
273 Views
Last Modified: 2010-04-05
Dear Experts,

I still have a resize problem with my telnet-example, its making me grazy.
I have put 2 pictures on my site to demonstrate what happens when I resize
my form. In de first picture you see the rows and colums when I select the text
with the mouse. And when I resize the form smaller you see the rows and columns
dissapear (picture2). It has to be like picture 2 no mather how i resize the form you
may never see the rows and columns.

Who can help me?

This is the address of my site:  http://members.home.nl/peterkiers/
Underneath the Under Construction bar you see a floppy disk
click on it to download my example, and under the floppy disk
you see 2 pictures.

Greetings,

Peter  
0
Comment
Question by:peterkiers
  • 3
  • 2
6 Comments
 
LVL 28

Accepted Solution

by:
TName earned 250 total points
ID: 18826107
Hi, Peter, the raster-like design of the project doesn't really allow for smooth resizing (especially of a selection).
Anyway, here is a little workaround, try this (and TEST IT!):

Replace your DispCell procedure with this one:



procedure TMainForm.DispCell(x, y: integer; PaintBlanks: boolean);
var
  xpos, ypos: integer;
  r:TRect;                         //Added
begin
  xpos := (x * FontWidthPix) - FontWidthPix;
  ypos := (y * FontHeightPix) - FontHeightPix;
  with Canvas do
  begin
    Brush.Style := bsSolid;
    Brush.Color := ColorBlack;
    if (ScrBuf[y, x].data = Char(cdDefault)) or
      (ScrBuf[y, x].data = Char(cdFieldAttr)) then
    begin
      if PaintBlanks then
      begin
        Font.Style := [];
        TextOut(xpos, ypos, ' ');
      end;
    end
    else
    begin
      if (Byte(ScrBuf[y, x].attrib) and caNonDisp) <> caNonDisp then
      begin
        Pen.Mode := pmCopy;
        Font.Color := ColorMapI2W(ScrBuf[y, x].color);
        if ScrBuf[y, x].hilite = Char(chDefault) then
          Font.Style := []
        else if ScrBuf[y, x].hilite = Char(chReverse) then
        begin
          Font.Style := [];
          Pen.Mode := pmXor;
          Brush.Color := ColorMapI2W(ScrBuf[y, x].color);
          Font.Color := ColorBlack;
        end
        else if ScrBuf[y, x].hilite = Char(chUnderLine) then
          Font.Style := [fsUnderline]
        else if ScrBuf[y, x].hilite = Char(chBlink) then
          Font.Style := [fsStrikeout]
        else
          Font.Style := [];
        if (Byte(ScrBuf[y, x].attrib) and caIntens) = caIntens then
          Font.Style := Font.Style + [fsBold];

         r := Rect(xpos,ypos,xpos+(FontWidthPix ),ypos+(FontHeightPix ));     //Added
         canvas.FillRect(r);                                                                         //Added

         TextOut(xpos, ypos, ScrBuf[y, x].data);
      end
      else
        TextOut(xpos, ypos, ' ');
    end;
  end;
end;
(*--------------------------------------*)

0
 
LVL 1

Author Comment

by:peterkiers
ID: 18828045
Hi TName,

I have tested your example and it works fine, only another
fault appears. The CURSOR is vanished. When i choose menu-
item Fill buffer to fill the canvas with characters and numbers
and then when I click on a certain cell the cursor will not be dis-
played. And it's their but not showing. Because when I choose
the cursor to blink, by choosing menu-item Timer on/off, the cur-
sor appears again. But the cursor has to be always on the canvas
blinking or not blinking.

But the resizing works great.

Peter
0
 
LVL 28

Expert Comment

by:TName
ID: 18828108
Glad you've tested it ;o)
I'll have a look at it this evening, if no one else does it.
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 10

Assisted Solution

by:dinilud
dinilud earned 250 total points
ID: 18828407
procedure TMainForm.FormMouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  if Bounding then
  begin
    Bounding := False;
    CurX := X;
    CurY := Y;
  end;
  DrawCursor(CsrCol, CsrRow)
end;
0
 
LVL 28

Expert Comment

by:TName
ID: 18828663
That should indeed work. Then you can delete
DrawCursor(CsrCol, CsrRow);
from the FormMouseDown() procedure...

0
 
LVL 1

Author Comment

by:peterkiers
ID: 18828946
Hi, I have tested it and it works great.

Thank to you all.

Point will be devided.

greetings,

Peter Kiers
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now