当前位置: 首页>>代码示例>>C++>>正文


C++ ChooseColor函数代码示例

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


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


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