• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ ChooseColor函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中ChooseColor函数的典型用法代码示例。如果您正苦于以下问题:C++ ChooseColor函数的具体用法?C++ ChooseColor怎么用?C++ ChooseColor使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了ChooseColor函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: UNREFERENCED_PARAMETER

BOOL CMainFrame::OnCommand(WPARAM wParam, LPARAM lParam)
{
	// OnCommand responds to menu and and toolbar input

	UNREFERENCED_PARAMETER(lParam);

	switch(LOWORD(wParam))
	{
	case IDM_FILE_EXIT:		 OnFileExit();				return TRUE;
	case IDM_MODERN:		 ChooseColor(IDM_MODERN);	return TRUE;
	case IDM_BLUE:			 ChooseColor(IDM_BLUE);		return TRUE;
	case IDM_GREY:			 ChooseColor(IDM_GREY);		return TRUE;
	case IDM_OLIVE:			 ChooseColor(IDM_OLIVE);	return TRUE;
	case IDM_OCHRE:			 ChooseColor(IDM_OCHRE);	return TRUE;
	case IDM_MAUVE:			 ChooseColor(IDM_MAUVE);	return TRUE;
	case IDM_PINK:			 ChooseColor(IDM_PINK);		return TRUE;
	case IDM_GOLD:			 ChooseColor(IDM_GOLD);		return TRUE;
	case IDM_BLACK:			 ChooseColor(IDM_BLACK);	return TRUE;
	case IDM_USE_THEMES:	 OnUseThemes();				return TRUE;
	case IDM_BAND_COLORS:	 OnBandColors();			return TRUE;
	case IDM_FLAT_STYLE:	 OnFlatStyle();				return TRUE;
	case IDM_LEFT_BANDS:	 OnLeftBands();				return TRUE;
	case IDM_LOCK_MENUBAR:	 OnLockMenuBar();			return TRUE;
	case IDM_ROUND_BORDERS:	 OnRoundBorders();			return TRUE;
	case IDM_SHORT_BANDS:	 OnShortBands();			return TRUE;
	case IDM_USE_LINES:		 OnUseLines();				return TRUE;
	case IDM_VIEW_ARROWS:	 OnViewArrows();			return TRUE;
	case IDM_VIEW_CARDS:	 OnViewCards();				return TRUE;
	case IDW_VIEW_STATUSBAR: OnViewStatusBar();			return TRUE;
	case IDW_VIEW_TOOLBAR:	 OnViewToolBar();			return TRUE;
	case IDM_HELP_ABOUT:	 OnHelp();					return TRUE;
	}

	return FALSE;
}
开发者ID:quinsmpang,项目名称:Tools,代码行数:35,代码来源:Mainfrm.cpp


示例2: MYMENU_FormatBGColor

void MYMENU_FormatBGColor()
{
    CHOOSECOLOR cc;
    static COLORREF acrCustClr[16];// array of custom colors
    static DWORD rgbCurrent;// initial color selection

    ZeroMemory(&cc, sizeof(cc));
    cc.lStructSize = sizeof(cc);
    cc.hwndOwner = hwnd;
    cc.lpCustColors = (LPDWORD) acrCustClr;
    cc.rgbResult = rgbCurrent;
    cc.Flags = CC_FULLOPEN | CC_RGBINIT;

    if ( ChooseColor(&cc) ) {
        int row, col;
        CellInfo* info = iterate_selection( table, &row, &col );
        while ( info != NULL ) {
            // history
            history_append( row, col );
            free_redo_history();
            info->style.bg_rgb = cc.rgbResult;
            info = iterate_selection( table, &row, &col );
        }
        update_table_view();
    }
}
开发者ID:nihui,项目名称:oxygenspread,代码行数:26,代码来源:mymenu.c


示例3: ColorDlg

bool ColorDlg(HWND hwnd, DWORD &dwColor )
{
	CHOOSECOLOR cc;                 // common dialog box structure 
	static COLORREF acrCustClr[16]; // array of custom colors 

	HBRUSH hbrush;                  // brush handle
	//static DWORD rgbCurrent;        // initial color selection

	bool rslt = false;

	// Initialize CHOOSECOLOR 
	ZeroMemory(&cc, sizeof(cc));
	cc.lStructSize = sizeof(cc);
	cc.hwndOwner = hwnd;
	cc.lpCustColors = (LPDWORD)acrCustClr;
	cc.rgbResult = dwColor;

	cc.Flags = CC_FULLOPEN | CC_RGBINIT ;

	if (ChooseColor(&cc) == TRUE)
	{
		dwColor = cc.rgbResult;
		rslt = true;
	}

	return rslt;
}
开发者ID:wck01,项目名称:Basic-Excel-R-Toolkit,代码行数:27,代码来源:Console.cpp


示例4: mxChooseColor

bool
mxChooseColor (mxWindow *parent, int *r, int *g, int *b)
{
	CHOOSECOLOR cc;
	static COLORREF custColors[16];

	BYTE rr = *r;
	BYTE gg = *g;
	BYTE bb = *b;

	memset (&cc, 0, sizeof (CHOOSECOLOR));
	cc.lStructSize = sizeof (CHOOSECOLOR);
	cc.hwndOwner = parent ? (HWND) parent->getHandle ():NULL;
	cc.rgbResult = RGB (rr, gg, bb);
	cc.lpCustColors = custColors;
	cc.Flags = CC_ANYCOLOR | CC_FULLOPEN | CC_RGBINIT;

	if (ChooseColor (&cc))
	{
		*r = (int) GetRValue (cc.rgbResult);
		*g = (int) GetGValue (cc.rgbResult);
		*b = (int) GetBValue (cc.rgbResult);

		return true;
	}

	return false;
}
开发者ID:chrizonix,项目名称:RCBot2,代码行数:28,代码来源:mxchoosecolor.cpp


示例5: CallChangeColor

/*------------------------------------------------------------------------
 Procedure:     CallChangeColor ID:1
 Purpose:       Calls the standard color dialog of windows, starting
                with the given color reference. The result is the
                same as the input if the user cancels, or another
                color if the user validates another one.
 Input:         The starting color
 Output:        The color the user has choosen.
 Errors:        None
------------------------------------------------------------------------*/
static COLORREF CallChangeColor(COLORREF InitialColor)
{
        CHOOSECOLOR CC;
        COLORREF CustColors[16];
        int r, g, b, i;
        memset(&CC, 0, sizeof(CHOOSECOLOR));
        r = g = b = 0;
        for (i = 0; i < 16; i++) {
                CustColors[i] = RGB(r, g, b);
                if (r < 255)
                        r += 127;
                else if (g < 255)
                        g += 127;
                else if (b < 255)
                        g += 127;
        }
        CC.lStructSize = sizeof(CHOOSECOLOR);
        CC.hwndOwner = hwndMain;
        CC.hInstance = hInst;
        CC.rgbResult = InitialColor;
        CC.lpCustColors = CustColors;
        CC.Flags = CC_RGBINIT;
        if (!ChooseColor(&CC))
                return (InitialColor);
        return (CC.rgbResult);
}
开发者ID:retired-camels,项目名称:ocaml,代码行数:36,代码来源:menu.c


示例6: UpdateMenu

void
JXStyleMenu::Receive
	(
	JBroadcaster*	sender,
	const Message&	message
	)
{
	if (sender == this && message.Is(JXMenu::kNeedsUpdate))
		{
		UpdateMenu();
		}
	else if (sender == this && message.Is(JXMenu::kItemSelected))
		{
		const JXMenu::ItemSelected* selection =
			dynamic_cast(const JXMenu::ItemSelected*, &message);
		assert( selection != NULL );

		const JIndex i = selection->GetIndex();
		if (i == kCustomColorCmd)
			{
			assert( itsChooseCustomColorFlag );
			ChooseColor();
			}
		else
			{
			if (i >= kFirstColorCmd)
				{
				itsColorIndex = IndexToColor(i);
				}
			HandleMenuItem(i);
			}
		}

	else if (sender == itsChooseColorDialog &&
开发者ID:mbert,项目名称:mulberry-lib-jx,代码行数:34,代码来源:JXStyleMenu.cpp


示例7: sizeof

void TypeEd_EditBox::OnTextColorChanged(const MGUI::MouseEvent * e)
{
	Float4 color = mEditBox->GetTextColor();
	color.a = 1;

	static COLORREF crCustColors[6];
	CHOOSECOLOR cc;
	cc.lStructSize = sizeof(CHOOSECOLOR);
	cc.hwndOwner = App::Instance()->_hWnd();
	cc.hInstance = NULL;
	cc.rgbResult = RGB(color.r * 255, color.g * 255, color.b * 255);
	cc.lpCustColors = crCustColors;
	cc.Flags = CC_RGBINIT|CC_FULLOPEN;
	cc.lCustData = 0;
	cc.lpfnHook = NULL;
	cc.lpTemplateName = NULL;

	if (ChooseColor(&cc))
	{
		color.r = GetRValue(cc.rgbResult) / 255.0f;
		color.g = GetGValue(cc.rgbResult) / 255.0f;
		color.b = GetBValue(cc.rgbResult) / 255.0f;
		mEditBox->SetTextColor(color);
		mWidget_TextColor->SetColor(color);
	}
}
开发者ID:MSoft1115,项目名称:Rad3D,代码行数:26,代码来源:TypeEd_EditBox.cpp


示例8: GetDlgItem

LRESULT
CEditColorDlg::OnLButtonUp( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled )
{
	RECT rcColorWnd = { 0 };
	CWindow ColorWnd = GetDlgItem( IDC_COLOR );
	ColorWnd.GetWindowRect( &rcColorWnd );

	DWORD dwPos = GetMessagePos();
	POINT pt = { LOWORD( dwPos ), HIWORD( dwPos ) };

	if( !PtInRect( &rcColorWnd, pt ) )
		return( 0 );

	CHOOSECOLOR cc;
	cc.lStructSize    = sizeof( CHOOSECOLOR );
	cc.hwndOwner      = m_hWnd;
	cc.hInstance      = NULL;
	cc.rgbResult      = m_uColor;
	cc.lpCustColors   = g_CustomColors;
	cc.Flags          = CC_RGBINIT | CC_FULLOPEN;
	cc.lCustData      = 0;
	cc.lpfnHook       = NULL;
	cc.lpTemplateName = NULL;
	if( ChooseColor( &cc ) )
	{
		m_uColor = cc.rgbResult;
		ShowColorInfo();
	}

	return( 0 );
}
开发者ID:porter-liu,项目名称:BeyondPicker,代码行数:31,代码来源:EditColorDlg.cpp


示例9: TestDesktop

void CTransCtrl::SetTextColor( )
{
	TestDesktop( );

	DWORD dwCustClrs [16];
	for ( int i = 0; i < 16; i++ )		 
		dwCustClrs [i] = _WHITE;

	m_textcolor = ReadRGBSetting( "res_x86", "textcolor", "255,255,255");

	CHOOSECOLOR color;
	ZeroMemory( &color, sizeof( CHOOSECOLOR ) );
	color.lStructSize = sizeof( CHOOSECOLOR );
	color.Flags = CC_RGBINIT|CC_ENABLEHOOK;
	color.rgbResult = m_textcolor;
	color.hwndOwner = GetMyWindowHandle( );
	color.lpCustColors = ( LPDWORD )dwCustClrs;
	color.lCustData = 0L;
	color.lpfnHook = CCHookProc;

	if( ChooseColor( &color ) )
	{
		m_textcolor = color.rgbResult;
		
		WriteRGBSetting( "res_x86", "textcolor", m_textcolor );		
		SendMessage( __GetDesktopListView( ), LVM_SETTEXTCOLOR, 57, m_textcolor );
		InvalidateRect( __GetDesktopListView( ), NULL, false );
		UpdateWindow( __GetDesktopListView( ) );

		SetTransparent();
	}	   
}
开发者ID:jsg2021,项目名称:Simply-Transparent,代码行数:32,代码来源:TransCtrl.cpp


示例10: OnColorButton

static VOID
OnColorButton(HWND hwndDlg, PDATA pData)
{
    /* Load custom colors from Registry */
    HKEY hKey = NULL;
    LONG res = ERROR_SUCCESS;
    CHOOSECOLOR cc;

    res = RegCreateKeyEx(HKEY_CURRENT_USER, TEXT("Control Panel\\Appearance"), 0, NULL, 0,
        KEY_ALL_ACCESS, NULL, &hKey, NULL);
    /* Now the key is either created or opened existing, if res == ERROR_SUCCESS */
    if (res == ERROR_SUCCESS)
    {
        /* Key opened */
        DWORD dwType = REG_BINARY;
        DWORD cbData = sizeof(pData->custom_colors);
        res = RegQueryValueEx(hKey, TEXT("CustomColors"), NULL, &dwType,
            (LPBYTE)pData->custom_colors, &cbData);
        RegCloseKey(hKey);
        hKey = NULL;
    }

    /* Launch ChooseColor() dialog */

    cc.lStructSize = sizeof(CHOOSECOLOR);
    cc.hwndOwner = hwndDlg;
    cc.hInstance = NULL;
    cc.rgbResult = g_GlobalData.desktop_color;
    cc.lpCustColors = pData->custom_colors;
    cc.Flags = CC_ANYCOLOR | /* Causes the dialog box to display all available colors in the set of basic colors.  */
               CC_FULLOPEN | /* opens dialog in full size */
               CC_RGBINIT ;  /* init chosen color by rgbResult value */
    cc.lCustData = 0;
    cc.lpfnHook = NULL;
    cc.lpTemplateName = NULL;
    if (ChooseColor(&cc))
    {
        /* Save selected color to var */
        g_GlobalData.desktop_color = cc.rgbResult;
        pData->bClrBackgroundChanged = TRUE;

        /* Apply button will be activated */
        PropSheet_Changed(GetParent(hwndDlg), hwndDlg);

        /* Window will be updated :) */
        InvalidateRect(GetDlgItem(hwndDlg, IDC_BACKGROUND_PREVIEW), NULL, TRUE);

        /* Save custom colors to reg. To this moment key must be created already. See above */
        res = RegOpenKeyEx(HKEY_CURRENT_USER, TEXT("Control Panel\\Appearance"), 0,
            KEY_WRITE, &hKey);
        if (res == ERROR_SUCCESS)
        {
            /* Key opened */
            RegSetValueEx(hKey, TEXT("CustomColors"), 0, REG_BINARY,
                (const BYTE *)pData->custom_colors, sizeof(pData->custom_colors));
            RegCloseKey(hKey);
            hKey = NULL;
        }
    }
}
开发者ID:RPG-7,项目名称:reactos,代码行数:60,代码来源:background.c


示例11: DoColor

/*
=============
DoColor

=============
*/
qboolean DoColor(int iIndex)
{
	CHOOSECOLOR	cc;
	static COLORREF	custom[16];

	cc.lStructSize = sizeof(cc);
	cc.hwndOwner = g_qeglobals.d_hwndMain;
	cc.hInstance = g_qeglobals.d_hInstance;
	cc.rgbResult = 
		(int)(g_qeglobals.d_savedinfo.colors[iIndex][0]*255) +
		(((int)(g_qeglobals.d_savedinfo.colors[iIndex][1]*255))<<8) +
		(((int)(g_qeglobals.d_savedinfo.colors[iIndex][2]*255))<<16);
    cc.lpCustColors = custom;
    cc.Flags = CC_FULLOPEN|CC_RGBINIT; 
    //cc.lCustData; 
    //cc.lpfnHook; 
    //cc.lpTemplateName

	if (!ChooseColor(&cc))
		return false;

	g_qeglobals.d_savedinfo.colors[iIndex][0] = (cc.rgbResult&255)/255.0;
	g_qeglobals.d_savedinfo.colors[iIndex][1] = ((cc.rgbResult>>8)&255)/255.0;
	g_qeglobals.d_savedinfo.colors[iIndex][2] = ((cc.rgbResult>>16)&255)/255.0;

	/* 
	** scale colors so that at least one component is at 1.0F 
	** if this is meant to select an entity color
	*/
	if ( iIndex == COLOR_ENTITY )
	{
		float largest = 0.0F;

		if ( g_qeglobals.d_savedinfo.colors[iIndex][0] > largest )
			largest = g_qeglobals.d_savedinfo.colors[iIndex][0];
		if ( g_qeglobals.d_savedinfo.colors[iIndex][1] > largest )
			largest = g_qeglobals.d_savedinfo.colors[iIndex][1];
		if ( g_qeglobals.d_savedinfo.colors[iIndex][2] > largest )
			largest = g_qeglobals.d_savedinfo.colors[iIndex][2];

		if ( largest == 0.0F )
		{
			g_qeglobals.d_savedinfo.colors[iIndex][0] = 1.0F;
			g_qeglobals.d_savedinfo.colors[iIndex][1] = 1.0F;
			g_qeglobals.d_savedinfo.colors[iIndex][2] = 1.0F;
		}
		else
		{
			float scaler = 1.0F / largest;

			g_qeglobals.d_savedinfo.colors[iIndex][0] *= scaler;
			g_qeglobals.d_savedinfo.colors[iIndex][1] *= scaler;
			g_qeglobals.d_savedinfo.colors[iIndex][2] *= scaler;
		}
	}

	Sys_UpdateWindows (W_ALL);

	return true;
}
开发者ID:amitahire,项目名称:development,代码行数:66,代码来源:win_main.c


示例12: calloc

bool IGraphicsWin::PromptForColor(IColor* pColor, char* prompt)
{
    if (!mPlugWnd) {
        return false;
    }
    if (!mCustomColorStorage) {
        mCustomColorStorage = (COLORREF*) calloc(16, sizeof(COLORREF));
    }
    CHOOSECOLOR cc;
    memset(&cc, 0, sizeof(CHOOSECOLOR));
    cc.lStructSize = sizeof(CHOOSECOLOR);
    cc.hwndOwner = mPlugWnd;
    cc.rgbResult = RGB(pColor->R, pColor->G, pColor->B);
    cc.lpCustColors = mCustomColorStorage;
    cc.lCustData = (LPARAM) prompt;
    cc.lpfnHook = CCHookProc;
    cc.Flags = CC_RGBINIT | CC_ANYCOLOR | CC_FULLOPEN | CC_SOLIDCOLOR | CC_ENABLEHOOK;
    
    if (ChooseColor(&cc)) {
        pColor->R = GetRValue(cc.rgbResult);
        pColor->G = GetGValue(cc.rgbResult);
        pColor->B = GetBValue(cc.rgbResult);
        return true;
    }
    return false;
}
开发者ID:tappleby,项目名称:hush-vst,代码行数:26,代码来源:IGraphicsWin.cpp


示例13: ColorProc

BOOL CALLBACK ColorProc(HWND hWnd, UINT msg, WPARAM wP, LPARAM lP)
{
	static bool chng;
	static CHOOSECOLOR chc;
	static COLORREF clold[Ncl];
	DRAWITEMSTRUCT *di;
	HBRUSH br;
	int cmd;
	RECT rc;

	switch(msg){
		case WM_INITDIALOG:
			setDlgTexts(hWnd, 23);
			memcpy(clold, colors, sizeof(clold));
			chng=false;
			return TRUE;

		case WM_DRAWITEM:
			di = (DRAWITEMSTRUCT*)lP;
			DrawFrameControl(di->hDC, &di->rcItem, DFC_BUTTON,
				DFCS_BUTTONPUSH|(di->itemState&ODS_SELECTED ? DFCS_PUSHED : 0));
			CopyRect(&rc, &di->rcItem);
			InflateRect(&rc, -3, -3);
			br= CreateSolidBrush(colors[di->CtlID-100]);
			FillRect(di->hDC, &rc, br);
			DeleteObject(br);
			break;

		case WM_COMMAND:
			cmd=LOWORD(wP);
			switch(cmd){
				default: //color square
					chc.lStructSize= sizeof(CHOOSECOLOR);
					chc.hwndOwner= hWnd;
					chc.hInstance= 0;
					chc.rgbResult= colors[cmd-100];
					chc.lpCustColors= custom;
					chc.Flags= CC_RGBINIT|CC_FULLOPEN;
					if(ChooseColor(&chc)){
						colors[cmd-100]=chc.rgbResult;
						InvalidateRect(GetDlgItem(hWnd, cmd), 0, TRUE);
						colorChanged();
						chng=true;
					}
					break;
				case IDCANCEL:
					if(chng){
						memcpy(colors, clold, sizeof(clold));
						colorChanged();
					}
					//!
				case IDOK:
					EndDialog(hWnd, cmd);
			}
			break;
	}
	return FALSE;
}
开发者ID:kambala-decapitator,项目名称:colorsudoku,代码行数:58,代码来源:sudoku.cpp


示例14: GetColor

/* Select a color using a color picker */
static BOOL
GetColor(HWND hwndDlg, GLOBALS* g, INT nButton)
{
	CHOOSECOLOR cc;
	COLORREF crCustom[16] = { 0 };
	COLORREF crColor;
	INT ID = 0;
	INT ColorIndex = 0;

	/* Get the color index from the element index and button number */
	switch (nButton)
	{
		case 0:
			ColorIndex = g_Assignment[g->CurrentElement].Color1;
			ID = IDC_ADVAPPEARANCE_COLOR1_B;
			break;

		case 1:
			ColorIndex = g_Assignment[g->CurrentElement].Color2;
			ID = IDC_ADVAPPEARANCE_COLOR2_B;
			break;

		case 2:
			ColorIndex = g_Assignment[g->CurrentElement].FontColor;
			ID = IDC_ADVAPPEARANCE_FONTCOLOR_B;
			break;
	}

	crColor = g->ThemeAdv.crColor[ColorIndex];

	/* Prepare cc structure */
	cc.lStructSize = sizeof(CHOOSECOLOR);
	cc.hwndOwner = hwndDlg;
	cc.hInstance = NULL;
	cc.rgbResult = crColor;
	cc.lpCustColors = crCustom;
	cc.Flags = CC_ANYCOLOR | CC_FULLOPEN | CC_RGBINIT;
	cc.lCustData = 0;
	cc.lpfnHook = NULL;
	cc.lpTemplateName = NULL;

	/* Create the colorpicker */
	if (ChooseColor(&cc))
	{
		g->ThemeAdv.crColor[ColorIndex] = cc.rgbResult;
		if (crColor != cc.rgbResult)
		{
			UpdateButtonColor(hwndDlg, g, ID, nButton, ColorIndex);
			SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_UPDATETHEME, 0, (LPARAM)&g->ThemeAdv);
			return TRUE;
		}
	}

	return FALSE;
}
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:56,代码来源:advappdlg.c


示例15: ChooseColor

void CMainFrame::OnBandColors()
{
	if (IsReBarSupported())
	{
		m_UseBandColors = !m_UseBandColors;
		ChooseColor(m_nColor);

		GetReBar()->RedrawWindow(0, 0, RDW_INVALIDATE|RDW_UPDATENOW|RDW_ERASE|RDW_ALLCHILDREN);
		RecalcLayout();
	}
}
开发者ID:quinsmpang,项目名称:Tools,代码行数:11,代码来源:Mainfrm.cpp


示例16: winColorDlgPopup

static int winColorDlgPopup(Ihandle* ih, int x, int y)
{
  InativeHandle* parent = iupDialogGetNativeParent(ih);
  CHOOSECOLOR choosecolor;
  unsigned char r, g, b;
  COLORREF lpCustColors[16];
  char* value;

  iupAttribSetInt(ih, "_IUPDLG_X", x);   /* used in iupDialogUpdatePosition */
  iupAttribSetInt(ih, "_IUPDLG_Y", y);

  /* if NOT set will NOT be Modal */
  /* anyway it will be modal only relative to its parent */
  if (!parent)
    parent = GetActiveWindow();  

  iupStrToRGB(iupAttribGet(ih, "VALUE"), &r, &g, &b);

  ZeroMemory(lpCustColors, 16*sizeof(COLORREF));

  value = iupAttribGetStr(ih, "COLORTABLE");
  if (value)
    winColorDlgStringToColors(value, lpCustColors);

  ZeroMemory(&choosecolor, sizeof(CHOOSECOLOR));
  choosecolor.lStructSize = sizeof(CHOOSECOLOR);
  choosecolor.hwndOwner = parent;
  choosecolor.rgbResult = RGB(r, g, b);
  choosecolor.lpCustColors = lpCustColors;
  choosecolor.lCustData = (LPARAM)ih;

  choosecolor.Flags = CC_RGBINIT|CC_FULLOPEN;
  if (IupGetCallback(ih, "HELP_CB"))
    choosecolor.Flags |= CC_SHOWHELP;

  choosecolor.Flags |= CC_ENABLEHOOK;
  choosecolor.lpfnHook = (LPCCHOOKPROC)winColorDlgHookProc;

  if (!ChooseColor(&choosecolor))
  {
    iupAttribSet(ih, "VALUE", NULL);
    iupAttribSet(ih, "COLORTABLE", NULL);
    iupAttribSet(ih, "STATUS", NULL);
    return IUP_NOERROR;
  }

  iupAttribSetStrf(ih, "VALUE", "%d %d %d", GetRValue(choosecolor.rgbResult),
                                            GetGValue(choosecolor.rgbResult),
                                            GetBValue(choosecolor.rgbResult));
  iupAttribSet(ih, "COLORTABLE", winColorDlgColorsToString(lpCustColors));
  iupAttribSet(ih, "STATUS", "1");

  return IUP_NOERROR;
}
开发者ID:Vulcanior,项目名称:IUP,代码行数:54,代码来源:iupwin_colordlg.c


示例17: OnRButtonDblClk

LRESULT CPaletteWindow::OnRButtonDblClk(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
    if (GET_X_LPARAM(lParam) >= 31)
        if (ChooseColor(&choosecolor))
        {
            paletteModel.SetColor((GET_X_LPARAM(lParam) - 31) / 16 + (GET_Y_LPARAM(lParam) / 16) * 14,
                choosecolor.rgbResult);
            paletteModel.SetBgColor(choosecolor.rgbResult);
        }
    return 0;
}
开发者ID:AmineKhaldi,项目名称:reactos,代码行数:11,代码来源:palette.cpp


示例18: GEOptionsDlg_GeneralProc

/*
================
GEOptionsDlg_GeneralProc

Dialog procedure for the general options tab
================
*/
static INT_PTR CALLBACK GEOptionsDlg_GeneralProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch (msg) {
		case WM_INITDIALOG:
			ColorButton_SetColor(GetDlgItem(hwnd, IDC_GUIED_SELECTIONCOLOR),
			                     RGB(gApp.GetOptions().GetSelectionColor()[0]*255,
			                         gApp.GetOptions().GetSelectionColor()[1]*255,
			                         gApp.GetOptions().GetSelectionColor()[2]*255));
			CheckDlgButton(hwnd, IDC_GUIED_IGNOREDESKTOP, gApp.GetOptions().GetIgnoreDesktopSelect()?BST_CHECKED:BST_UNCHECKED);
			break;

		case WM_COMMAND:

			switch (LOWORD(wParam)) {
				case IDC_GUIED_SELECTIONCOLOR: {
					CHOOSECOLOR col;
					ZeroMemory(&col, sizeof(col));
					col.lStructSize = sizeof(col);
					col.lpCustColors = gApp.GetOptions().GetCustomColors();
					col.hwndOwner = hwnd;
					col.hInstance = NULL;
					col.Flags = CC_RGBINIT;
					col.rgbResult = ColorButton_GetColor(GetDlgItem(hwnd, IDC_GUIED_SELECTIONCOLOR));

					if (ChooseColor(&col)) {
						ColorButton_SetColor(GetDlgItem(hwnd, IDC_GUIED_SELECTIONCOLOR), col.rgbResult);
					}

					break;
				}
			}

			break;

		case WM_DRAWITEM:
			ColorButton_DrawItem(GetDlgItem(hwnd, wParam), (LPDRAWITEMSTRUCT)lParam);
			return TRUE;

		case WM_NOTIFY:

			switch (((NMHDR FAR *) lParam)->code) {
				case PSN_APPLY:
					gApp.GetOptions().SetLastOptionsPage(PropSheet_HwndToIndex(GetParent(hwnd), PropSheet_GetCurrentPageHwnd(GetParent(hwnd))));
					gApp.GetOptions().SetSelectionColor(ColorButton_GetColor(GetDlgItem(hwnd, IDC_GUIED_SELECTIONCOLOR)));
					gApp.GetOptions().SetIgnoreDesktopSelect(IsDlgButtonChecked(hwnd, IDC_GUIED_IGNOREDESKTOP) != 0);
					break;
			}

			break;
	}

	return FALSE;
}
开发者ID:AreaScout,项目名称:dante-doom3-odroid,代码行数:60,代码来源:GEOptionsDlg.cpp


示例19: switch

INT_PTR CWipeProp::OnReceiveMsg(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
    static COLORREF acrCustomClr[16];

    switch (msg)
    {
        case WM_DRAWITEM:
            // Paint the color swatch
            if (wParam == IDC_SMPTE_COLOR)
            {
                HBRUSH solidBrush = CreateSolidBrush(m_dwBorderColor);

                DRAWITEMSTRUCT *pDraw = (DRAWITEMSTRUCT*)lParam;
                FillRect(pDraw->hDC, &pDraw->rcItem, solidBrush);
                FrameRect(pDraw->hDC, &pDraw->rcItem, (HBRUSH)GetStockObject(BLACK_BRUSH));

                DeleteObject(solidBrush);

                return TRUE;
            }
            break;

        case WM_COMMAND:        
            switch (LOWORD(wParam))
            {
                case IDC_SMPTE_PICK_COLOR:
                {
                    // Show the Choose Color dialog to pick a new color swatch
                    CHOOSECOLOR cc;
        
                    ZeroMemory(&cc, sizeof(CHOOSECOLOR));
                    cc.lStructSize = sizeof(CHOOSECOLOR);
                    cc.hwndOwner = m_hDlg;
                    cc.lpCustColors = (LPDWORD)acrCustomClr;
                    cc.Flags = CC_RGBINIT;
                    cc.rgbResult = m_dwBorderColor;
        
                    if (ChooseColor(&cc))
                    {
                        m_dwBorderColor = cc.rgbResult;
                        InvalidateRect(GetDlgItem(hDlg, IDC_SMPTE_COLOR), 0, FALSE);
                    }
                }
                return TRUE;

            } // inner switch            
            break;
    }

    // default
    return FALSE;
}
开发者ID:chinajeffery,项目名称:dx_sdk,代码行数:52,代码来源:PropSetter.cpp


示例20: choose_color

BOOL choose_color(LPCHOOSECOLOR lpcs, HWND hwnd)
{
    CHOOSECOLOR dcs;
	static COLORREF custcolors[16];

    lpcs->lStructSize = sizeof(dcs);
    lpcs->hwndOwner = hwnd;
    lpcs->hInstance = 0;
    lpcs->rgbResult=config_color;
    lpcs->lpCustColors = custcolors;
    lpcs->Flags = CC_RGBINIT|CC_FULLOPEN;
    return ChooseColor(lpcs);
}
开发者ID:raveller,项目名称:raveller,代码行数:13,代码来源:Sex.c



注:本文中的ChooseColor函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ChooseFont函数代码示例发布时间:2022-05-30
下一篇:
C++ ChkErr函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap