문제

VFP 8 또는 9에 대한 부드러운 스크롤 수직 선택 윤곽을 만드는 방법에 대한 아이디어를 제공하거나 코드를 알려줄 수 있는 사람이 있습니까?

도움을 주시면 감사하겠습니다.

도움이 되었습니까?

해결책

다음은 메시지를 스크롤하는 빠른 프로그램입니다.prg 파일에 다음을 넣고 실행해 보세요.

저는 타이머, 라벨, 스크롤 코드를 캡슐화하는 클래스로 ContainerScrollArea를 만들겠습니다.메시지를 검색하기 위해 재정의할 수 있는 GetNextMessage 메서드를 제공합니다.

* Put a container on the screen to hold our scroller
_screen.AddObject("containerScrollArea", "container")

WITH _Screen.containerScrollArea
    * Size it
    .Visible = .t.
    .Width = 100
    .Height = 100

    * Add two labels, one to hold each scrolling message
    .AddObject("labelScroll1", "Label") 
    .AddObject("labelScroll2", "Label") 

    * This timer will move the labels to scroll them
    .AddObject("timerScroller", "ScrollTimer")
ENDWITH

WITH _Screen.containerScrollArea.labelScroll1
    * The labels are positioned below the margin of the container, so they're not initially visible
    .Top = 101
    .Height = 100
    .Visible = .t.
    .WordWrap = .t.
    .BackStyle= 0
    .Caption = "This is the first scrolling text, which is scrolling."
ENDWITH

WITH _Screen.containerScrollArea.labelScroll2
    * The labels are positioned below the margin of the container, so they're not initially visible
    .Top = 200
    .Height = 100
    .Visible = .t.
    .WordWrap = .t.
    .BackStyle= 0
    .Caption = "This is the second scrolling text, which is scrolling."
ENDWITH

* Start the timer, which scrolls the labels
_Screen.containerScrollArea.timerScroller.Interval = 100


DEFINE CLASS ScrollTimer AS Timer
    PROCEDURE Timer

        * If the first label is still in view, move it by one pixel
        IF This.Parent.labelScroll1.Top > -100
            This.Parent.labelScroll1.Top = This.Parent.labelScroll1.Top - 1
        ELSE
            * If the first label has scrolled out of view on the top of the container, move it back to the bottom.
            This.Parent.labelScroll1.Top = 101
            * Load some new text here
        ENDIF

        IF This.Parent.labelScroll2.Top > -100
            * If the second label is still in view, move it by one pixel
            This.Parent.labelScroll2.Top = This.Parent.labelScroll2.Top - 1
        ELSE
            * If the second label has scrolled out of view on the top of the container, move it back to the bottom.
            This.Parent.labelScroll2.Top = 101
            * Load some new text here
        ENDIF
    ENDPROC
ENDDEFINE

다른 팁

당신이 사용할 수있는 스크롤 가능한 컨테이너

불행하게도 내 작업의 특성상 그래픽을 가지고 장난칠 시간이 없습니다. 그러나 그렇게 했다면 VFP와 함께 GDI+를 사용하는 방법을 고려해 보겠습니다.여기는 기사 당신이 시작하도록

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top