the %rgb_whitesmoke color is used in a graphic control. The actual value is &HF5F5F5, but when I read the pixel value back with GRAPHIC GET PIXEL it is &HF7F7F7. I think I am missing something, possibly brain cells...
Code:
#compile exe #dim all %IDD_DIALOG1 = 101 %IDC_GRAPHIC1 = 1001 '------------------------------------------ function getxright (hd as dword) as long local p2 as pointapi local i, yy, l as long local s as string ' debug graphic get client to p2.x, p2.y ' start at the RH edge and move inwards until the rgb_whitesmoke chart area is reached ' This is the RH end of the plotbaseline. '? str$(p2.x) + str$(p2.y) yy = p2.y -20 i = p2.x l = %rgb_whitesmoke s = "%rgb_whitesmoke =" + hex$(l) + $crlf do graphic get pixel (i, yy) to l graphic set pixel (i, yy), %red' debug if l = %rgb_whitesmoke then function = i exit function end if s = s + " " + hex$(l) ' debug decr i loop while i > 0 graphic redraw ' debug ? s 'debug end function '--------------------------------------- callback function ShowDIALOG1Proc() local x, y, l as long select case as long cbmsg case %wm_initdialog graphic attach cb.hndl, %idc_graphic1 graphic get client to x, y graphic box (10, 10) - (x-10, y-10), 0, %rgb_whitesmoke, %rgb_whitesmoke, 0 l = getxright( cb.hndl) end select end function '--------------------------------------- function ShowDIALOG1(byval hParent as dword) as long local lRslt as long local hDlg as dword dialog new hParent, "graphic pixel color problem", 242, 122, 201, 144, %ws_popup or %ws_border or %ws_dlgframe or %ws_sysmenu _ or %ws_clipsiblings or %ws_visible or %ds_modalframe or %ds_3dlook or %ds_nofailcreate or %ds_setfont, _ %ws_ex_controlparent or %ws_ex_left or %ws_ex_ltrreading or %ws_ex_rightscrollbar, to hDlg control add graphic, hDlg, %IDC_GRAPHIC1, "", 8, 10, 184, 100 dialog show modal hDlg, call ShowDIALOG1Proc to lRslt function = lRslt end function '--------------------------------------- function pbmain() ShowDIALOG1 %hwnd_desktop end function
Comment