Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Form - resize rubber band
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00944495
Message ID:
00945069
Vues:
20
This message has been marked as the solution to the initial question of the thread.
Frank,

>>
>>...Anyway here is the function:
>>
>>   Function Word2Num( tc_Buffer, tl_MSB )...
>>
>
>Thanks for the functions. It's always good to have these at hand.
>
>What is the Parameter "tl_MSB" (I know it's boolean, but when needed?)
>

MSB is Most Significant Byte. It needed when a Hex Value (in Low Level Lang.) is treated as a Hex String, or there are times a Hex Value will be stored intentionally in MSB as a Hex String.
You will see that this is also use in VFP memo structure. Look at "Memo File Structure (.FPT)" in VFP help. You will see the footnote "1 Integers stored with the most significant byte first".


>>>- Could I draw the Rubber the way windows does it with the thick black/white rastered line?
>
>>Yes you can, a little more work to do.
>>- Create the bitmap based on custom pattern (CreateBitmap).
>>
WORD   rgbPatGray[8] = { 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA };
>>- Create the pattern brush from the bitmap (CreatePatternBrush)
>>- Select the pattern brush into DC
>>- Because this technique using a pattern brush, you can't use rectangle.
>> It will fills the whole rectangle area. So you have to draw each side
>> of the border ( 4 times ) using PatBlt with PATINVERT (you can specfy
>> the border width to draw )
>>- Don't forget to delete the GDI object that you created (DeleteObject)
>>
>>Actually, for the first workaround, you can also make it thicker. Just
>>create the pen (CreatePen) then select the Handle Pen into DC.
>
>OK, sounds like at least a half days work to me. I will have to look up all the functions and how to call them (remember I'm a VFP-guy). My Windows-programming understanding on how things work together, DC's etc. is lacking too much to get this done in a sec.
>
>So I will need to solve "that" later, too much pressure at the time.
>
>Thanks for the help.

Hmm.. I don't have the VFP code for this right now. I translated this directly from C++ code. Hope this works :)
#Define UINT         Long
#Define PATINVERT    0x005A0049

Declare HANDLE CreateBitmap in GDI32 ;
   Integer nWidth, Integer nHeight, ;
   UINT cPlanes, UINT cBitsPerPel, PSTR lpvBits

Declare HANDLE CreatePatternBrush in GDI32 HANDLE hBitmap

rgbPatGray = replicate( Word(0x55) + Word(0xAA), 4 )
hBitmap = CreateBitmap( 8, 8, 1, 1, rgbPatGray )
hPatBrush = CreatePatternBrush( hBitmap )

cRect = space( 16 )
GetWindowRect( ThisForm.hWnd, @cRect )
nLeft = Buff2Num( cRect, (4*0)+1, .F. )
nTop = Buff2Num( cRect, (4*1)+1, .F. )
nRight = Buff2Num( cRect, (4*2)+1, .F. )
nBottom = Buff2Num( cRect, (4*3)+1, .F. )
nWidth = nRight - nLeft
nHeight = nBottom - nTop

xFrame = SysMetric(3)
yFrame = SysMetric(4)

hDC = GetDC( HWND_DESKTOP )
hOldBrush = SelectObject( hDC, hPatBrush )

** You will have to draw each side
PatBlt( hDC, nLeft, nTop, nWidth, yFrame, PATINVERT )   && top side
PatBlt...  && left side
PatBlt...  && bottom side
PatBlt...  && right side

**
**  Do the rest
**


Function Word( tn_Num, tl_MSB )
Local lc_0, lc_1, lc_Word

   lc_1 = chr(int( tn_Num / 256 ))
   lc_0 = chr(mod( tn_Num, 256 ))
   If tl_MSB
      lc_Word = lc_1 + lc_0
   else
      lc_Word = lc_0 + lc_1
   endif

   Return lc_Word
EndFunc
Regards and good luck :-)
Herman
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform