PDA

Click to See Complete Forum and Search --> : Fast as flange screen updates


Geoff Gunson
Jul 25th, 2001, 06:41 AM
Hello

We produce a product called a TGS (picuture included) basically it has some debug screen a circit display. The circuit display is a grid of numbers and states , like IDLE WANS OUT/G etc. The current method we use is a Flexi grid. this in my option is slow and takes up far too much processor time.

Anyway I am thinking of rewriting it using bitmaps and the BitBLt fuction, is this a good Idea or is there something better? Some control maybe?

It will need to be able to flick the states on say 60 circuits 6000 times a minute, so you it needs to be quick.

Any Ideaz??

CMD

G

plenderj
Jul 26th, 2001, 05:14 AM
Well you could always use an array of textboxes or something.
Or you could maybe use the DrawText API


Declare Function DrawText Lib "user32" Alias "DrawTextA" (ByVal hdc As Long, ByVal lpStr As String, ByVal nCount As Long, lpRect As RECT, ByVal wFormat As Long) As Long

' DrawText() Format Flags
Const DT_TOP = &H0
Const DT_LEFT = &H0
Const DT_CENTER = &H1
Const DT_RIGHT = &H2
Const DT_VCENTER = &H4
Const DT_BOTTOM = &H8
Const DT_WORDBREAK = &H10
Const DT_SINGLELINE = &H20
Const DT_EXPANDTABS = &H40
Const DT_TABSTOP = &H80
Const DT_NOCLIP = &H100
Const DT_EXTERNALLEADING = &H200
Const DT_CALCRECT = &H400
Const DT_NOPREFIX = &H800
Const DT_INTERNAL = &H1000

Nirces
Jul 26th, 2001, 05:43 AM
That kind of Speed is impossible, unless you plan on Running the thing on an Extremely Fast Machine.

If your FlexiGrid was a PictureBox, with a Scroll Bar Drawn Below it.

You could do it like this:

1 Picture would Contain The Circits in N/A State, the max Circits, you need.

Then another picture for each State, the right size to fit in exactly.


dim Stop as Boolean 'Set this when you wish it to stop updating
dim hDCs(4) as long

Const Background = 1
Const Idle = 2
Const WANS =3
Const OUT/G = 4
Const WidthCircit = 100 (50 for the number, 50 for state)
Const HeightCircit
Const CircitsPerColumn = 12
Const CircitsPerRow = 4

'ScrollBar.Value should have two values - 0 and 1 for 60 circits

Form_Load()
LoadPicture
Stop = False

Do Until Stop = True
Do Events
'Blt Background
BitBlt picture1.hdc , 0,0,picture1.width,picture1.height, hdcs(Background), ScrollBar.Value * WidthCircit,0 SRCCOPY
for i = CircitsPerColumn * scrollbar.value to CircitsPerColumn * scrollbar.value * CircitsPerRow
X = ((i \ CircitsPerColumn) - ScrollBar.value) * WidthCircit + (widthcircit /2)
Y = ((i -1 )mod circitsPerColumn ) * heightColumn

Select case Circits(i).state
Case "IDLE" then
BitBlt picture1.hdc, x, y,widthcircit /2,heightcircit,hDCs(IDLE),0,0,SRCCOPY
Case 'etc
End Select
Loop

UnloadPictures

EndSub

Sub LoadPictures
' See the Thread vy Fox concerning Releasing DC's, all the code in there, i need to go work now, just but the DC's into the hDCs Array
End Sub

sub UnLoadPictures
'Ditto
End sub

Geoff Gunson
Jul 26th, 2001, 06:22 AM
Cheers for the info, sorry the reply was a bit late I blame my Email server, its about as fast as an asmatic hamster. ;)

plenderj: I haven't tried that I'll give it a whril.

Nirces: Well I wrote a test app, based around your code, it was changing 1500 circuits simutanously without any bother.

May be I got my maths wrong, what it is, is a tool for generating calls into a BT switch. You could have 30 active calls for instance each call only lasting .1 of a second having to go through 4 different states.

4 * 30 * 10 * 60 = 72,000 updates to the entire screen per minute.

The test app flicked all 1500 circuits between 2 states with a 200 ms delay in the loop. In one minute it went through the loop 200 times

1500 * 2 * 200 = 600,000 updates per minute.

So it looks as if the API BitBlt is plenty quick enough.

Thanks again

G