BTNBMP FWH1402 X FWH1408

BTNBMP FWH1402 X FWH1408

Postby Sistem » Fri Sep 19, 2014 12:51 am

Antonio

BTNBMP muestra de manera diferente debido la versión FWH

@ 11, 138 BTNBMP OF oDlg SIZE 40, 15 PIXEL 2007 NOBORDER PROMPT " &Ok" FONT oFont LEFT RESOURCE "BMP_BTOK" ACTION (lOk:=.t., oDlg:End())
@ 179, 2 BTNBMP OF oDlg SIZE 180, 18 PIXEL 2007 NOBORDER PROMPT " SISTEM INFORMÁTICA " FONT oFont4 LEFT RESOURCE "BMP_INF2" ACTION SobreInfo2()

OK [FWH1402]
Image

NO OK [FWH1408]
Image
FWH2008 | xHarbour | BCC74 | SQLRDD
User avatar
Sistem
 
Posts: 226
Joined: Sun May 13, 2012 7:52 am

Re: BTNBMP FWH1402 X FWH1408

Postby Antonio Linares » Fri Sep 19, 2014 12:57 am

Vamos a revisarlo de inmediato, gracias
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41461
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: BTNBMP FWH1402 X FWH1408

Postby Antonio Linares » Fri Sep 19, 2014 1:49 pm

Por favor modifica estos métodos con este código:

Code: Select all  Expand view
METHOD PaintCaption() CLASS TBtnBmp

   local nStyle, nClr
   local hOldFont, aRect, lMultiline, cWord, cWord2
   local nOffset, nMaxWidth, nLine
   local nTxtTop, nTxtLeft, nTxtRight
   local nTxtHeight, nAdjust := 0
   local nLayOut := ::nLayOut

   if ! Empty( ::cCaption )

      if ::oFont == nil
         ::GetFont()
      endif

      lMultiLine = ! Empty( ::cCaption ) .and. CRLF $ ::cCaption

      if lMultiLine
         cWord = cStrWord( ::cCaption, nOffset, CRLF )

         while nOffset < Len( ::cCaption )
            nMaxWidth = Max( nMaxWidth,;
                             Len( cWord2 := cStrWord( ::cCaption, @nOffset, CRLF ) ) )
            if Len( cWord ) < nMaxWidth
              cWord = cWord2
            endif
         end

         nLine = MLCount( ::cCaption )
      else
         cWord      = ::cCaption
         nTxtHeight = GetTextHeight( ::hWnd, ::hDC )
         nTxtTop    = ::nHeight / 2 - nTxtHeight / 2
         nMaxWidth  = GetTextWidth( 0, cWord, ::oFont:hFont )
         nTxtLeft   = ::nWidth / 2 - nMaxWidth / 2
         nTxtRight  = ::nWidth / 2 + nMaxWidth / 2
      endif

      if ::nLayOut == 1 // TOP
         nTxtLeft -= 3
      endif  

      if ::nLayout == 2 // LEFT
         nTxtLeft  += 5
         nTxtRight += nBmpWidth( ::hBmp ) / 2 - 5
      endif

      if ::nLayout == 4 // RIGHT
         nTxtLeft  -= nBmpWidth( ::hBmp ) / 2 - 5
         nTxtRight -= nBmpWidth( ::hBmp ) / 2 - 5
      endif

      nStyle = nOr( If( ::nLayOut == 0, DT_CENTER, nLayOut ), DT_WORDBREAK,;
                    If( ::nLayOut % 2 == 0, DT_VCENTER, DT_TOP ) )

      nClr = If( IsWindowEnabled( ::hWnd ), ::nClrText,;
                 If( ::lDisColor, CLR_HGRAY, ::nClrTextDis ) )

      SetTextColor( ::hDC, If( ValType( nClr ) == "B", Eval( nClr, ::lMOver ), nClr ) )
      SetBkMode( ::hDC, 1 )

      if ::oWnd:oFont != nil .or. ::oFont != nil
         hOldFont = SelectObject( ::hDC, ::oFont:hFont )
      endif

      if ::oPopup != nil
         nTxtRight -= 12
      endif

      aRect = { nTxtTop, nTxtLeft, ::nHeight - 4, nTxtRight }

      lMultiLine = ( nTxtHeight := DrawText( ::hDC, ::cCaption, aRect,;
                     nOr( DT_WORDBREAK, DT_CALCRECT ) ) ) > ;
                     DrawText( ::hDC, ::cCaption, aRect, nOr( DT_SINGLELINE, DT_CALCRECT ) )

      if ::nLayOut == 1 // TOP
         nStyle     = nOr( DT_CENTER, DT_WORDBREAK )
         aRect[ 1 ] = aRect[ 3 ] - nTxtHeight
      endif

      if ::nLayOut == 3
         aRect[ 1 ] = 2
      endif

      if ::lPressed
         aRect[ 1 ]++
         aRect[ 2 ]++
         aRect[ 3 ]++
         aRect[ 4 ]++
      endif

      DrawText( ::hDC, ::cCaption, aRect, nStyle  )

      SelectObject( ::hDC, hOldFont )
   endif

return nil
 


Code: Select all  Expand view

METHOD PaintBitmap() CLASS TBtnBmp

   local hBmp  := ::hBmp
   local nTop  := ( ::nHeight / 2 ) - ( nBmpHeight( hBmp ) / 2 )
   local nLeft := ( ::nWidth / 2 ) - ( nBmpWidth( hBmp ) / 2 )

   if ::oFont != nil .and. ! Empty( ::cCaption ) .and. ::nLayOut == 2 // LEFT
      nLeft -= GetTextWidth( 0, ::cCaption, ::oFont:hFont ) / 2 - 5
   endif  

   if ! Empty( ::cCaption )
      nTop -= 10
   endif

   if ::oPopup != nil
      nLeft -= 6
   endif

   if ::nLayOut == 2 // LEFT
      nTop  += 10
      nLeft -= 10
   endif

   if ::nLayOut == 4 // RIGHT
      nTop  += 10
      nLeft += 35
   endif

   if ! Empty( hBmp )
      if ::lBmpTransparent
         if SetAlpha() .and. ::aAlpha[ ::nBtn ]
            ABPaint( ::hDC, nTop + If( ::lPressed, 1, 0 ),;
                     nLeft + If( ::lPressed, 1, 0 ), hBmp, ::nAlphaLevel() )
         else
            DrawTransBmp( ::hDC, hBmp, nTop + If( ::lPressed, 1, 0 ),;
                          nLeft + If( ::lPressed, 1, 0 ), nBmpWidth( hBmp ),;
                          nBmpHeight( hBmp ) )
         endif
      else
         DrawBitmap( ::hDC, hBmp, nTop + If( ::lPressed, 1, 0 ),;
                     nLeft + If( ::lPressed, 1, 0 ), nBmpWidth( hBmp ),;
                     nBmpHeight( hBmp ) )
      endif
   endif

return nil

 
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41461
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: BTNBMP FWH1402 X FWH1408

Postby Sistem » Fri Sep 19, 2014 5:27 pm

ahora
esta bien

gracias
FWH2008 | xHarbour | BCC74 | SQLRDD
User avatar
Sistem
 
Posts: 226
Joined: Sun May 13, 2012 7:52 am


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 139 guests