Solved

Canvas resize problem

Posted on 2007-03-30
6
278 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

 
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses
Course of the Month9 days, 13 hours left to enroll

624 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