Q&A

  • 이미지 스크롤은 어떻게 하나요?


폼에 이미지 컴포넌트를 넣고

이미지를 불러 들였습니다만,



화면크기보다 이미지가 더 크기 때문에

아래 부분은 보이지 않습니다.



원본을 축소시키지 않고 보고싶기 때문에

스크롤을 사용하여 아래,좌우로 이동하여

보고 싶은데...



기본적으로 지원되는 컴포넌트를 이용하여

그림 스크롤을 만들수있는지요???

4  COMMENTS
  • Profile
    구민오 1999.02.05 11:02
    인터넷 익스플로러나 시작 버튼을 누르면 나오는 실행...을 통해서 URL을 집어 넣을 경우 이 주소 메세지가 어디론가 전해 지지 않습니까???

    아마도 전해 지겠죠... 그 메세지를 가로채고 싶습니다... 어떤 메세지가 발생하고 URL은 어디에 담겨져서 전달 되는지 궁금합니다..

    꼭 좀 알려주세요~~~!!!



  • Profile
    전철호 1999.06.07 20:06
    chobo 께서 말씀하시기를...

    >

    > 폼에 이미지 컴포넌트를 넣고

    > 이미지를 불러 들였습니다만,

    >

    > 화면크기보다 이미지가 더 크기 때문에

    > 아래 부분은 보이지 않습니다.

    >

    > 원본을 축소시키지 않고 보고싶기 때문에

    > 스크롤을 사용하여 아래,좌우로 이동하여

    > 보고 싶은데...

    >

    > 기본적으로 지원되는 컴포넌트를 이용하여

    > 그림 스크롤을 만들수있는지요???



    다음은 이미지를 스크롤하는 콤포넌트 소스입니다.

    참고하시면 위의 문제를 해결 하시는 데 도움이 될것입니다.



    [소스]

    unit ZImage;



    interface



    uses

    Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,

    ExtCtrls;



    type

    TZImage = class(TGraphicControl)

    private

    FBitmap : TBitmap;

    PicRect : TRect;

    ShowRect : TRect;

    FShowBorder : boolean;

    FBorderWidth : integer;

    FForceRepaint : boolean;

    FMouse : (mNone, mDrag, mZoom);

    FProportional : boolean;

    FDblClkEnable : boolean;

    startx, starty,

    oldx, oldy : integer;

    procedure SetShowBorder(s:boolean);

    procedure SetBitmap(b:TBitmap);

    procedure SetBorderWidth(w:integer);

    procedure SetProportional(b:boolean);

    protected

    procedure Paint; override;

    procedure DblClick; override;

    procedure MouseDown(Button: TMouseButton; Shift: TShiftState;

    X, Y: Integer); override;

    procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;

    procedure MouseUp(Button: TMouseButton; Shift: TShiftState;

    X, Y: Integer); override;

    public

    constructor Create(AOwner:TComponent); override;

    destructor Destroy; override;

    published

    property ShowBorder : boolean

    read FShowBorder

    write SetShowBorder default true;

    property KeepAspect : boolean

    read FProportional

    write SetProportional default true;

    property Bitmap : TBitmap

    read FBitmap

    write SetBitmap;

    property BorderWidth : integer

    read FBorderWidth

    write SetBorderWidth default 7;

    property ForceRepaint : boolean

    read FForceRepaint

    write FForceRepaint default true;

    property DblClkEnable : boolean

    read FDblClkEnable

    write FDblClkEnable default False;

    property Align;

    property Width;

    property Height;

    property Top;

    property Left;

    property Visible;

    property Hint;

    property ShowHint;

    end;



    procedure Register;



    implementation



    constructor TZImage.Create(AOwner:TComponent);

    begin

    inherited;

    FShowBorder:=True;

    FBorderWidth:=7;

    FMouse:=mNone;

    FForceRepaint:=True;

    FDblClkEnable:=False;

    FProportional:=True;

    Width:=100; Height:=100;

    FBitmap:=TBitmap.Create;

    FBitmap.Width:=Width;

    FBitmap.Height:=Height;

    ControlStyle:=ControlStyle+[csOpaque];

    end;



    destructor TZImage.Destroy;

    begin

    FBitmap.Free;

    inherited;

    end;



    procedure TZImage.Paint;

    var buf:TBitmap;

    coef,asps,aspp:Double;

    sz,a : integer;

    begin

    buf:=TBitmap.Create;

    buf.Width:=Width;

    buf.Height:=Height;

    if not FShowBorder

    then ShowRect:=ClientRect

    else ShowRect:=Rect(ClientRect.Left,ClientRect.Top,

    ClientRect.Right-FBorderWidth,

    ClientRect.Bottom-FBorderWidth);

    with PicRect do begin

    if Right=0 then Right:=FBitmap.Width;

    if Bottom=0 then Bottom:=FBitmap.Height;

    end;

    if FProportional then begin

    asps:=ShowRect.Bottom/ShowRect.Right;

    //IF added in v.1.2 to avoid zero-divide

    if (PicRect.Right=PicRect.Left)

    then

    aspp := 1

    else

    aspp := (PicRect.Bottom-PicRect.Top)/(PicRect.Right-PicRect.Left);

    if asps>aspp then begin //PicRect is wider

    sz:=Round((PicRect.Bottom-PicRect.Top)/asps);

    a:=PicRect.Right-PicRect.Left;

    PicRect.Left:=PicRect.Left+(a-sz) div 2;

    PicRect.Right:=PicRect.Left+sz;

    end else begin //PicRect is taller

    sz:=Round((PicRect.Right-PicRect.Left)*asps);

    a:=PicRect.Bottom-PicRect.Top;

    PicRect.Top:=PicRect.Top+(a-sz) div 2;

    PicRect.Bottom:=PicRect.Top+sz;

    end;

    if PicRect.Left<0 then MessageBeep(0);

    if PicRect.Top<0 then MessageBeep(0);

    end;

    buf.Canvas.CopyMode:=cmSrcCopy;

    buf.Canvas.CopyRect(ShowRect,FBitmap.Canvas,PicRect);

    if FShowBorder then begin

    buf.Canvas.Brush.Color:=clWhite;

    buf.Canvas.Rectangle(Width-BorderWidth,0,Width,Height-BorderWidth);

    buf.Canvas.Rectangle(0,Height-BorderWidth,Width-BorderWidth,Height);

    buf.Canvas.Brush.Color:=clSilver;

    buf.Canvas.Rectangle(Width-BorderWidth-1,Height-BorderWidth-1,buf.Width,Height);

    //horizontal zoom indicator

    coef:=(Width-BorderWidth)/FBitmap.Width;

    buf.Canvas.Rectangle(

    Round(PicRect.Left*coef)+2, Height-BorderWidth+2,

    Round(PicRect.Right*coef)-2, Height-2);

    //vertical zoom indicator

    coef:=(Height-BorderWidth)/FBitmap.Height;

    buf.Canvas.Rectangle(

    Width-BorderWidth+2,Round(PicRect.Top*coef)+2,

    Width-2, Round(PicRect.Bottom*coef)-2);

    end;

    Canvas.CopyMode:=cmSrcCopy;

    Canvas.Draw(0,0,buf);

    buf.Free;

    end;



    procedure TZImage.MouseDown(Button: TMouseButton; Shift: TShiftState;

    X, Y: Integer);

    begin

    if not PtInRect(ShowRect,Point(X,Y)) and

    not PtInRect(Rect(ShowRect.Right,ShowRect.Bottom,

    Width,Height),Point(X,Y)) then Exit;

    if PtInRect(Rect(ShowRect.Right,ShowRect.Bottom,

    Width,Height),Point(X,Y)) then begin

    DblClick;

    Exit;

    end;



    startx:=x; oldx:=x;

    starty:=y; oldy:=y;

    if mbRight=Button then begin

    MouseCapture:=True;

    FMouse:=mZoom;

    Canvas.Pen.Mode:=pmNot;

    end else begin

    FMouse:=mDrag;

    Screen.Cursor:=crHandPoint;

    end;

    end;



    function Min(a,b:integer):integer;

    begin

    if a
    end;

    function Max(a,b:integer):integer;

    begin

    if a
    end;



    procedure TZImage.MouseMove(Shift: TShiftState; X, Y: Integer);

    var d,s:integer;

    coef:Double;

    begin

    if FMouse=mNone then Exit;

    if FMouse=mZoom then begin

    Canvas.DrawFocusRect(Rect(Min(startx,oldx),Min(starty,oldy),Max(startx,oldx),Max(starty,oldy)));

    oldx:=x; oldy:=y;

    Canvas.DrawFocusRect(Rect(Min(startx,oldx),Min(starty,oldy),Max(startx,oldx),Max(starty,oldy)));

    end;

    if FMouse=mDrag then begin

    //horizontal movement

    coef:=(PicRect.Right-PicRect.Left)/(ShowRect.Right-ShowRect.Left);

    d:=Round(coef*(x-oldx));

    s:=PicRect.Right-PicRect.Left;

    if d>0 then begin

    if PicRect.Left>=d then begin

    PicRect.Left:=PicRect.Left-d;

    PicRect.Right:=PicRect.Right-d;

    end else begin

    PicRect.Left:=0;

    PicRect.Right:=PicRect.Left+s;

    end;

    end;

    if d<0 then begin

    if PicRect.Right
    PicRect.Left:=PicRect.Left-d;

    PicRect.Right:=PicRect.Right-d;

    end else begin

    PicRect.Right:=FBitmap.Width;

    PicRect.Left:=PicRect.Right-s;

    end;

    end;



    //vertical movement

    coef:=(PicRect.Bottom-PicRect.Top)/(ShowRect.Bottom-ShowRect.Top);

    d:=Round(coef*(y-oldy));

    s:=PicRect.Bottom-PicRect.Top;

    if d>0 then begin

    if PicRect.Top>=d then begin

    PicRect.Top:=PicRect.Top-d;

    PicRect.Bottom:=PicRect.Bottom-d;

    end else begin

    PicRect.Top:=0;

    PicRect.Bottom:=PicRect.Top+s;

    end;

    end;



    if d<0 then begin

    if PicRect.Bottom
    PicRect.Top:=PicRect.Top-d;

    PicRect.Bottom:=PicRect.Bottom-d;

    end else begin

    PicRect.Bottom:=FBitmap.Height;

    PicRect.Top:=PicRect.Bottom-s;

    end;

    end;





    oldx:=x; oldy:=y;

    if FForceRepaint then Repaint

    else Invalidate;

    end;

    end;



    procedure TZImage.MouseUp(Button: TMouseButton; Shift: TShiftState;

    X, Y: Integer);

    var coef:Double;

    t:integer;

    begin

    if FMouse=mNone then Exit;

    if x>ShowRect.Right then x:=ShowRect.Right;

    if y>ShowRect.Bottom then y:=ShowRect.Bottom;

    if FMouse=mZoom then begin //calculate new PicRect

    t:=startx;

    startx:=Min(startx,x);

    x:=Max(t,x);

    t:=starty;

    starty:=Min(starty,y);

    y:=Max(t,y);

    FMouse:=mNone;

    MouseCapture:=False;

    if Abs(x-startx)<5 then Exit;



    if (PicRect.Right=PicRect.Left)

    then

    coef := 100000

    else

    coef:=ShowRect.Right/(PicRect.Right-PicRect.Left);

    PicRect.Left:=Round(PicRect.Left+startx/coef);

    PicRect.Right:=PicRect.Left+Round((x-startx)/coef);

    if (PicRect.Bottom=PicRect.Top)

    then

    coef := 100000

    else

    coef:=ShowRect.Bottom/(PicRect.Bottom-PicRect.Top);

    PicRect.Top:=Round(PicRect.Top+starty/coef);

    PicRect.Bottom:=PicRect.Top+Round((y-starty)/coef);

    end;

    if FMouse=mDrag then begin

    FMouse:=mNone;

    Canvas.Pen.Mode:=pmCopy;

    Screen.Cursor:=crDefault;

    end;

    Invalidate;

    end;



    procedure TZImage.DblClick;

    begin

    PicRect:=Rect(0,0,FBitmap.Width,FBitmap.Height);

    Invalidate;

    end;



    procedure TZImage.SetBitmap(b:TBitmap);

    begin

    FBitmap.Assign(b);

    PicRect:=Rect(0,0,b.Width, b.Height);

    Invalidate;

    end;



    procedure TZImage.SetBorderWidth(w:integer);

    begin

    FBorderWidth:=w;

    Invalidate;

    end;



    procedure TZImage.SetShowBorder(s:boolean);

    begin

    FShowBorder:=s;

    Invalidate;

    end;



    procedure TZImage.SetProportional(b:boolean);

    begin

    FProportional:=b;

    Invalidate;

    end;



    procedure Register;

    begin

    RegisterComponents('Custom', [TZImage]);

    end;



  • Profile
    이정욱 1999.02.06 09:54
    인터넷 프로그래밍을 하시면서 유해정보차단장치를 만드신다고 하셨는데 그것을 통제하는 방법은 있습니다.

    Winsocket을 Spy하시면 됩니다.

    이것을 이것을 후킹하여 스파이를 하는것이죠. 그러다가 유해정보에 관련된 URL이나 아니면 심지어 본문내용까지 관여할 수 있게 되는것입니다.

    이것을 하는것은 GetRight의 방법(정확히는 모르지만)을 해킹(?)해보시는것도 좋을듯 싶습니다.



    구민오 wrote:

    > 인터넷 익스플로러나 시작 버튼을 누르면 나오는 실행...을 통해서 URL을 집어 넣을 경우 이 주소 메세지가 어디론가 전해 지지 않습니까???

    > 아마도 전해 지겠죠... 그 메세지를 가로채고 싶습니다... 어떤 메세지가 발생하고 URL은 어디에 담겨져서 전달 되는지 궁금합니다..

    > 꼭 좀 알려주세요~~~!!!

    >





  • Profile
    이정욱 1999.02.06 01:57
    메세지가 발생하면서 전달이 되지는 않을것 같다는것이 제 의견입니다.

    그냥 IE는 ActiveX콘트롤로써 그부분의 프로퍼티가 있을것입니다.

    프로퍼티의 값을 바꾼다고 해서 메세지가 발생하지는 않죠.



    구민오 wrote:

    > 인터넷 익스플로러나 시작 버튼을 누르면 나오는 실행...을 통해서 URL을 집어 넣을 경우 이 주소 메세지가 어디론가 전해 지지 않습니까???

    > 아마도 전해 지겠죠... 그 메세지를 가로채고 싶습니다... 어떤 메세지가 발생하고 URL은 어디에 담겨져서 전달 되는지 궁금합니다..

    > 꼭 좀 알려주세요~~~!!!

    >





    • 이재훈
    • 1999.06.08 03:10
    • 4 COMMENTS
    • /
    • 0 LIKES
    • 홍지선
      1999.02.09 19:34
      TextGrid 에서 입력을 할때 숫자의 경우 오른쪽으로 정렬하고 입력할때도 오른쪽부터 해야 되는데 어떻게...
    • 바이도
      1999.06.08 18:15
      Update TESTTABLE set AAFIELD = ' ' where AAFIELD is null; TESTTABLE : TABLE NAME AAFIELD ...
    • 안치봉
      1999.02.10 19:41
      홍지선 wrote: > TextGrid 에서 입력을 할때 > 숫자의 경우 오른쪽으로 정렬하고 입력할때도 오른쪽부터 ...
    • 송기원
      1999.06.08 03:19
      Update 테이블이름 set 컬럼이름 = null where 조건문 Ex. Update Employee set new_salary = null ...
    • 황하강
    • 1999.06.08 02:59
    • 3 COMMENTS
    • /
    • 0 LIKES
    • 강영구
      1999.02.10 19:32
      델파이에 관해서 찾다보니..이곳까지..왔습니다. 아래..질문과 답을 조금 보다보니... 나이렉스라는 곳에...
    • 김영대
      1999.06.08 18:57
      황하강 께서 말씀하시기를... > 질문] > 델파이 2 에서 TCP/IP를 이용해서 서버와 데이타를 주고 받는 ...
    • 신재민
      1999.02.10 21:53
      저희 나이렉스는 서초동에 있습니다. 전화는 521-7900 입니다. 강영구 wrote: > 델파이에 관해서 찾다...
    • 구민오
    • 1999.02.10 11:23
    • 2 COMMENTS
    • /
    • 0 LIKES
    • 박정현
      1999.06.08 02:47
      안녕하세요. 전 Access하구 델파이하구 연결 해서 쓰고 있는데요. 입력을 시켜 놓구 다시 그행에 가서 필...
    • 안치봉
      1999.02.10 19:03
      구민오 wrote: > 폼에 그라이데이션효과를 주려면 어떻게 해야하나요??? > procedure TForm1.FormPai...
    • 구민오
    • 1999.02.10 11:23
    • 3 COMMENTS
    • /
    • 0 LIKES
    • 마성수
      1999.06.08 02:19
      도스에서 copy test*.txt error.txt라고 치면 error.text에는 test1.txt와 test2.txt란 화일이 합쳐져 있...
    • 안치봉
      1999.02.10 19:03
      구민오 wrote: > 폼에 그라이데이션효과를 주려면 어떻게 해야하나요??? > procedure TForm1.FormPai...
    • 안치봉
      1999.06.08 03:41
      마성수 께서 말씀하시기를... > 도스에서 copy test*.txt error.txt라고 치면 > error.text에는 test1.tx...
    • 홍지선
    • 1999.02.09 19:34
    • 3 COMMENTS
    • /
    • 0 LIKES
    • 궁금이
      1999.06.08 00:33
      Query를 사용하여 Data를 Select한 후, 정의된 Pointer에 맞게끔 데이타를 넣고 TreeView에 Add하였습니다...
    • 안치봉
      1999.02.10 19:41
      홍지선 wrote: > TextGrid 에서 입력을 할때 > 숫자의 경우 오른쪽으로 정렬하고 입력할때도 오른쪽부터 ...
    • 김성동
      1999.06.08 01:04
      New로 할당한 메모리를 FormClose에서 해제하면 안되죠.. TreeView의 OnDeletion Event를 작성하시고 ...
    • 블루
    • 1999.06.07 23:36
    • 0 COMMENTS
    • /
    • 0 LIKES
    • 안경훈
    • 1999.02.09 00:38
    • 1 COMMENTS
    • /
    • 0 LIKES
    • 이정욱
      1999.02.09 01:44
      현재 사용하시는 델파이 버전은 무엇인지요? OS는 98인가요? 안경훈 wrote: > 델파이가 한번 컴파일하...
    • 송기원
    • 1999.06.07 22:59
    • 1 COMMENTS
    • /
    • 0 LIKES
    • 안치봉
      1999.06.08 00:37
      송기원 께서 말씀하시기를... > Project를 디버깅중에 자꾸 Bordbk40.dll에서 access Violation error > ...
    • 안경훈
    • 1999.02.09 00:38
    • 1 COMMENTS
    • /
    • 0 LIKES
    • 이정욱
      1999.02.09 01:44
      현재 사용하시는 델파이 버전은 무엇인지요? OS는 98인가요? 안경훈 wrote: > 델파이가 한번 컴파일하...
    • 김재억
    • 1999.02.05 20:33
    • 4 COMMENTS
    • /
    • 0 LIKES
    • 박종성
      1999.06.07 22:53
      안녕하세요! 여러분 델파이에서는 Drive나 Directory, Filelistbox들을 지원해주는데요.(Win 3.1) 써...
    • 이정욱
      1999.02.08 06:04
      E-Mail을 확인해 보세요. 김재억 wrote: > 안녕하세요? 김 재억입니다. > 제가 다니는 회사는 POD정기...
    • 김성동
      1999.06.08 00:57
      탐색기 역할을 하는 콤포넌트는 안치봉님께서 말씀하신 상용 콤포넌트 말고 여러가지 공개 콤포넌트들이 있...
    • 안치봉
      1999.06.08 00:42
      박종성 께서 말씀하시기를... > 안녕하세요! 여러분 > > 델파이에서는 Drive나 Directory, Filelistbox...
    • 강영구
    • 1999.02.05 19:29
    • 1 COMMENTS
    • /
    • 0 LIKES
    • 이정욱
      1999.02.08 06:01
      사용하시는 스케너의 Twain드라이버가 직접 아래작업들을 코맨드로 지원하지 않는다면 직접 스케너를 제어...
    • 이승윤
    • 1999.06.07 22:27
    • 1 COMMENTS
    • /
    • 0 LIKES
    • 김태균
      1999.06.07 23:48
      이승윤 께서 말씀하시기를... > SQLServer7.0을 처음 사용합니다. > 서버에 설치된 DB를 디스켓으로 받아...
    • 이정욱
      1999.02.08 05:38
      저희회사에서 취급하는 모든 컴포넌트에 대한 지원은 지금도 계속 되고 있습니다. 항상 http://www.nilex...
    • 구민오
    • 1999.02.07 05:03
    • 1 COMMENTS
    • /
    • 0 LIKES
    • 송재훈
      1999.02.11 04:07
      구민오 wrote: > winsocket을 후킹을 하고 싶거든요... > 이걸 후킹을 하려면 어떻게 해야 하는지 정말 ...
    • 초보
      1999.06.07 22:06
    • 이정욱
      1999.02.08 05:38
    • 안치봉
      1999.06.08 00:46
    • 초보
      1999.06.09 02:39
    • 초보
      1999.06.09 02:44
    • 안치봉
      1999.06.09 03:26
    • 초보
      1999.06.09 19:14
    • • • •
    • chobo
    • 1999.06.07 19:31
    • 4 COMMENTS
    • /
    • 0 LIKES
    • 구민오
      1999.02.05 11:02
      인터넷 익스플로러나 시작 버튼을 누르면 나오는 실행...을 통해서 URL을 집어 넣을 경우 이 주소 메세지가...
    • 전철호
      1999.06.07 20:06
      chobo 께서 말씀하시기를... > > 폼에 이미지 컴포넌트를 넣고 > 이미지를 불러 들였습니다만, > >...
    • 이정욱
      1999.02.06 09:54
      인터넷 프로그래밍을 하시면서 유해정보차단장치를 만드신다고 하셨는데 그것을 통제하는 방법은 있습니다....
    • 이정욱
      1999.02.06 01:57
      메세지가 발생하면서 전달이 되지는 않을것 같다는것이 제 의견입니다. 그냥 IE는 ActiveX콘트롤로써 그부...