- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm trying to make a color selector dialog.
The Dialog consists of three sliders (reg,green,blue), and an "Picture Control" with type set to Bitmap.
So I create the bitmap with
hBitmap_Image=CreateBitmap(64,64,3,8,
Loc(hBitmap_pixels))
, in the update subroutine of the slider I call
retlog = SetBitmapBits(hBitmap_Image, col,
LOC( hBitmap_pixels)) ! update color col
! update the bitmap in the dialog
retlog = DLGSENDCTRLMESSAGE(dlg,IDC_COLDLG_IMG, STM_SETIMAGE,IMAGE_BITMAP,hBitmap_Image)
I get TRUE for the two functions, but nothing hapened in the Dialog. Any fundamental error ?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
1. Drawing a bitmap is somewhat more complicated. You need to create a PaintStruct by calling BeginPaint (and then signal the end of the activity with EndPaint), and then draw the bitmap using the design context which is returned as a component of the PaintStruct. I can provide a code sample for this, but it's long and complex.
2. If your goal is simply to have a color-picker, for which the bitmap is just a small region showing the currently selected color value, it's much easier to do this with a rectangle which can be filled with a selected color.
3. Or, simpler still, you could use the Windows ColorPicker common dialog:
LOGICAL FUNCTION CmnDlgChooseColor(hwndParent, color)
IMPLICIT NONE
INTEGER, INTENT(IN) :: hwndParent
INTEGER, INTENT(INOUT) :: color
TYPE(T_CHOOSECOLOR) :: cc
cc%lStructSize = SIZEOF(cc)
cc%hwndOwner = hwndParent
cc%lpCustColors = LOC(customColors)
cc%rgbResult = color
cc%Flags = CC_RGBINIT
IF(ChooseColor(cc)) THEN
CmnDlgChooseColor = .TRUE.
color = cc%rgbResult
ELSE
CmnDlgChooseColor = .FALSE.
END IF
END FUNCTION CmnDlgChooseColor

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page