Вертикальная прокрутка Marquee для FoxPro - PullRequest
0 голосов
/ 22 сентября 2008

Может ли кто-нибудь подсказать мне какой-нибудь код / ​​дать мне идеи о том, как создать вертикальную область с плавной прокруткой для VFP 8 или 9?

Любая помощь приветствуется.

Ответы [ 3 ]

0 голосов
/ 03 октября 2008

Вот быстрая программа, которая будет прокручивать сообщения. Поместите следующее в файл 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
0 голосов
/ 07 октября 2008

К сожалению, природа моей работы не оставляет мне времени для того, чтобы дурачиться с графикой, однако, если бы я это сделал, я бы изучил использование GDI + с VFP. Вот статья , с которой можно начать

0 голосов
/ 22 сентября 2008

Вы можете использовать Прокручиваемый контейнер

...