Hi,
Is it possible to create a dialog box that cannot be moved if the user tries?
I'm not talking about re-sizing, I actually want to put a dialog box in a certain position on the screen an have it stay in the one spot.
// ---------------- IMAGE ------------------------------
FUNCTION MAIN_DLG4( oWnd, oBrush1, oFont2 )
LOCAL hDC, oBrush, oTITLE, oBtn, oBtn1, oBMP, oIMAGE
lACTIVATE[1] = .T.
DEFINE DIALOG oDlg1 RESOURCE "Painter3" OF oWnd BRUSH oBrush1
// For Title-painting You can use any small Bitmap
// You can define a Action as well ( on Title-Click ).
// --------------------------------------------------------
REDEFINE BITMAP oTITLE ID 100 ADJUST RESOURCE "Blanc" OF oDlg1
oTITLE:cTooltip := "Please select a Button"
// Action :
oTITLE:bLclicked := { |hDC| MsgAlert( "Test", "Attention" ) } // bRClicked
oTITLE:bPainted := { |hDC| ;
DRAW_TITLE( oTITLE, ; // BMP
hDC, ; // hDC
.T., ; // Horiz. or Vert.
14853684, ; // 1. Grad-Color
16314573, ; // 2. Grad-Color
0.50, ; // Color-Pos.
0, ; // Text-Pos from left ( 0 = centered )
oFont2, ; // Font
128, ; // Font-Color
"Dialog Image ...") } // The Title-text
...
...
...
ACTIVATE DIALOG oDlg1 NOWAIT ;
ON INIT oDlg1:Move( 50, aRect4 - (675 + nFACTOR5), NIL, NIL, .T. ) // calculated Dialog-position
RETURN NIL
//------------- Gradient / Color- TITLE-function -----------
FUNCTION DRAW_TITLE( oBitmap, hDC, lDirect, nVColor, ;
nBColor, nMove, nLeft, oFont, nTColor, cTitle )
LOCAL aGrad := { { nMove, nVColor, nBColor }, { nMove, nBColor, nVColor } }
LOCAL aRect := GETCLIENTRECT( oBitmap:hWnd )
LOCAL oNewBrush, oBtn1
DEFINE BRUSH oNewBrush ;
COLOR GradientFill( hDC, 0, 0, aRect[3], aRect[4], aGrad, lDirect )
hOldFont := SelectObject( hDC, oFont:hFont )
nTXTLG := GettextWidth( hDC, cTitle )
nBMPLONG := oBitmap:Super:nWidth()
nBMPHIGHT := oBitmap:Super:nHeight()
nFONTHIGHT := oFont:nInpHeight * -1
IF nLEFT = 0
nLEFT := (nBMPLONG - nTXTLG) / 2
ENDIF
nNEWHIGHT := nFONTHIGHT
nTOP := (nBMPHIGHT - nNEWHIGHT) / 2
SetTextColor( hDC,nTColor)
SetBkMode( oBitmap:hDC, 0 )
TextOut( hDC, nTOP, nLEFT, cTitle )
RELEASE BRUSH oNewbrush
RETURN NIL
// The Resource :
// ------------------
PAINTER3 DIALOG -4, 13, 138, 158
STYLE WS_POPUP | WS_VISIBLE | WS_DLGFRAME | WS_THICKFRAME
FONT 12, "MS Sans Serif"
{
EDITTEXT 210, 4, 53, 130, 12
CONTROL "", 310, "TBitmap", 0 | WS_CHILD | WS_VISIBLE, 4, 69, 130, 85
CONTROL "", 110, "TBtnBmp", 0 | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 4, 27, 64, 23
CONTROL "", 100, "TBitmap", 0 | WS_CHILD | WS_VISIBLE, -1, -1, 139, 19
CONTROL "", 900, "TBtnBmp", 0 | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 72, 27, 62, 23
}
// ---------------- IMAGE ------------------------------
FUNCTION MAIN_DLG4( oWnd, oBrush1, oFont2 )
LOCAL hDC, oBrush, oTITLE, oBtn, oBtn1, oBMP, oIMAGE
DEFINE DIALOG oDlg1 FROM 5, 5 TO 200, 400 ;
STYLE nOr( WS_POPUP, WS_VISIBLE, WS_DLGFRAME, WS_THICKFRAME ) PIXEL
@ 0, 0 BITMAP oTITLE FILE "Colors.bmp" SIZE oDlg1:nWidth, 25 OF oDlg1 ADJUST
oTITLE:cTooltip := "Please select a Button"
oTITLE:bPainted := { |hDC| ;
DRAW_TITLE( oTITLE, ; // BMP
hDC, ; // hDC
.T., ; // Horiz. or Vert.
14853684, ; // 1. Grad-Color
16314573, ; // 2. Grad-Color
0.50, ; // Color-Pos.
oDlg1:nWidth, ; // Title Width
0, ; // Text-Pos from left ( 0 = centered )
oFont2, ; // Font
128, ; // Font-Color
"Dialog Image ...") }
ACTIVATE DIALOG oDlg1 NOWAIT ;
ON INIT oDlg1:Move( 50, 50, NIL, NIL, .T. )
RETURN NIL
//------------- Gradient / Color- TITLE-function DIFFERENT from RESOURCE !!!! -----------
FUNCTION DRAW_TITL1( oBitmap, hDC, lDirect, nVColor, ;
nBColor, nMove, nWidth, nLeft, oFont, nTColor, cTitle )
LOCAL aGrad := { { nMove, nVColor, nBColor }, { nMove, nBColor, nVColor } }
LOCAL oNewBrush, oBtn1
nBMPHIGHT := oBitmap:Super:nHeight()
DEFINE BRUSH oNewBrush ;
COLOR GradientFill( hDC, 0, 0, nBMPHIGHT, nWidth, aGrad, lDirect )
hOldFont := SelectObject( hDC, oFont:hFont )
nTXTLG := GettextWidth( hDC, cTitle )
nFONTHIGHT := oFont:nInpHeight * -1
IF nLEFT = 0
nLEFT := (nWidth - nTXTLG) / 2
ENDIF
nNEWHIGHT := nFONTHIGHT
nTOP := (nBMPHIGHT - nNEWHIGHT) / 2
SetTextColor( hDC,nTColor)
SetBkMode( oBitmap:hDC, 0 )
TextOut( hDC, nTOP, nLEFT, cTitle )
RELEASE BRUSH oNewbrush
RETURN NIL
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot], RSalazarU and 87 guests