Solved

Canvas resize problem

Posted on 2007-03-30
6
277 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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 Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

733 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