ShowCustomizePaletteDlg Example for Visual Basic
Dim RasterColorDlg As New LEADRasterDlgClr
Dim RasterProc As New LEADRasterProcess
Dim nRet As Integer
Dim i As Integer
Private Sub CustomizePalette_Click()
RasterColorDlg.UserPaletteCount = 256
For i = 0 To 255
RasterColorDlg.UserPalette (i) = RGB(i, i, i)
Next i
RasterColorDlg.UIFlags = CUSTOMIZEPALETTE_SHOW_SORT Or _
CUSTOMIZEPALETTE_SHOW_FINDCLOSEST Or _
CUSTOMIZEPALETTE_SHOW_ADDOPTION Or _
CUSTOMIZEPALETTE_SHOW_REMOVEOPTION Or _
CUSTOMIZEPALETTE_SHOW_RGBLEFTPAN Or _
CUSTOMIZEPALETTE_SHOW_HTMLLEFTPAN Or _
CUSTOMIZEPALETTE_SHOW_INDEXLEFTPAN Or _
CUSTOMIZEPALETTE_SHOW_RGBRIGHTPAN Or _
CUSTOMIZEPALETTE_SHOW_HTMLRIGHTPAN Or _
CUSTOMIZEPALETTE_SHOW_INDEXRIGHTPAN Or _
CUSTOMIZEPALETTE_SHOW_NEW Or _
CUSTOMIZEPALETTE_SHOW_OPEN Or _
CUSTOMIZEPALETTE_SHOW_SAVE Or _
CUSTOMIZEPALETTE_SHOW_SAVEAS Or _
CUSTOMIZEPALETTE_GENERATE_PALETTE
RasterColorDlg.Bitmap = LEADRasterView1.Raster.Bitmap
nRet = RasterColorDlg.ShowCustomizePaletteDlg (Main.hWnd)
If (nRet = 0 And RasterColorDlg.DialogStatus = DLG_OK) Then
If (RasterColorDlg.ApplyPaletteWhenExit) Then
MsgBox "True"
Else
MsgBox "False"
End If
For i = 0 To 255
RasterProc.UserPalette(i) = RasterColorDlg.GeneratedPalette (i)
Next i
End If
End Sub