User defined Windows captions

Re: User defined Windows captions

Postby James Bott » Fri May 10, 2019 10:16 pm

Antonio,

OK, that works great, except that I just found that a window STYLE WS_POPUP is not resizable. That is a show stopper, at least for me.

Ah, now I see that STYLE WS_POPUP doesn't even actually have a caption bar. The one you are using is made by smoke and mirrors. Nothing wrong with that, but we need a fully functional, resizable, window with a real caption bar for our apps using a ribbonbar. Somehow Microsoft has done this, we just have to find out how.

I did just find this: https://docs.microsoft.com/en-us/windows/uwp/design/shell/title-bar

I am not familiar with XAML, so I don't know if it might be helpful.

James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: User defined Windows captions

Postby Antonio Linares » Sat May 11, 2019 4:09 am

James,

Here we have right resize support:
Code: Select all  Expand view
#include "FiveWin.ch"

#define CLR_MSPURPLE RGB( 128,  57, 123 )
#define CLR_MSRED    RGB( 232,  17,  35 )
#define CLR_MSGRAY   RGB( 229, 229, 229 )

#define TME_LEAVE    2

function Main()

   local oWnd, nRowPos, nColPos, oBtnClose, oBtnMax, oBtnMin, lDrag := .F., lRResize := .F.

   DEFINE WINDOW oWnd STYLE WS_POPUP COLOR CLR_BLACK, CLR_MSPURPLE

   oWnd:SetSize( 500, 300 )
   oWnd:Center()
   oWnd:Shadow()
   oWnd:bPainted = { || oWnd:Say( 8, 30, "Caption", CLR_WHITE, CLR_MSPURPLE, oWnd:oFont, .T., .T. ) }

   oWnd:bLClicked = { | nRow, nCol | If( nRow < 25, ( oWnd:Capture(), nRowPos := nRow, nColPos := nCol, lDrag := .T. ),),;
                                     If( nRow > 25 .and. nCol > oWnd:nWidth - 25, ( oWnd:Capture(), nRowPos := nRow, nColPos := nCol, lRResize := .T. ),) }
     
   oWnd:bMMoved = { | nRow, nCol | TrackMouseEvent( oWnd:hWnd, TME_LEAVE ),;
                                   If( lDrag .and. ! IsZoomed( oWnd:hWnd ) .and. IsOverWnd( oWnd:hWnd, nRow, nCol ),;
                                       oWnd:Move( oWnd:nTop + nRow - nRowPos, oWnd:nLeft + nCol - nColPos,,, .T. ),),;
                                   If( lRResize .and. ! IsZoomed( oWnd:hWnd ) .and. IsOverWnd( oWnd:hWnd, nRow, nCol ),;    
                                       ( oWnd:SetSize( oWnd:nWidth + nCol - nColPos, oWnd:nHeight, .T. ), nColPos := nCol ),) }  

   oWnd:bLButtonUp = { || ReleaseCapture(), lDrag := .F., lRResize := .F. }
   oWnd:bMLeave    = { || lDrag := .F. }

   @ 1, oWnd:nWidth - 46 BTNBMP oBtnClose BITMAP "../bitmaps/16x16/closew.bmp" ;
      FLAT NOBORDER NOROUND ACTION oWnd:End() SIZE 45, 29 ;
      COLOR CLR_BLACK, CLR_MSPURPLE

   @ 1, oWnd:nWidth - 92 BTNBMP oBtnMax BITMAP "../bitmaps/16x16/max.bmp" ;
      FLAT NOBORDER NOROUND ACTION If( ! IsZoomed( oWnd:hWnd ), oWnd:Maximize(), oWnd:Restore() ) SIZE 45, 29 ;
      COLOR CLR_BLACK, CLR_MSPURPLE

   @ 1, oWnd:nWidth - 138 BTNBMP oBtnMin BITMAP "../bitmaps/16x16/min.bmp" ;
      FLAT NOBORDER NOROUND ACTION If( ! IsIconic( oWnd:hWnd ), oWnd:Iconize(), oWnd:Restore() ) SIZE 45, 29 ;
      COLOR CLR_BLACK, CLR_MSPURPLE

   oBtnClose:bMMoved = { || oBtnClose:SetColor( CLR_BLACK, If( oBtnClose:lMOver, CLR_MSRED, oWnd:nClrPane ) ) }
   oBtnMax:bMMoved   = { || oBtnMax:SetColor( CLR_BLACK, If( oBtnMax:lMOver, CLR_MSGRAY, oWnd:nClrPane ) ) }
   oBtnMin:bMMoved   = { || oBtnMin:SetColor( CLR_BLACK, If( oBtnMin:lMOver, CLR_MSGRAY, oWnd:nClrPane ) ) }

   oWnd:bResized = { || oBtnClose:Move( 1, oWnd:nWidth - 46 ), oBtnMax:Move( 1, oWnd:nWidth - 92 ),;
                        oBtnMin:Move( 1, oWnd:nWidth - 138 ) }

   ACTIVATE WINDOW oWnd

return nil
regards, saludos

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

Re: User defined Windows captions

Postby Antonio Linares » Sat May 11, 2019 4:19 am

Here we have right and bottom resize support:

Code: Select all  Expand view
#include "FiveWin.ch"

#define CLR_MSPURPLE RGB( 128,  57, 123 )
#define CLR_MSRED    RGB( 232,  17,  35 )
#define CLR_MSGRAY   RGB( 229, 229, 229 )

#define TME_LEAVE    2

function Main()

   local oWnd, nRowPos, nColPos, oBtnClose, oBtnMax, oBtnMin, lDrag := .F., lRResize := .F., lBResize := .F.

   DEFINE WINDOW oWnd STYLE WS_POPUP COLOR CLR_BLACK, CLR_MSPURPLE

   oWnd:SetSize( 500, 300 )
   oWnd:Center()
   oWnd:Shadow()
   oWnd:bPainted = { || oWnd:Say( 8, 30, "Caption", CLR_WHITE, CLR_MSPURPLE, oWnd:oFont, .T., .T. ) }

   oWnd:bLClicked = { | nRow, nCol | If( nRow < 25, ( oWnd:Capture(), nRowPos := nRow, nColPos := nCol, lDrag := .T. ),),;
                                     If( nRow > 25 .and. nCol > oWnd:nWidth - 25, ( oWnd:Capture(), nRowPos := nRow, nColPos := nCol, lRResize := .T. ),),;
                                     If( nRow > 25 .and. nRow > oWnd:nHeight - 25, ( oWnd:Capture(), nRowPos := nRow, nColPos := nCol, lBResize := .T. ),) }
     
   oWnd:bMMoved = { | nRow, nCol | TrackMouseEvent( oWnd:hWnd, TME_LEAVE ),;
                                   If( lDrag .and. ! IsZoomed( oWnd:hWnd ) .and. IsOverWnd( oWnd:hWnd, nRow, nCol ),;
                                       oWnd:Move( oWnd:nTop + nRow - nRowPos, oWnd:nLeft + nCol - nColPos,,, .T. ),),;
                                   If( lRResize .and. ! IsZoomed( oWnd:hWnd ) .and. IsOverWnd( oWnd:hWnd, nRow, nCol ),;    
                                       ( oWnd:SetSize( oWnd:nWidth + nCol - nColPos, oWnd:nHeight, .T. ), nColPos := nCol ),),;
                                   If( lBResize .and. ! IsZoomed( oWnd:hWnd ) .and. IsOverWnd( oWnd:hWnd, nRow, nCol ),;    
                                       ( oWnd:SetSize( oWnd:nWidth, oWnd:nHeight + nRow - nRowPos, .T. ), nRowPos := nRow ),) }  

   oWnd:bLButtonUp = { || ReleaseCapture(), lDrag := .F., lRResize := .F., lBResize := .F. }
   oWnd:bMLeave    = { || lDrag := .F. }

   @ 1, oWnd:nWidth - 46 BTNBMP oBtnClose BITMAP "../bitmaps/16x16/closew.bmp" ;
      FLAT NOBORDER NOROUND ACTION oWnd:End() SIZE 45, 29 ;
      COLOR CLR_BLACK, CLR_MSPURPLE

   @ 1, oWnd:nWidth - 92 BTNBMP oBtnMax BITMAP "../bitmaps/16x16/max.bmp" ;
      FLAT NOBORDER NOROUND ACTION If( ! IsZoomed( oWnd:hWnd ), oWnd:Maximize(), oWnd:Restore() ) SIZE 45, 29 ;
      COLOR CLR_BLACK, CLR_MSPURPLE

   @ 1, oWnd:nWidth - 138 BTNBMP oBtnMin BITMAP "../bitmaps/16x16/min.bmp" ;
      FLAT NOBORDER NOROUND ACTION If( ! IsIconic( oWnd:hWnd ), oWnd:Iconize(), oWnd:Restore() ) SIZE 45, 29 ;
      COLOR CLR_BLACK, CLR_MSPURPLE

   oBtnClose:bMMoved = { || oBtnClose:SetColor( CLR_BLACK, If( oBtnClose:lMOver, CLR_MSRED, oWnd:nClrPane ) ) }
   oBtnMax:bMMoved   = { || oBtnMax:SetColor( CLR_BLACK, If( oBtnMax:lMOver, CLR_MSGRAY, oWnd:nClrPane ) ) }
   oBtnMin:bMMoved   = { || oBtnMin:SetColor( CLR_BLACK, If( oBtnMin:lMOver, CLR_MSGRAY, oWnd:nClrPane ) ) }

   oWnd:bResized = { || oBtnClose:Move( 1, oWnd:nWidth - 46 ), oBtnMax:Move( 1, oWnd:nWidth - 92 ),;
                        oBtnMin:Move( 1, oWnd:nWidth - 138 ) }

   ACTIVATE WINDOW oWnd

return nil
regards, saludos

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

Re: User defined Windows captions

Postby ukoenig » Mon May 13, 2019 2:28 pm

Antonio,

thank You very much.
With Your solution It is easy to do a zoom / unzoom of image-groups inside a window
It is A GDIPLUS-solution
calculated : zoomlevel of images, top / left space, space between images
On top I displayed the new wnd-size and the calculated zoom-factor
It works as well for horizontal and vertical zoom.
The used window-system-images are added at the bottom

Image

Image

Image

Image

System-images

Image

Image

Image

Code: Select all  Expand view


#include "FiveWin.ch"

#define CLR_MSPURPLE    RGB( 128,  57, 123 )
#define CLR_MSRED       RGB( 232,  17,  35 )
#define CLR_MSGRAY      RGB( 229, 229, 229 )

#define TME_LEAVE    2

STATIC c_path, c_path1

FUNCTION MAIN()
LOCAL oWnd, nRowPos, nColPos, oBtnClose, oBtnMax, oBtnMin, lDrag := .F., lRResize := .F., lBResize := .F.

LOCAL nWidth := 500, nNewWidth := 500, nHeight := 300, nNewHeight := 300
LOCAL nFactorW := 1, nFactorH := 1, lWZoomed

LOCAL nImgRow := 40, nImgCol := 40
LOCAL nImgSpace := 16, nLeftPos, nRightPos

c_path := cFilePath(GetModuleFileName( GetInstance() ) )
c_path1 := c_path + "BITMAPS\"  

DEFINE WINDOW oWnd STYLE WS_POPUP COLOR CLR_BLACK, CLR_MSPURPLE

oWnd:SetSize( nWidth, nHeight )
oWnd:Center()
oWnd:Shadow()
oWnd:bPainted = { || oWnd:Say( 8, 30, "
Caption", CLR_WHITE, CLR_MSPURPLE, oWnd:oFont, .T., .T. ) }

oWnd:bPainted   := { || oWnd:Say( 8, 30, "
Width - Factor : " + ALLTRIM(STR( nNewWidth )) + " = " + ALLTRIM(STR( nFactorW )) + ;
                                                                     "
    Height - Factor : " + ALLTRIM(STR( nNewHeight )) + " = " +  ALLTRIM(STR( nFactorH )) + ;
                                     "
  ( " + ALLTRIM(STR( nWidth )) + " x " + ALLTRIM(STR( nHeight )) + "  ) ", ;
                                     CLR_WHITE, CLR_MSPURPLE, oWnd:oFont, .T., .T. ), ;
                    SHOW_IMG( oWnd, nImgRow, nImgCol, nImgSpace, nFactorW, nFactorH, lWZoomed ) }

oWnd:bLClicked = { | nRow, nCol | If( nRow < 25, ( oWnd:Capture(), nRowPos := nRow, nColPos := nCol, lDrag := .T. ),),;
                                    If( nRow > 25 .and. nCol > oWnd:nWidth - 25, ( oWnd:Capture(), nRowPos := nRow, nColPos := nCol, lRResize := .T. ),),;
                                    If( nRow > 25 .and. nRow > oWnd:nHeight - 25, ( oWnd:Capture(), nRowPos := nRow, nColPos := nCol, lBResize := .T. ),) }
     
oWnd:bMMoved = { | nRow, nCol | TrackMouseEvent( oWnd:hWnd, TME_LEAVE ),;
                                   If( lDrag .and. ! IsZoomed( oWnd:hWnd ) .and. IsOverWnd( oWnd:hWnd, nRow, nCol ),;
                                       oWnd:Move( oWnd:nTop + nRow - nRowPos, oWnd:nLeft + nCol - nColPos,,, .T. ),),;
                                   If( lRResize .and. ! IsZoomed( oWnd:hWnd ) .and. IsOverWnd( oWnd:hWnd, nRow, nCol ),;    // width
                                       ( oWnd:SetSize( oWnd:nWidth + nCol - nColPos, oWnd:nHeight, .T. ), nColPos := nCol,;
                                         nNewWidth := oWnd:nWidth(), nFactorW := nNewWidth / nWidth, lWZoomed := .T. ),),;
                                   If( lBResize .and. ! IsZoomed( oWnd:hWnd ) .and. IsOverWnd( oWnd:hWnd, nRow, nCol ),;    // height
                                       ( oWnd:SetSize( oWnd:nWidth, oWnd:nHeight + nRow - nRowPos, .T. ), nRowPos := nRow,;  
                                         nNewHeight := oWnd:nHeight(), nFactorH := nNewHeight / nHeight, lWZoomed := .F. ),) }               

oWnd:bLButtonUp = { || ReleaseCapture(), lDrag := .F., lRResize := .F., lBResize := .F. }
oWnd:bMLeave    = { || lDrag := .F. }

@ 1, oWnd:nWidth - 46 BTNBMP oBtnClose BITMAP c_path1 + "
closew.png" ;
      FLAT NOBORDER NOROUND ACTION oWnd:End() SIZE 32, 32 ;
      COLOR CLR_BLACK, CLR_MSPURPLE

@ 1, oWnd:nWidth - 92 BTNBMP oBtnMax BITMAP c_path1 + "
max.png" ;
      FLAT NOBORDER NOROUND ACTION If( ! IsZoomed( oWnd:hWnd ), oWnd:Maximize(), oWnd:Restore() ) SIZE 32, 32 ;
      COLOR CLR_BLACK, CLR_MSPURPLE

@ 1, oWnd:nWidth - 138 BTNBMP oBtnMin BITMAP c_path1 + "
min.png" ;
      FLAT NOBORDER NOROUND ACTION If( ! IsIconic( oWnd:hWnd ), oWnd:Iconize(), oWnd:Restore() ) SIZE 32, 32 ;
      COLOR CLR_BLACK, CLR_MSPURPLE

oBtnClose:bMMoved = { || oBtnClose:SetColor( CLR_BLACK, If( oBtnClose:lMOver, CLR_MSRED, oWnd:nClrPane ) ) }
oBtnMax:bMMoved   = { || oBtnMax:SetColor( CLR_BLACK, If( oBtnMax:lMOver, CLR_MSGRAY, oWnd:nClrPane ) ) }
oBtnMin:bMMoved   = { || oBtnMin:SetColor( CLR_BLACK, If( oBtnMin:lMOver, CLR_MSGRAY, oWnd:nClrPane ) ) }

oWnd:bResized = { || oBtnClose:Move( 1, oWnd:nWidth - 45 ), oBtnMax:Move( 1, oWnd:nWidth - 75 ),;
                                    oBtnMin:Move( 1, oWnd:nWidth - 105 ) }

ACTIVATE WINDOW oWnd

RETURN NIL

// --------------------

FUNCTION SHOW_IMG( oWnd, nImgRow, nImgCol, nImgSpace, nFactorW, nFactorH, lWZoomed )
LOCAL oGraphics := Graphics():New( oWnd:hDC )
LOCAL oImage := GDIBmp():New( c_path1 + "
Olga.jpg" )
LOCAL nTop, nLeft
LOCAL nWidth := oImage:GetWidth(), nHeight := oImage:GetHeight(), nSpace := 1
LOCAL nFactor := nFactorW

IF lWZoomed = .F. // vertical resize selected
    nFactor := nFactorH 
ENDIF

nTop    := nImgRow * nFactor
nLeft   := nImgCol * nFactor
nSpace  := nImgSpace * nFactor

// 1. Image
oGraphics:DrawImage( oImage, nTop, nLeft, nWidth * nFactor, nHeight * nFactor )
nImgCol := oImage:GetWidth() + nSpace
nTop    := nImgRow * nFactor
nLeft   := nLeft + nSpace + ( nWidth * nFactor )
oGraphics:destroy()

// 2. Image
oGraphics := Graphics():New( oWnd:hDC )
oGraphics:DrawImage( oImage, nTop, nLeft, nWidth * nFactor, nHeight * nFactor )
     
oGraphics:destroy()
   
RETURN NIL



regards
Uwe :D
Last edited by ukoenig on Mon May 13, 2019 6:45 pm, edited 7 times in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: User defined Windows captions

Postby Silvio.Falconi » Mon May 13, 2019 3:50 pm

Uwe,
with 2 images can be easy
try with 800 btnbmp 40X20 on a Tscrolpanel
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7053
Joined: Thu Oct 18, 2012 7:17 pm

Re: User defined Windows captions

Postby Antonio Linares » Mon May 13, 2019 4:20 pm

Dear Uwe,

Could you please provide the images the most similar possible to Windows 10 ones ? They seem to fit in 16x16 pixels

Black and white also

many thanks
regards, saludos

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

Re: User defined Windows captions

Postby ukoenig » Mon May 13, 2019 6:37 pm

Dear Antonio,

They seem to fit in 16x16 pixels


to small 45 x 24 used
in case the lines are to heavy I can make them a little bit smaller

now it looks the same like the windows-systembuttons
do You want the vertical lines between the buttons as well ( added ) ?
I changed the close-button-color on caption

Image

System-images

Image

Image

Image

smaller lines :!:

Image

Image

Image

NO vertical lines :!:

Image

Image

Image


Image

Image

Image

New button-values used :!:

Code: Select all  Expand view

FUNCTION MAIN()
LOCAL oWnd, nRowPos, nColPos, oBtnClose, oBtnMax, oBtnMin, lDrag := .F., lRResize := .F., lBResize := .F.

LOCAL nWidth := 500, nNewWidth := 500, nHeight := 300, nNewHeight := 300
LOCAL nFactorW := 1, nFactorH := 1, lWZoomed

LOCAL nImgRow := 40, nImgCol := 40
LOCAL nImgSpace := 16, nLeftPos, nRightPos

c_path := cFilePath(GetModuleFileName( GetInstance() ) )
c_path1 := c_path + "BITMAPS\"  

DEFINE WINDOW oWnd STYLE WS_POPUP COLOR CLR_BLACK, CLR_MSPURPLE

oWnd:SetSize( nWidth, nHeight )
oWnd:Center()
oWnd:Shadow()
oWnd:bPainted   := { || oWnd:Say( 8, 10, "
Width - Factor : " + ALLTRIM(STR( nNewWidth )) + " = " + ALLTRIM(STR( nFactorW )) + ;
                                                                     "
    Height - Factor : " + ALLTRIM(STR( nNewHeight )) + " = " +  ALLTRIM(STR( nFactorH )) + ;
                                     "
  ( " + ALLTRIM(STR( nWidth )) + " x " + ALLTRIM(STR( nHeight )) + "  ) ", ;
                                     CLR_WHITE, CLR_MSPURPLE, oWnd:oFont, .T., .T. ), ;
                    SHOW_IMG( oWnd, nImgRow, nImgCol, nImgSpace, nFactorW, nFactorH, lWZoomed ) }

oWnd:bLClicked = { | nRow, nCol | If( nRow < 25, ( oWnd:Capture(), nRowPos := nRow, nColPos := nCol, lDrag := .T. ),),;
                                    If( nRow > 25 .and. nCol > oWnd:nWidth - 25, ( oWnd:Capture(), nRowPos := nRow, nColPos := nCol, lRResize := .T. ),),;
                                    If( nRow > 25 .and. nRow > oWnd:nHeight - 25, ( oWnd:Capture(), nRowPos := nRow, nColPos := nCol, lBResize := .T. ),) }
     
oWnd:bMMoved = { | nRow, nCol | TrackMouseEvent( oWnd:hWnd, TME_LEAVE ),;
                                   If( lDrag .and. ! IsZoomed( oWnd:hWnd ) .and. IsOverWnd( oWnd:hWnd, nRow, nCol ),;
                                       oWnd:Move( oWnd:nTop + nRow - nRowPos, oWnd:nLeft + nCol - nColPos,,, .T. ),),;
                                   If( lRResize .and. ! IsZoomed( oWnd:hWnd ) .and. IsOverWnd( oWnd:hWnd, nRow, nCol ),;    // width
                                       ( oWnd:SetSize( oWnd:nWidth + nCol - nColPos, oWnd:nHeight, .T. ), nColPos := nCol,;
                                         nNewWidth := oWnd:nWidth(), nFactorW := nNewWidth / nWidth, lWZoomed := .T. ),),;
                                   If( lBResize .and. ! IsZoomed( oWnd:hWnd ) .and. IsOverWnd( oWnd:hWnd, nRow, nCol ),;    // height
                                       ( oWnd:SetSize( oWnd:nWidth, oWnd:nHeight + nRow - nRowPos, .T. ), nRowPos := nRow,;  
                                         nNewHeight := oWnd:nHeight(), nFactorH := nNewHeight / nHeight, lWZoomed := .F. ),) }               

oWnd:bLButtonUp = { || ReleaseCapture(), lDrag := .F., lRResize := .F., lBResize := .F. }
oWnd:bMLeave    = { || lDrag := .F. }

@ 1, oWnd:nWidth - 140 BTNBMP oBtnMin BITMAP c_path1 + "
min.png" ;
      FLAT NOBORDER NOROUND ACTION If( ! IsIconic( oWnd:hWnd ), oWnd:Iconize(), oWnd:Restore() ) SIZE 45, 24 ;
      COLOR CLR_BLACK, CLR_MSPURPLE

@ 1, oWnd:nWidth - 95 BTNBMP oBtnMax BITMAP c_path1 + "
max.png" ;
      FLAT NOBORDER NOROUND ACTION If( ! IsZoomed( oWnd:hWnd ), oWnd:Maximize(), oWnd:Restore() ) SIZE 45, 24 ;
      COLOR CLR_BLACK, CLR_MSPURPLE

@ 1, oWnd:nWidth - 50 BTNBMP oBtnClose BITMAP c_path1 + "
closew.png" ;
      FLAT NOBORDER NOROUND ACTION oWnd:End() SIZE 45, 24 ;
      COLOR CLR_BLACK, CLR_MSPURPLE

oBtnMin:bMMoved   = { || oBtnMin:SetColor( CLR_BLACK, If( oBtnMin:lMOver, CLR_MSGRAY, oWnd:nClrPane ) ) }
oBtnMax:bMMoved   = { || oBtnMax:SetColor( CLR_BLACK, If( oBtnMax:lMOver, CLR_MSGRAY, oWnd:nClrPane ) ) }
oBtnClose:bMMoved = { || oBtnClose:SetColor( CLR_BLACK, If( oBtnClose:lMOver, nRGB( 236, 108, 96 ) , oWnd:nClrPane ) ) }

oWnd:bResized = { || oBtnMin:Move( 1, oWnd:nWidth - 140 ), oBtnMax:Move( 1, oWnd:nWidth - 95 ),;
                                    oBtnClose:Move( 1, oWnd:nWidth - 50 ) }

ACTIVATE WINDOW oWnd

RETURN NIL


regards
Uwe :D
Last edited by ukoenig on Tue May 14, 2019 9:17 am, edited 2 times in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: User defined Windows captions

Postby Antonio Linares » Tue May 14, 2019 6:08 am

thank you :-)
regards, saludos

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

Re: User defined Windows captions

Postby Silvio.Falconi » Tue May 14, 2019 7:24 am

many year ago I made a game ...game finds the differences for children and for adults
and this dialog with two image, reminded me of this game
if I can find it, I send it to you
I remember that I had made so many images for Garombo Ugo's baby
and every week he had fun with my game
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7053
Joined: Thu Oct 18, 2012 7:17 pm

Re: User defined Windows captions

Postby ukoenig » Tue May 14, 2019 9:17 am

The calculation of a image-matrix
resized in both directions

Image

Code: Select all  Expand view

FUNCTION SHOW_IMG( oWnd, nImgRow, nImgCol, nImgSpace, nFactorW, nFactorH, lWZoomed )
LOCAL oGraphics := Graphics():New( oWnd:hDC )
LOCAL oImage := GDIBmp():New( c_path1 + "Olga.jpg" )
LOCAL nTop, nLeft
LOCAL nWidth := oImage:GetWidth(), nHeight := oImage:GetHeight(), nSpace := 1
LOCAL nFactor := nFactorW

IF lWZoomed = .F.                   // vertical resize selected
    nFactor := nFactorH 
ENDIF

nTop    := nImgRow * nFactor        // start-position top
nLeft   := nImgCol * nFactor        // start-position left
nOrgLeft    := nImgCol * nFactor        // reset to left on new row

nSpace  := nImgSpace * nFactor      // zoomed space between images

I := 1
X := 0
FOR I := 1 TO 8                                 // 2 rows with 8 images
    X++
    oGraphics:DrawImage( oImage, nTop, nLeft, ;     // image draw
                                            nWidth * nFactor, nHeight * nFactor )
    nImgCol := oImage:GetWidth() + nSpace           // new col-pos each image horizontal
    nLeft   += nSpace + ( nWidth * nFactor )            // next image left position
    oGraphics:destroy()

        oGraphics := Graphics():New( oWnd:hDC )
    IF X = 4                                        // break after 4 images each row
                nTop    += nHeight * nFactor + nSpace       // next row-position
        nLeft   := nOrgLeft
        X := 0
    ENDIF
NEXT

RETURN NIL
 


regards
Uwe :D
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: User defined Windows captions

Postby ukoenig » Thu May 30, 2019 1:13 pm

I created a new example with a included panel ( added to my sample-collection )
using the basics with some extensions
I'm still waiting for Otto's answer if he likes to resize the panel-images as well.
The top-lines are centered on resize.

there are cursorchanges added
on top the cursor changes from normal to CursorCatch() and on right and bottom ( resize )
to CursorSize()

Image

regards
Uwe :D
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 80 guests