Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Canvas resize problem

Posted on 2007-03-30
6
Medium Priority
?
279 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 1000 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 10

Assisted Solution

by:dinilud
dinilud earned 1000 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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

705 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