I have been reading the archive about creating text with a custom font and color and applying a custom background to my MainDialog.
Here is a snippet of what I am using from the SMTP.BAS example in the TCP folder ...
SELECT CASE CBMSG
CASE %WM_INITDIALOG
hFont = MakeFont("Courier New", 10)
CONTROL SEND hDlgMain, 105, %WM_SETFONT,hFont, 1
DIALOG SEND hDlgMain, %WM_GETFONT, 0, 0 TO hFont
GetObject hFont, SIZEOF(lf), BYVAL VARPTR(lf)
lf.lfWeight = %FW_BOLD
hFont = CreateFontIndirect(lf)
CONTROL SET FOCUS hDlgMain, 103
DIALOG GET SIZE CBHNDL TO x, y
DIALOG UNITS CBHNDL, x, y TO PIXELS x, y
' Load the bitmap from a file
GetModuleFilename %NULL, bmpfile, SIZEOF(bmpfile)
bmpfile = UCASE$(bmpfile)
REPLACE ".EXE" WITH ".BMP" IN bmpfile
hBmp = LoadImage(BYVAL %NULL, bmpfile, %IMAGE_BITMAP, x, y, %LR_LOADFROMFILE)
FUNCTION = 1
CASE %WM_CTLCOLOREDIT
SetTextColor CBWPARAM, %BLUE
FUNCTION = GetStockObject(%WHITE_BRUSH)
CASE %WM_CTLCOLORSTATIC
SelectObject CBWPARAM, hFont
SetBkMode CBWPARAM, %TRANSPARENT
SetTextColor CBWPARAM, %YELLOW
FUNCTION = GetStockObject(%NULL_BRUSH)
CASE %WM_ERASEBKGND
hBmpDC = CreateCompatibleDC(CBWPARAM)
SelectObject hBmpDC, hBmp
BitBlt CBWPARAM, 0, 0, x, y, hBmpDC, 0, 0, %SRCCOPY
DeleteDC hBmpDC
FUNCTION = 1
END SELECT
This works great.
The problem is that I send text to the window MANY times with:
CONTROL SET TEXT hDlg, 104, MyString
Each time I send the text it IS displayed but ON TOP of whats allready there. How do i delete whats allredy there just befor i display the new text.
Thanks
------------------
Kind Regards
Mike
Here is a snippet of what I am using from the SMTP.BAS example in the TCP folder ...
SELECT CASE CBMSG
CASE %WM_INITDIALOG
hFont = MakeFont("Courier New", 10)
CONTROL SEND hDlgMain, 105, %WM_SETFONT,hFont, 1
DIALOG SEND hDlgMain, %WM_GETFONT, 0, 0 TO hFont
GetObject hFont, SIZEOF(lf), BYVAL VARPTR(lf)
lf.lfWeight = %FW_BOLD
hFont = CreateFontIndirect(lf)
CONTROL SET FOCUS hDlgMain, 103
DIALOG GET SIZE CBHNDL TO x, y
DIALOG UNITS CBHNDL, x, y TO PIXELS x, y
' Load the bitmap from a file
GetModuleFilename %NULL, bmpfile, SIZEOF(bmpfile)
bmpfile = UCASE$(bmpfile)
REPLACE ".EXE" WITH ".BMP" IN bmpfile
hBmp = LoadImage(BYVAL %NULL, bmpfile, %IMAGE_BITMAP, x, y, %LR_LOADFROMFILE)
FUNCTION = 1
CASE %WM_CTLCOLOREDIT
SetTextColor CBWPARAM, %BLUE
FUNCTION = GetStockObject(%WHITE_BRUSH)
CASE %WM_CTLCOLORSTATIC
SelectObject CBWPARAM, hFont
SetBkMode CBWPARAM, %TRANSPARENT
SetTextColor CBWPARAM, %YELLOW
FUNCTION = GetStockObject(%NULL_BRUSH)
CASE %WM_ERASEBKGND
hBmpDC = CreateCompatibleDC(CBWPARAM)
SelectObject hBmpDC, hBmp
BitBlt CBWPARAM, 0, 0, x, y, hBmpDC, 0, 0, %SRCCOPY
DeleteDC hBmpDC
FUNCTION = 1
END SELECT
This works great.
The problem is that I send text to the window MANY times with:
CONTROL SET TEXT hDlg, 104, MyString
Each time I send the text it IS displayed but ON TOP of whats allready there. How do i delete whats allredy there just befor i display the new text.
Thanks
------------------
Kind Regards
Mike
Comment