Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

how to draw to an clarion image
herewith a routine of painting in an clarion image content of a
listbox
ofcourse with variables and stuff.. but it's an help for of 'how to'

greetz,
Menno

PaintNowR
Routine


DATA

BFH                     GROUP,PRE()
BFHType                     USHORT
BFHSize                     ULONG
BFHReserved1                USHORT
BFHReserved2                USHORT
BFHOffBits                  ULONG
END
BIH                     GROUP,PRE()
BIHSize                     ULONG
BIHWidth                    LONG
BIHHeight                   LONG
BIHPlanes                   USHORT
BIHBitCount                 USHORT
BIHCompression              ULONG
BIHSizeImage                ULONG
BIHXPelsPerMeter            LONG
BIHYPelsPerMeter            LONG
BIHClrUsed                  ULONG
BIHClrImportant             ULONG
END

FileBlob                &STRING
FilePointer             LONG
FileSize                ULONG

BmpData                 &STRING
BmpDataPointer          LONG
BmpDataSize             ULONG

LineHeightPixels        Byte

DummyDCHandle           ULong
MemoryDCHandle          ULong
DIBSectionHandle        ULong

BMPppvBits              Long

ReturnVal               Long

LOGF                    GROUP,PRE()
LOGFHeight                  LONG
LOGFWidth                   LONG
LOGFEscapement              LONG
LOGFOrientation             LONG
LOGFWeight                  LONG
LOGFItalic                  BYTE
LOGFUnderline               BYTE
LOGFStrikeOut               BYTE
LOGFCharSet                 BYTE
LOGFOutPrecision            BYTE
LOGFClipPrecision           BYTE
LOGFQuality                 BYTE
LOGFPitchAndFamily          BYTE
LOGFFaceName                CSTRING(32)
END

LogBrush                GROUP,PRE()
LBStyle                     ULONG
LBColor                     ULONG
LBHatch                     LONG
END
LogBrushHandle          Ulong

ThisRect                Group
TRLeft                      Long
TRTop                       Long
TRRight                     Long
TRBottom                    Long
End

RectVertex              Group,Pre(),Dim(2)
RVX                         LONG
RVY                         LONG
RVRed                       USHORT
RVGreen                     USHORT
RVBlue                      USHORT
RVAlpha                     USHORT
End

GradientRect            Group,Pre()
GRUpperLeft                 ULong
GRLowerRight                ULong
End

IconBIH                 GROUP,PRE()
ICONBIHSize                 ULONG
ICONBIHWidth                LONG
ICONBIHHeight               LONG
ICONBIHPlanes               USHORT
ICONBIHBitCount             USHORT
ICONBIHCompression          ULONG
ICONBIHSizeImage            ULONG
ICONBIHXPelsPerMeter        LONG
ICONBIHYPelsPerMeter        LONG
ICONBIHClrUsed              ULONG
ICONBIHClrImportant         ULONG
End

ICONBmpData             &STRING
ICONBmpDataPointer      LONG
ICONBmpDataSize         LONG

ICONppvBits             Long

IconDCHandle            ULong
IconDIBSectionHandle    ULong

Red                     ULong
Green                   ULong
Blue                    ULong

TransparentColor        ULong

TextOut                 String(255)
TextOutLen              ULong

TagSize                 Group,Pre()
CX                          Long
CY                          Long
End

BackGroundControl       Long

FontHandle              ULong
PenHandle               ULong

CurrentYPos             ULong
G                       ULong

CurrentControl          ULong

LineHeight              ULong
MaxRows                 ULong

ImageWidth              Long
ImageHeight             Long
CurrentRow              Long

TheText                 CString(255)
TheTextLen              ULong

Code



Do RecalcImageHeightR
!Do NormalizeWindowR

X# = 0
Loop 5000 Times
X# = X# + 1
ArrayExpBoxesXPos[X#] = 0
ArrayExpBoxesYPos[X#] = 0
ArrayTextPixelsLength[X#] = 0
End

Clear(QPFolder)
Free(QPFolder)

QSCR(TWA)
PaintingDone = 0
CurrentRow                  = 0
ImageWidth                  = LocalQFTree_Width + 20
ImageHeight = NewImageHeight
LineHeight                  = 16
MaxRows                     = (ImageHeight / LineHeight)

BFH.BFHType                 = 19778
BFH.BFHSize                 = 0
BFH.BFHReserved1            = 0
BFH.BFHReserved2            = 0
BFH.BFHOffBits              = 54

BIH.BIHSize                 = Size(BIH)
BIH.BIHWidth                = ImageWidth
BIH.BIHHeight               = ImageHeight
BIH.BIHPlanes               = 1
BIH.BIHBitCount             = 24
BIH.BIHCompression          = 0
BIH.BIHSizeImage            = 0
BIH.BIHXPelsPerMeter        = 0
BIH.BIHYPelsPerMeter        = 0
BIH.BIHClrUsed              = 0
BIH.BIHClrImportant         = 0

DummyDCHandle               =
GetDC(?ImageDummy{Prop:Handle})
MemoryDCHandle              =
CreateCompatibleDC(DummyDCHandle)
ReturnVal                   =
ReleaseDC(?ImageDummy{Prop:Handle},DummyDCHandle)

DIBSectionHandle            =
 CreateDIBSection(MemoryDCHandle,Address(
BIH),0,Address(BMPppvBits),0,0)
ReturnVal                   =
 SelectObject(MemoryDCHandle,DIBSectionHa
ndle)

BmpDataSize                 = Int((BIH.BIHWidth + 3)/4) *
4 * BIH.BIHHeight * 4
BmpData                    &= New( String(BmpDataSize) )
BmpDataPointer              = Address(BmpData)

Clear(LogBrush)
LogBrush.LBStyle            = BS_SOLID
LogBrush.LBColor            = 00FFFFFFh
LogBrush.LBHatch            = 0
LogBrushHandle              =
 CreateBrushIndirect_B(Address(LogBrush))


Clear(ThisRect)
ThisRect.TRLeft             = 0
ThisRect.TRTop              = 0
ThisRect.TRRight            = ImageWidth
ThisRect.TRBottom           = ImageHeight

ReturnVal                   =
 FillRect_A(MemoryDCHandle,Address(ThisRe
ct),LogBrushHandle)
ReturnVal                   = DeleteObject(LogBrushHandle)

PenHandle                   = GetStockObject(DC_PEN)
ReturnVal                   =
SelectObject(MemoryDCHandle,PenHandle)


If VScrollbar = 1
!                ReturnVal = SetDCPenColor(MemoryDCHandle,00808080h)
!                ReturnVal =
 MoveToEx(MemoryDCHandle,LocalQFTree_Widt
h-2,0,0)
!                ReturnVal =
LineTo(MemoryDCHandle,LocalQFTree_Width-2,ImageHeight)
Else
ReturnVal = SetDCPenColor(MemoryDCHandle,00808080h)
ReturnVal = MoveToEx(MemoryDCHandle,LocalWidth-2,0,0)
ReturnVal =
LineTo(MemoryDCHandle,LocalWidth-2,LocalHeight)
End

LOGFHeight                  = 13
LOGFWidth                   = 0
LOGFEscapement              = 0
LOGFOrientation             = 0
LOGFWeight                  = FW_NORMAL
LOGFItalic                  = 0
LOGFUnderline               = 0
LOGFStrikeOut               = 0
LOGFCharSet                 = 0
LOGFOutPrecision            = OUT_TT_PRECIS
LOGFClipPrecision           = 0
LOGFQuality                 = ANTIALIASED_QUALITY
LOGFPitchAndFamily          = 0
LOGFFaceName                = 'Tahoma'

ReturnVal                   =
SetTextColor(MemoryDCHandle,00000000H)

FontHandle                  =
CreateFontIndirectA(Address(LOGF))
ReturnVal                   =
SelectObject(MemoryDCHandle,FontHandle)
ReturnVal                   =
SetBkMode(MemoryDCHandle,Transparent)
ReturnVal                   =
SelectObject(MemoryDCHandle,FontHandle)

DummyDCHandle               =
GetDC(?ImageDummy{Prop:Handle})
IconDCHandle                =
CreateCompatibleDC(DummyDCHandle)
ReturnVal                   =
ReleaseDC(?ImageDummy,DummyDCHandle)

IconBIHSize                 = Size(IconBIH)
ICONBIHWidth                = 16
ICONBIHHeight               = 16
ICONBIHPlanes               = 1
ICONBIHBitCount             = 24
ICONBIHCompression          = 0
ICONBIHSizeImage            = 0
ICONBIHXPelsPerMeter        = 0
ICONBIHYPelsPerMeter        = 0
ICONBIHClrUsed              = 0
ICONBIHClrImportant         = 0

ICONBmpDataSize             = Size(QLibIcons16:DIB)
ICONBmpData                &= NEW(String(ICONBmpDataSize))
ICONBmpDataPointer          = Address(ICONBmpData)

ICONDIBSectionHandle        =
 CreateDIBSection(IconDCHandle,Address(Ic
onBIH),0,Address(ICONppvBits),0,0)
ReturnVal                   =
 SelectObject(IconDCHandle,ICONDIBSection
Handle)

Red                         = 0
Blue                        = 0
Green                       = 255
TransparentColor            = (Red * 256*256) + (Green *
256) + Blue

Get(QFolders,1)
LastLevel# = QFolders:Level
LastIsExp# = QFolders:IsExp
G# = 0
!Skips# = 0
Loop
G# = G# + 1
If G# > Records(QFolders)
Break
End
Get(QFolders,G#)

If LastLevel# < QFolders:Level And LastIsExp# = 0
!Skips# = Skips# + 1
Cycle
End

QPFolder:QFolderNumber = QFolders:Number
Add(QPFolder)

CurrentRow = CurrentRow + 1
LastLevel# = QFolders:Level
LastIsExp# = QFolders:IsExp

If QFolders:IsExp = 1
QLibIcons16:Number = QFolders:IcoExp
ElsIf QFolders:IsExp = 0
QLibIcons16:Number = QFolders:IcoCon
Else
QLibIcons16:Number = 0
End
If QLibIcons16:Number > 0
Get(QLibIcons16,+QLibIcons16:Number)
If Errorcode() = 0
IconBmpData = QLibIcons16:DIB[1 :
IconBmpDataSize]
ReturnVal   =
 SetDIBits(IconDCHandle,ICONDIBSectionHan
dle,0,16,ICONBmpDataPointer,Address(
IconBIH),0)
ReturnVal   =
 TransparentBlt(MemoryDCHandle,(QFolders:
Level*16) - 13,
(CurrentRow*LineHeight)+4-LineHeight, 16,16, IconDCHandle, 0,0,16,16,
TransparentColor)
End
End
TheText         = Clip(QFolders:Name)
TheTextLen      = len(clip(TheText))
ReturnVal       =
 GetTextExtentPoint32A(MemoryDCHandle,Add
ress(TheText),TheTextLen,Address(Tag
Size))
ReturnVal       =
 TextOut_A(MemoryDCHandle,(QFolders:Level
*16)+7,(CurrentRow*LineHeight)+4-Lin
eHeight,Address(TheText),TheTextLen)

ArrayTextPixelsLength[CurrentRow] = TagSize.CX

If QFolders:Collections > 0
If QFolders:IsExp = 1
QLibIcons16:Number = 470
Else
QLibIcons16:Number = 469
End
Get(QLibIcons16,+QLibIcons16:Number)
If Errorcode() = 0
IconBmpData = QLibIcons16:DIB[1 :
IconBmpDataSize]
ReturnVal   =
 SetDIBits(IconDCHandle,ICONDIBSectionHan
dle,0,16,ICONBmpDataPointer,Address(
IconBIH),0)
ReturnVal   =
 TransparentBlt(MemoryDCHandle,(QFolders:
Level*16) - 32,
(CurrentRow*LineHeight)+4-LineHeight, 16,16, IconDCHandle, 0,0,16,16,
TransparentColor)
ArrayExpBoxesXPos[CurrentRow] =
(QFolders:Level*16) - 32
!ArrayExpBoxesYPos[CurrentRow] =
(CurrentRow*LineHeight)+4-LineHeight
End
Else
ArrayExpBoxesXPos[CurrentRow] = 0
End

If QFolders:IsExp !And QFolders:Hook = 1! should have
hook then, thus paint it the rows
End
End

ReturnVal                   =
 GetDIBits(MemoryDCHandle,DIBSectionHandl
e,0,ImageHeight,BmpDataPointer,Addre
ss(BIH),0)

FileSize                    = Size(BFH) + Size(BIH) +
BmpDataSize
FileBlob                   &= NEW(String(FileSize))
FilePointer                 = Address(FileBlob)

FileBlob[1 : Size(BFH)]     = BFH
FileBlob[Size(BFH) + 1 : Size(BFH) + Size(BIH)]
= BIH
FileBlob[Size(BFH) + 1 + Size(BIH) : Size(BFH) + Size(BIH)
+ BmpDataSize]   = BmpData[1 : BmpDataSize]




!            Clear(Q4MB)
!            Free(Q4MB)
!            Q4MBPageNoMax = 0
!
!            If BmpDataSize > 4000000
!                Pages# = Int(BmpDataSize / 4000000) + 1
!            Else
!                Pages# = 1
!            End
!            G#  = 0
!            TP# = 1
!            Q4MB:TotalSize = BmpDataSize
!            Loop Pages# Times
!                G# = G# + 1
!                Q4MBPageNoMax   = Q4MBPageNoMax + 1
!                Q4MB:PageNo     = Q4MBPageNoMax
!
!                If G# < Pages#
!                    Q4MB:Length = 4000000
!                    Q4MB:Line[1 : 4000000] = BmpData[TP# : TP# +
Q4MB:Length-1]
!                    Add(Q4MB)
!                    TP# = TP# + 4000000
!                ElsIf G# = Pages#
!                    Q4MB:Length = BmpDataSize - ((G#-1) * 4000000)
!                    Q4MB:Line   = BmpData[TP# : TP# + Q4MB:Length -1]
!                    Add(Q4MB)
!                    Break
!                End
!            End




Dispose(BmpData)

?QFTree{Prop:ImageBits} = FileBlob[1 : FileSize]

Dispose(FileBlob)
ReturnVal                   = DeleteObject(LogBrushHandle)
ReturnVal                   =
DeleteObject(DIBSectionHandle)
ReturnVal                   = DeleteDC(MemoryDCHandle)

PaintingDone = 1

!            !Do NormalizeWindowR

Report this thread to moderator Post Follow-up to this message
Old Post
google
09-24-04 08:55 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Clarion archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 05:28 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.