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


C++ SetTextColor函数代码示例

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


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

示例1: MenuWndProc


//.........这里部分代码省略.........
			} break;

			case NM_CLICK: {
				LPNMLISTVIEW lpnmlv = (LPNMLISTVIEW) lParam;
				if( lpnmlv->iItem==-1 ) return 0;
				if( data->how==PICK_ANY ) {
					SelectMenuItem(
						lpnmlv->hdr.hwndFrom, 
						data, 
						lpnmlv->iItem, 
						NHMENU_IS_SELECTED(data->menu.items[lpnmlv->iItem])? 0 : -1
					);
				}
			} break;

			case LVN_ITEMCHANGED: 
			{
				LPNMLISTVIEW lpnmlv = (LPNMLISTVIEW)lParam;
				if( lpnmlv->iItem==-1 ) return 0;
				if( !(lpnmlv->uChanged & LVIF_STATE) ) return 0;

				/* update item that has the focus */
				data->menu.items[lpnmlv->iItem].has_focus = !!(lpnmlv->uNewState & LVIS_FOCUSED);
				ListView_RedrawItems(lpnmlv->hdr.hwndFrom, lpnmlv->iItem, lpnmlv->iItem);

				/* update count for single-selection menu (follow the listview selection) */
				if( data->how==PICK_ONE ) {
					if( lpnmlv->uNewState & LVIS_SELECTED ) {
						SelectMenuItem(
							lpnmlv->hdr.hwndFrom, 
							data, 
							lpnmlv->iItem, 
							-1
						);
					}
				}

				/* check item focus */
				data->menu.items[lpnmlv->iItem].has_focus = !!(lpnmlv->uNewState & LVIS_FOCUSED);
				ListView_RedrawItems(lpnmlv->hdr.hwndFrom, lpnmlv->iItem, lpnmlv->iItem);
			} break;

			case NM_KILLFOCUS:
				reset_menu_count(lpnmhdr->hwndFrom, data);
			break;

			}
		} break;
		}
	} break;

	case WM_SETFOCUS:
		if( hWnd!=GetNHApp()->hPopupWnd ) {
			SetFocus(GetNHApp()->hPopupWnd );
			return 0;
		}
	break;
	
    case WM_MEASUREITEM: 
		if( wParam==IDC_MENU_LIST )
			return onMeasureItem(hWnd, wParam, lParam);
		else
			return FALSE;

    case WM_DRAWITEM:
		if( wParam==IDC_MENU_LIST )
			return onDrawItem(hWnd, wParam, lParam);
		else
			return FALSE;

	case WM_CTLCOLORBTN:
	case WM_CTLCOLOREDIT:
	case WM_CTLCOLORSTATIC: { /* sent by edit control before it is drawn */
		HDC hdcEdit = (HDC) wParam; 
		HWND hwndEdit = (HWND) lParam;
		if( hwndEdit == GetDlgItem(hWnd, IDC_MENU_TEXT) ) {
			SetBkColor(hdcEdit, mswin_get_color(NHW_TEXT, MSWIN_COLOR_BG));
			SetTextColor(hdcEdit, mswin_get_color(NHW_TEXT, MSWIN_COLOR_FG)); 
			return (BOOL)mswin_get_brush(NHW_TEXT, MSWIN_COLOR_BG);
		}
	} return FALSE;

	case WM_DESTROY:
		if( data ) {
			DeleteObject(data->bmpChecked);
			DeleteObject(data->bmpCheckedCount);
			DeleteObject(data->bmpNotChecked);
			if( data->type == MENU_TYPE_TEXT ) {
				if( data->text.text ) {
					mswin_free_text_buffer(data->text.text);
					data->text.text = NULL;
				}
			}
			free(data);
			SetWindowLong(hWnd, GWL_USERDATA, (LONG)0);
		}
		return TRUE;
	}
	return FALSE;
}
开发者ID:yzh,项目名称:yzhack,代码行数:101,代码来源:mhmenu.c

示例2: SetImageList

BOOL MyListCtrl::init()
{
	//Create Image list. 

	m_ImageListThumb.DeleteImageList();
	m_IconWidth=2;
	m_IconHeight=27;
	m_ImageListThumb.Create(m_IconWidth, m_IconHeight, ILC_COLOR24, 0, 1);
	SetImageList(&m_ImageListThumb, LVSIL_SMALL);
	m_ShowIcons=FALSE;
	Arrange(LVSCW_AUTOSIZE);
	//LVSCW_AUTOSIZE
	FreeListItems();

	// For the resize problem...... 
	m_iNumberOfColumns=2;
	m_iColumnWidthArray[0]=60;
	m_iColumnWidthArray[1]=80;
	m_iColumnWidthArray[2]=110;
	m_iColumnWidthArray[3]=100;



	InsertColumn(0,"Client Address",LVCFMT_LEFT,m_iColumnWidthArray[0]);
	InsertColumn(1,"Status",LVCFMT_LEFT,m_iColumnWidthArray[1]);
	//InsertColumn(1,"Storlek",LVCFMT_LEFT,110);
	//InsertColumn(2,"Unik ID",LVCFMT_LEFT,110);
	// We whant a nice flat list-  	
	SetExtendedStyle(LVS_EX_GRIDLINES | LVS_EX_FLATSB |
		LVS_EX_FULLROWSELECT );


	//
	// Setting the header INFO
	//

	// Loading header images.. 
	m_HeaderImages.DeleteImageList();
	m_HeaderImages.Create(IDB_HEADER, 9*2, 1, RGB(255,255,255));

	CHeaderCtrl* pHeader=GetHeaderCtrl();
	if(pHeader)
	{

		pHeader->SetImageList(&m_HeaderImages);

		for (int i=0; i < pHeader->GetItemCount(); i++)
		{
			SetHeaderIcon(i,-1);
		}

		SetBkColor(RGB(255,255,255));
		SetTextBkColor(RGB(255,255,255));
		SetTextColor(RGB(0,0,0));
		SetHeaderIcon(0,0);
		m_iCurrentSortColumn=0;
	}

	ResizeColumns();

	return TRUE;
}
开发者ID:lijinchao2007,项目名称:selfproject,代码行数:62,代码来源:MyListCtrl.cpp

示例3: DlgProcAlarm

INT_PTR CALLBACK DlgProcAlarm(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
	WindowData *wd = (WindowData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);

	switch (msg) {
	case WM_INITDIALOG:
		TranslateDialogDefault(hwndDlg);

		Utils_RestoreWindowPositionNoSize(hwndDlg, 0, MODULENAME, "Notify");
		SetFocus(GetDlgItem(hwndDlg, IDC_SNOOZE));

		wd = new WindowData;
		wd->moving = false;
		wd->alarm = nullptr;
		wd->win_num = win_num++;

		if (wd->win_num > 0) {
			RECT r;
			GetWindowRect(hwndDlg, &r);
			r.top += 20;
			r.left += 20;

			SetWindowPos(hwndDlg, nullptr, r.left, r.top, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE);
			Utils_SaveWindowPosition(hwndDlg, 0, MODULENAME, "Notify");
		}
		SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)wd);

		// options
		SendMessage(hwndDlg, WMU_SETOPT, 0, 0);

		// fonts
		SendMessage(hwndDlg, WMU_SETFONTS, 0, 0);
		return FALSE;

	case WMU_REFRESH:
		InvalidateRect(hwndDlg, nullptr, TRUE);
		return TRUE;

	case WM_CTLCOLORSTATIC:
		{
			HDC hdc = (HDC)wParam;
			HWND hwndCtrl = (HWND)lParam;

			if (hBackgroundBrush) {
				if (hTitleFont && GetDlgItem(hwndDlg, IDC_TITLE) == hwndCtrl)
					SetTextColor(hdc, title_font_colour);
				else if (hWindowFont)
					SetTextColor(hdc, window_font_colour);

				SetBkMode(hdc, TRANSPARENT);
				return (INT_PTR)hBackgroundBrush;
			}
		}
		break;

	case WM_CTLCOLORDLG:
		if (hBackgroundBrush)
			return (INT_PTR)hBackgroundBrush;
		break;

	case WMU_SETFONTS:
		// fonts
		if (hWindowFont)
			SendMessage(hwndDlg, WM_SETFONT, (WPARAM)hWindowFont, TRUE);
		if (hTitleFont)
			SendDlgItemMessage(hwndDlg, IDC_TITLE, WM_SETFONT, (WPARAM)hTitleFont, TRUE);

		if (hBackgroundBrush) {
			SetClassLongPtr(hwndDlg, GCLP_HBRBACKGROUND, (LONG_PTR)hBackgroundBrush);
			InvalidateRect(hwndDlg, nullptr, TRUE);
		}
		return TRUE;

	case WMU_SETOPT:
		Options *opt;
		if (lParam)
			opt = (Options*)lParam;
		else
			opt = &options;

		// round corners
		if (opt->aw_roundcorners) {
			HRGN hRgn1;
			RECT r;
			int w = 10;
			GetWindowRect(hwndDlg, &r);
			int h = (r.right - r.left) > (w * 2) ? w : (r.right - r.left);
			int v = (r.bottom - r.top) > (w * 2) ? w : (r.bottom - r.top);
			h = (h < v) ? h : v;
			hRgn1 = CreateRoundRectRgn(0, 0, (r.right - r.left + 1), (r.bottom - r.top + 1), h, h);
			SetWindowRgn(hwndDlg, hRgn1, 1);
		}
		else {
			HRGN hRgn1;
			RECT r;
			int w = 10;
			GetWindowRect(hwndDlg, &r);
			int h = (r.right - r.left) > (w * 2) ? w : (r.right - r.left);
			int v = (r.bottom - r.top) > (w * 2) ? w : (r.bottom - r.top);
			h = (h < v) ? h : v;
//.........这里部分代码省略.........
开发者ID:tweimer,项目名称:miranda-ng,代码行数:101,代码来源:alarm_win.cpp

示例4: GetClientRect

	void ButtonX::drawCaption(HDC hdc, RECT updRect) {
		//if (!this->_icon) return;
		Rect textRc, clientRc;
		GetClientRect(this->_hwnd, textRc.ref());
		clientRc = textRc;
		Size imageSize = _image ? _image->getSize() : Size();
		bool enabled = IsWindowEnabled(this->_hwnd)!=0;
		int state = SendMessage(this->_hwnd, BM_GETSTATE, 0, 0);
		int style = GetWindowLong(this->_hwnd, GWL_STYLE);
		
		if (this->isFlat() && state == BST_FOCUS) {
			Rect focusRc = clientRc;
			focusRc.expand(-2, -2);
			DrawFocusRect(hdc, focusRc.ref());
		}

		if (!this->_text.empty()) {
			SetBkMode(hdc , TRANSPARENT);
			SetTextColor(hdc, enabled ? GetSysColor(COLOR_BTNTEXT) : GetSysColor(COLOR_BTNSHADOW));
			textRc.bottom = 0;
			textRc.right -=	6;
			if (this->_image)
				textRc.right -=	this->_iconMargin + imageSize.w;
			HFONT oldFont = (HFONT) SelectObject(hdc, (HGDIOBJ)SendMessage(this->_hwnd, WM_GETFONT, 0, 0));
			DrawText(hdc, this->_text, -1, textRc.ref(), DT_LEFT | DT_NOPREFIX | DT_CALCRECT | DT_WORDBREAK);
			Point pt, ptImg;
			bool imgAside = ((style & BS_VCENTER) == BS_VCENTER || (style & BS_VCENTER) == 0);
			int textStyle = 0;
			switch (style & BS_CENTER) {
				case BS_LEFT:
					pt.x = ((imgAside && this->_image.isValid()) ? (imageSize.w + this->_iconMargin) : 0) + 2;
					ptImg.x = 2;
					textStyle = DT_LEFT;
					break;
				case BS_RIGHT:
					pt.x = clientRc.width() - textRc.width() - 2;
					if (!imgAside && _image.isValid()) {
						ptImg.x = clientRc.width() - imageSize.w - 2;
					}
					textStyle = DT_RIGHT;
					break;
				default:
					pt.x = (clientRc.right - textRc.right + ((imgAside && this->_image.isValid()) ? (imageSize.w + this->_iconMargin) : 0))/2;
					if (!imgAside && _image.isValid()) 
						ptImg.x = clientRc.getCenter().x - imageSize.w / 2;
					textStyle = DT_CENTER;
					break;
			}
			if (imgAside) {
				ptImg.x = pt.x - imageSize.w - this->_iconMargin;
			}
			// BS_TOP / BOTTOM oznaczaj¹ pozycjê SAMEGO TEKSTU wzglêdem ikonki
			switch (style & BS_VCENTER) {
				case BS_TOP:
                    pt.y = (clientRc.bottom - textRc.bottom)/2 - (imageSize.h + _iconMargin) / 2;
					ptImg.y = (clientRc.bottom - imageSize.h)/2 + (textRc.bottom + _iconMargin) / 2;
					break;
				case BS_BOTTOM:
                    pt.y = (clientRc.bottom - textRc.bottom)/2 + (imageSize.h + _iconMargin) / 2;
					ptImg.y = (clientRc.bottom - imageSize.h)/2 - (textRc.bottom + _iconMargin) / 2;
					break;
				default: // w jednej linii na œrodku
					pt.y = (clientRc.bottom - textRc.bottom)/2;
					ptImg.y = (clientRc.bottom - imageSize.h)/2;
			}
			textRc.setPos(pt);
			DrawText(hdc, this->_text, -1, textRc.ref(), textStyle | DT_NOPREFIX | DT_WORDBREAK);
			SelectObject(hdc, (HGDIOBJ)oldFont);
			if (this->_image) {
				this->_image->draw(hdc, ptImg);
			}
		} else {
			if (this->_image) {
				this->_image->draw(hdc, Point((clientRc.right - imageSize.w)/2 , (clientRc.bottom - imageSize.h)/2));
			}
		}
	}
开发者ID:Konnekt,项目名称:staminalib,代码行数:77,代码来源:ButtonX.cpp

示例5: switch


//.........这里部分代码省略.........
                BOOL bKeepRecording = AppConfig->GetInt(TEXT("Publish"), TEXT("KeepRecording"));
                SendMessage(GetDlgItem(hwnd, IDC_KEEPRECORDING), BM_SETCHECK, bKeepRecording ? BST_CHECKED : BST_UNCHECKED, 0);

                BOOL bSaveToFile = AppConfig->GetInt(TEXT("Publish"), TEXT("SaveToFile"));
                SendMessage(GetDlgItem(hwnd, IDC_SAVETOFILE), BM_SETCHECK, bSaveToFile ? BST_CHECKED : BST_UNCHECKED, 0);

                CTSTR lpSavePath = AppConfig->GetStringPtr(TEXT("Publish"), TEXT("SavePath"));
                SetWindowText(GetDlgItem(hwnd, IDC_SAVEPATH), lpSavePath);

                EnableWindow(GetDlgItem(hwnd, IDC_KEEPRECORDING), bSaveToFile || (mode != 0));

                EnableWindow(GetDlgItem(hwnd, IDC_SAVEPATH), bSaveToFile || (mode != 0));
                EnableWindow(GetDlgItem(hwnd, IDC_BROWSE),   bSaveToFile || (mode != 0));

                //--------------------------------------------

                //SetWindowText(GetDlgItem(hwnd, IDC_DASHBOARDLINK), App->strDashboard);

                //--------------------------------------------

                SetWarningInfo();

                ShowWindow(GetDlgItem(hwnd, IDC_INFO), SW_HIDE);
                SetChangedSettings(false);

                return TRUE;
            }

        case WM_CTLCOLORSTATIC:
            {
                switch (GetDlgCtrlID((HWND)lParam))
                {
                    case IDC_WARNINGS:
                        SetTextColor((HDC)wParam, RGB(255, 0, 0));
                        SetBkColor((HDC)wParam, COLORREF(GetSysColor(COLOR_3DFACE)));
                        return (INT_PTR)GetSysColorBrush(COLOR_BTNFACE);
                }
            }
            break;

        case WM_DESTROY:
            {
                delete data;
                data = NULL;
            }
            break;

        case WM_NOTIFY:
            {
                NMHDR *nmHdr = (NMHDR*)lParam;

                if(nmHdr->idFrom == IDC_AUTORECONNECT_TIMEOUT)
                {
                    if(nmHdr->code == UDN_DELTAPOS)
                        SetChangedSettings(true);
                }

                break;
            }

        case WM_COMMAND:
            {
                bool bDataChanged = false;

                switch(LOWORD(wParam))
                {
开发者ID:viphak,项目名称:OBS,代码行数:67,代码来源:SettingsPublish.cpp

示例6: AboutDlgProc

static BOOL CALLBACK AboutDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	switch(message)
	{
	case WM_INITDIALOG:
		{
			HINSTANCE hInst = GetModuleHandle(NULL);
			SendMessage(hwnd, WM_SETICON, ICON_SMALL, (LPARAM)LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON1)));
			SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM)LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON1)));
		}
		break;
	case WM_CTLCOLORDLG:
		return (LONG)g_hbrBackground;
	case WM_CTLCOLORSTATIC:
		{
			HDC hdcStatic = (HDC)wParam;
			SetTextColor(hdcStatic, RGB(255,255,255));
			//if you leave this line off the background will be filled in with the brush you specify, 
			//but when the control draws the text it will get written over with the default background 
			//color! Setting the text drawing mode to transparent fixes this problem. The other option 
			//would be to SetBkColor() to the same color as our background brush, but I like this solution better.
			SetBkMode(hdcStatic, TRANSPARENT);
			return (LONG)g_hbrBackground;
		}
		break;
	case WM_COMMAND:
		{
			switch (LOWORD(wParam))
			{
			case IDC_BUTTON1: //fill random text
				//IDC_EDIT1
				SetDlgItemText(hwnd, IDC_EDIT1, L"Hello how are you?");
				break;
			case IDC_BUTTON2: // get text
				{
					int len = GetWindowTextLength(GetDlgItem(hwnd, IDC_EDIT1));
					if (len > 0)
					{
						wchar_t* buf;
						//NOTE: len+1 because GetWindowTextLength returns number of characters (not including NULL). 
						buf = (wchar_t*)GlobalAlloc(GPTR, (len+1)*sizeof(wchar_t));
						//returns number of characters (not including NULL). 
						GetDlgItemText(hwnd, IDC_EDIT1, buf, len+1);

						MessageBox(hwnd, buf, L"Notice", MB_OK);

						GlobalFree((HANDLE)buf);
					}
				}
				break;
			case IDC_BUTTON4: // get number
				{
					//last param: signed
					BOOL translated;
					int num = GetDlgItemInt(hwnd, IDC_EDIT1, &translated, TRUE);
					if (translated)
					{
						std::wostringstream wostr;
						wostr << L"the number is " << num;
						MessageBox(hwnd, wostr.str().data(), L"Notice", MB_OK);
					}
					else
					{
						MessageBox(hwnd, L"not a number", L"Notice", MB_OK);
					}
				}
				break;
			case IDC_BUTTON5:
				{
					int index = SendDlgItemMessage(hwnd, IDC_LIST1, LB_ADDSTRING, 0, (LPARAM)L"Hi there!");
				}
				break;
			case IDC_LIST1:
				{
					switch(HIWORD(wParam))
					{
					case LBN_SELCHANGE:
						//Selection changed, do stuff here
						MessageBox(hwnd, L"sel changed", L"Notice", MB_OK);
						break;
					}
				}
				break;
			case IDC_BUTTON6:
				{
					HWND hList = GetDlgItem(hwnd, IDC_LIST1);
					int index = SendMessage(hList, LB_GETCURSEL, 0,0);
					std::cout << index;
					//Note that static controls are all given a default ID of IDC_STATIC (-1) by the resource editor, 
					//so if you want to be able to tell them apart you'll need to assign them new IDs.
					SetDlgItemInt(hwnd, IDC_STATIC1, index, TRUE);
				}
				break;
			case IDOK:
				EndDialog(hwnd, IDOK);
				break;
			case IDCANCEL:
				EndDialog(hwnd, IDCANCEL);
				break;
			}
//.........这里部分代码省略.........
开发者ID:grimripper,项目名称:grim_win32_testing,代码行数:101,代码来源:test8.cpp

示例7: DrawMenu

void DrawMenu()
{
	ClearScreen();
	switch(mode) {
		case 1: { //Step Programming menu
			//Status
			SetTextColor(green);
			DrawText(6, 5, "BigTrakr! Steps: %d", steps);
			//Menu options
			SetTextColor(white);
			DrawText(15, 22, "Forward");
			DrawText(15, 37, "Back");
			DrawText(15, 52, "Right");
			DrawText(15, 67, "Left");
			DrawText(15, 82, "Fire");
			//Menu pointer
			DrawImage(markerImage,5,10+15*menuItem,white);
			//Number (lengths, degrees, lasers)
			SetTextColor(white);
			if(menuItem<3 || menuItem==5) {
				DrawText(90, 7 + 15*menuItem,"%d",menuNum);
			} else if (menuItem < 5) {
				DrawText(90, 7 + 15*menuItem,"%d",menuNum * 15);
			}
			//Number arrows prompting right stick adjustments
			SetTextColor(red);
			//DrawText(90, 13 + 15*(menuItem-1),"^");
			//DrawText(90, 2 + 15*(menuItem+1),"v");
			DrawImage(upImage, 92, 17+15*(menuItem-1), white);
			DrawImage(downImage, 92, 8 + 15*(menuItem+1), white);
			//Button identifiers
			SetTextColor(blue);
			DrawText(6, 100, "Clear");
			DrawText(100,100, "Select");
		}
		break;
		case 2: { //Additional menu
			//Status
			SetTextColor(green);
			DrawText(5, 5, "BigTrakr! Steps: %d", steps);
			//Menu options
			SetTextColor(white);
			DrawText(15, 22, "Free Roam");
			DrawText(15, 37, "Load Route");
			DrawText(15, 52, "Save Route");
			DrawText(15, 67, "Recalibrate");
			DrawText(15, 82, "About");
			//Menu pointer
			DrawImage(markerImage,5,10+15*menuItem,white);
			//Button identifiers
			SetTextColor(blue);
			DrawText(6, 100, "Back");
			DrawText(100,100, "Select");
		}
		break;
		case 3: { //Recalibration mode
			switch(menuNum) {
				case 1: { //Ready
					SetTextColor(white);
					DrawText(6, 7, "To recalibrate");
					DrawText(6, 22, "rotation, press");
					DrawText(6, 37, "Button B to start");
					DrawText(6, 52, "then press again");
					DrawText(6, 67, "to stop when the");
					DrawText(6, 82, "Trakr spins fully");
					SetTextColor(blue);
					DrawText(6, 100, "Cancel");
					DrawText(100,100, "Start");
				}
				break;
				case 2: {
					SetTextColor(white);
					DrawText(6, 22, "Started...");
					DrawText(6, 37, "Let the Trakr");
					DrawText(6, 52, "spin 360 degrees");
					DrawText(6, 67, "then press again");
					SetTextColor(blue);
					DrawText(6, 100, "Cancel");
					DrawText(100,100, "Stop");
				}
				break;
			}
		}
		break;
		case 4: { //Free roam
			SetTextColor(white);
			DrawText(5, 5, "Free Roam");
			SetTextColor(blue);
			if (IRState)
				DrawText(6, 100, "Light off");
			else
				DrawText(6, 100, "Light on");

			DrawText(100,100, "Close");
		}
		break;
		case 5: { //About
			Splash();
			SetTextColor(blue);
			if (IRState)
//.........这里部分代码省略.........
开发者ID:RorschachUK,项目名称:Trakr,代码行数:101,代码来源:app.c

示例8: Run


//.........这里部分代码省略.........
					steps++;
					moveList[steps].cmd=menuItem;
					moveList[steps].num=menuNum;
					PlaySound(SOUND_BEEP);
				}
			}
			if(keystate & KEY_MENU) {
				//Switch to second menu
				mode=2;
				menuItem=1;
				menuNum=1;
				PlaySound(SOUND_BEEP);
			}
		} else if (mode == 2) {
			if(keystate & KEY_INPUT1) {
				//Switch back to first menu
				mode=1;
				menuItem=1;
				menuNum=1;
				PlaySound(SOUND_BEEP);
			}
			if (keystate & KEY_INPUT2) {
				//Menu select
				switch(menuItem) {
					case 1: { //Free Roam
						mode=4;
						PlaySound(SOUND_BEEP);
						CloseMotors();
					} break;
					case 2: { //Load route
						LoadRoute();
						ClearScreen();
						PlaySound(SOUND_BEEP);
						SetTextColor(white);
						DrawText(5, 65, "Loading...");
						Show();
						Sleep(500); //Just so they notice...
						mode=2;
					} break;
					case 3: { //Save route
						PlaySound(SOUND_BEEP);
						SaveRoute();
						ClearScreen();
						SetTextColor(white);
						DrawText(5, 65, "Saving...");
						Show();
						Sleep(500); //Just so they notice...
						mode=2;
					} break;
					case 4: { //Recalibrate
						PlaySound(SOUND_BEEP);
						mode=3;		//Recalibration mode
						menuNum=1;	//Use menuNum as steps throught the process - 1=ready, 2=working
					} break;
					case 5: { //About
						PlaySound(SOUND_GO);
						mode=5;
						CloseMotors();
					} break;
				}
			}

			if(keystate & KEY_MENU) {
				//Switch back to first menu
				mode=1;
				menuItem=1;
开发者ID:RorschachUK,项目名称:Trakr,代码行数:67,代码来源:app.c

示例9: drawGDIGlyphs

static void drawGDIGlyphs(GraphicsContext* graphicsContext, const SimpleFontData* font, const GlyphBuffer& glyphBuffer, 
                      int from, int numGlyphs, const FloatPoint& point)
{
    Color fillColor = graphicsContext->fillColor();

    bool drawIntoBitmap = false;
    int drawingMode = graphicsContext->textDrawingMode();
    if (drawingMode == cTextFill) {
        if (!fillColor.alpha())
            return;

        drawIntoBitmap = fillColor.alpha() != 255 || graphicsContext->inTransparencyLayer();
        if (!drawIntoBitmap) {
            IntSize size;
            int blur;
            Color color;
            graphicsContext->getShadow(size, blur, color);
            drawIntoBitmap = !size.isEmpty() || blur;
        }
    }

    // We have to convert CG's two-dimensional floating point advances to just horizontal integer advances.
    Vector<int, 2048> gdiAdvances;
    int totalWidth = 0;
    for (int i = 0; i < numGlyphs; i++) {
        gdiAdvances.append(lroundf(glyphBuffer.advanceAt(from + i)));
        totalWidth += gdiAdvances[i];
    }

    HDC hdc = 0;
    OwnPtr<GraphicsContext::WindowsBitmap> bitmap;
    IntRect textRect;
    if (!drawIntoBitmap)
        hdc = graphicsContext->getWindowsContext(textRect, true, false);
    if (!hdc) {
        drawIntoBitmap = true;
        // We put slop into this rect, since glyphs can overflow the ascent/descent bounds and the left/right edges.
        // FIXME: Can get glyphs' optical bounds (even from CG) to get this right.
        int lineGap = font->lineGap();
        textRect = IntRect(point.x() - (font->ascent() + font->descent()) / 2, point.y() - font->ascent() - lineGap, totalWidth + font->ascent() + font->descent(), font->lineSpacing());
        bitmap.set(graphicsContext->createWindowsBitmap(textRect.size()));
        memset(bitmap->buffer(), 255, bitmap->bufferLength());
        hdc = bitmap->hdc();

        XFORM xform;
        xform.eM11 = 1.0f;
        xform.eM12 = 0.0f;
        xform.eM21 = 0.0f;
        xform.eM22 = 1.0f;
        xform.eDx = -textRect.x();
        xform.eDy = -textRect.y();
        SetWorldTransform(hdc, &xform);
    }

    SelectObject(hdc, font->m_font.hfont());

    // Set the correct color.
    if (drawIntoBitmap)
        SetTextColor(hdc, RGB(0, 0, 0));
    else
        SetTextColor(hdc, RGB(fillColor.red(), fillColor.green(), fillColor.blue()));

    SetBkMode(hdc, TRANSPARENT);
    SetTextAlign(hdc, TA_LEFT | TA_BASELINE);

    // Uniscribe gives us offsets to help refine the positioning of combining glyphs.
    FloatSize translation = glyphBuffer.offsetAt(from);
    if (translation.width() || translation.height()) {
        XFORM xform;
        xform.eM11 = 1.0;
        xform.eM12 = 0;
        xform.eM21 = 0;
        xform.eM22 = 1.0;
        xform.eDx = translation.width();
        xform.eDy = translation.height();
        ModifyWorldTransform(hdc, &xform, MWT_LEFTMULTIPLY);
    }

    if (drawingMode == cTextFill) {
        XFORM xform;
        xform.eM11 = 1.0;
        xform.eM12 = 0;
        xform.eM21 = font->platformData().syntheticOblique() ? -tanf(syntheticObliqueAngle * piFloat / 180.0f) : 0;
        xform.eM22 = 1.0;
        xform.eDx = point.x();
        xform.eDy = point.y();
        ModifyWorldTransform(hdc, &xform, MWT_LEFTMULTIPLY);
        ExtTextOut(hdc, 0, 0, ETO_GLYPH_INDEX, 0, reinterpret_cast<const WCHAR*>(glyphBuffer.glyphs(from)), numGlyphs, gdiAdvances.data());
        if (font->m_syntheticBoldOffset) {
            xform.eM21 = 0;
            xform.eDx = font->m_syntheticBoldOffset;
            xform.eDy = 0;
            ModifyWorldTransform(hdc, &xform, MWT_LEFTMULTIPLY);
            ExtTextOut(hdc, 0, 0, ETO_GLYPH_INDEX, 0, reinterpret_cast<const WCHAR*>(glyphBuffer.glyphs(from)), numGlyphs, gdiAdvances.data());
        }
    } else {
        RetainPtr<CGMutablePathRef> path(AdoptCF, CGPathCreateMutable());

        XFORM xform;
        GetWorldTransform(hdc, &xform);
//.........这里部分代码省略.........
开发者ID:arjunroy,项目名称:cinder_webkit,代码行数:101,代码来源:FontCGWin.cpp

示例10: map_text


//.........这里部分代码省略.........

      {
	CGPoint oldPos = CGContextGetTextPosition(mgc->quartz_gc);
	CGContextSetTextDrawingMode(mgc->quartz_gc, kCGTextInvisible);
	CGContextShowText(mgc->quartz_gc, text, strlen(text));
	CGPoint newPos = CGContextGetTextPosition(mgc->quartz_gc);
	CGContextSetTextDrawingMode(mgc->quartz_gc, kCGTextFill);
	CGContextSetTextPosition(mgc->quartz_gc, oldPos.x, oldPos.y);
	width = newPos.x - oldPos.x;
      }

      if ((style & 0x300) == 0x100)
	{
	  xpos -= width;
	}
      else if ((style & 0x300) == 0x200)
	{
	  xpos -= width / 2;
	}
      else if ((style & 0x300) == 0x300)
	{
	  xpos -= width / 2;
	  ypos -= height / 2;
	}

      if (style & 0x400)
	map_bkg_rectangle(mgc, settings,
			  xpos, ypos, width, height);

      if (style & 1)
	CGContextSetRGBStrokeColor(mgc->quartz_gc, 0, 0, 1, 1);
      else
	CGContextSetRGBStrokeColor(mgc->quartz_gc, 0, 0, 0, 1);

      CGContextSetTextPosition(mgc->quartz_gc, xpos, ypos);
      CGContextShowText(mgc->quartz_gc, text, strlen(text));
    }
#endif
#ifdef WIN32
  else if (mgc->win_dc)
    {
      int xpos = x;
      int ypos = y;
      int fontSize;
      HFONT oldFont;
      HFONT font;
      SIZE textSize;

      if (style & 0x800)
	{
	  if (settings->pdamode)
	    fontSize = 9;
	  else
	    fontSize = 14;
	}
      else
	{
	  if (settings->pdamode)
	    fontSize = 8;
	  else
	    fontSize = 11;
	}

      fontSize = fontSize * 3 / 2;

      font = CreateFont(fontSize, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "MSSansSerif");
      oldFont = SelectObject(mgc->win_dc, font);

      GetTextExtentPoint32(mgc->win_dc, text, strlen(text), &textSize);

      if ((style & 0x300) == 0x100)
	{
	  xpos -= textSize.cx;
	}
      else if ((style & 0x300) == 0x200)
	{
	  xpos -= textSize.cx / 2;
	}
      else if ((style & 0x300) == 0x300)
	{
	  xpos -= textSize.cx / 2;
	  ypos -= textSize.cy / 2;
	}

      if (style & 0x400)
	map_bkg_rectangle(mgc, settings,
			  xpos, ypos, textSize.cx, textSize.cy);

      if (style & 1)
	SetTextColor(mgc->win_dc, RGB(0x00, 0x00, 0xff));
      else
	SetTextColor(mgc->win_dc, RGB(0x00, 0x00, 0x00));

      SetBkMode(mgc->win_dc, TRANSPARENT);
      TextOut(mgc->win_dc, xpos, ypos, text, strlen(text));
      SelectObject(mgc->win_dc, oldFont);
      DeleteObject(font);
    }
#endif
}
开发者ID:Jalakas,项目名称:gpsdrive,代码行数:101,代码来源:map_port.c

示例11: MonSelPaint

static VOID
MonSelPaint(IN OUT PMONITORSELWND infoPtr,
            IN HDC hDC,
            IN const RECT *prcUpdate)
{
    COLORREF crPrevText;
    HBRUSH hbBk, hbOldBk;
    HPEN hpFg, hpOldFg;
    DWORD Index;
    RECT rc, rctmp;
    INT iPrevBkMode;
    BOOL bHideNumber;

    bHideNumber = (infoPtr->ControlExStyle & MSLM_EX_HIDENUMBERS) ||
        ((infoPtr->MonitorsCount == 1) && (infoPtr->ControlExStyle & MSLM_EX_HIDENUMBERONSINGLE));

    hbBk = GetSysColorBrush(COLOR_BACKGROUND);
    hpFg = CreatePen(PS_SOLID,
                     0,
                     GetSysColor(COLOR_HIGHLIGHTTEXT));

    hbOldBk = SelectObject(hDC,
                           hbBk);
    hpOldFg = SelectObject(hDC,
                           hpFg);
    iPrevBkMode = SetBkMode(hDC,
                            TRANSPARENT);
    crPrevText = SetTextColor(hDC,
                              GetSysColor(COLOR_HIGHLIGHTTEXT));

    for (Index = 0; Index < infoPtr->MonitorsCount; Index++)
    {
        if (infoPtr->IsDraggingMonitor &&
            (DWORD)infoPtr->DraggingMonitor == Index)
        {
            continue;
        }

        MonSelRectToScreen(infoPtr,
                           &infoPtr->Monitors[Index].rc,
                           &rc);

        if (IntersectRect(&rctmp,
                          &rc,
                          prcUpdate))
        {
            MonSelPaintMonitor(infoPtr,
                               hDC,
                               Index,
                               &rc,
                               crPrevText,
                               bHideNumber);
        }
    }

    /* Paint the dragging monitor last */
    if (infoPtr->IsDraggingMonitor &&
        infoPtr->DraggingMonitor >= 0)
    {
        MonSelRectToScreen(infoPtr,
                           &infoPtr->rcDragging,
                           &rc);

        if (IntersectRect(&rctmp,
                          &rc,
                          prcUpdate))
        {
            MonSelPaintMonitor(infoPtr,
                               hDC,
                               (DWORD)infoPtr->DraggingMonitor,
                               &rc,
                               crPrevText,
                               bHideNumber);
        }
    }

    SetTextColor(hDC,
                 crPrevText);
    SetBkMode(hDC,
              iPrevBkMode);
    SelectObject(hDC,
                 hpOldFg);
    SelectObject(hDC,
                 hbOldBk);

    DeleteObject(hpFg);
}
开发者ID:GYGit,项目名称:reactos,代码行数:87,代码来源:monslctl.c

示例12: MonSelPaintMonitor

static VOID
MonSelPaintMonitor(IN OUT PMONITORSELWND infoPtr,
                   IN HDC hDC,
                   IN DWORD Index,
                   IN OUT PRECT prc,
                   IN COLORREF crDefFontColor,
                   IN BOOL bHideNumber)
{
    HFONT hFont, hPrevFont;
    COLORREF crPrevText;

    if ((INT)Index == infoPtr->SelectedMonitor)
    {
        FillRect(hDC,
                 prc,
                 (HBRUSH)(COLOR_HIGHLIGHT + 1));

        if (infoPtr->HasFocus && !(infoPtr->UIState & UISF_HIDEFOCUS))
        {
            /* NOTE: We need to switch the text color to the default, because
                     DrawFocusRect draws a solid line if the text is white! */

            crPrevText = SetTextColor(hDC,
                                      crDefFontColor);

            DrawFocusRect(hDC,
                          prc);

            SetTextColor(hDC,
                         crPrevText);
        }
    }

    InflateRect(prc,
                -infoPtr->SelectionFrame.cx,
                -infoPtr->SelectionFrame.cy);

    Rectangle(hDC,
              prc->left,
              prc->top,
              prc->right,
              prc->bottom);

    InflateRect(prc,
                -1,
                -1);

    if (!bHideNumber)
    {
        hFont = MonSelGetMonitorFont(infoPtr,
                                     hDC,
                                     Index);
        if (hFont != NULL)
        {
            hPrevFont = SelectObject(hDC,
                                     hFont);

            DrawText(hDC,
                     infoPtr->Monitors[Index].szCaption,
                     -1,
                     prc,
                     DT_VCENTER | DT_CENTER | DT_NOPREFIX | DT_SINGLELINE);

            SelectObject(hDC,
                         hPrevFont);
        }
    }

    if (infoPtr->MonitorInfo[Index].Flags & MSL_MIF_DISABLED)
    {
        InflateRect(prc,
                    1,
                    1);

        MonSelDrawDisabledRect(infoPtr,
                               hDC,
                               prc);
    }
}
开发者ID:GYGit,项目名称:reactos,代码行数:79,代码来源:monslctl.c

示例13: onDrawItem

LRESULT onDrawItem(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
    LPDRAWITEMSTRUCT lpdis; 
	PNHMenuItem item;
	PNHMenuWindow data;
    TEXTMETRIC tm;
	HGDIOBJ saveFont;
	HDC tileDC;
	short ntile;
	int t_x, t_y;
	int x, y;
	TCHAR wbuf[BUFSZ];
	RECT drawRect;
	COLORREF OldBg, OldFg, NewBg;
	char *p, *p1;
	int column;

	lpdis = (LPDRAWITEMSTRUCT) lParam; 

    /* If there are no list box items, skip this message. */
    if (lpdis->itemID == -1) return FALSE;

	data = (PNHMenuWindow)GetWindowLong(hWnd, GWL_USERDATA);

    item = &data->menu.items[lpdis->itemID];

	tileDC = CreateCompatibleDC(lpdis->hDC);
	saveFont = SelectObject(lpdis->hDC, mswin_get_font(NHW_MENU, item->attr, lpdis->hDC, FALSE));
	NewBg = mswin_get_color(NHW_MENU, MSWIN_COLOR_BG);
	OldBg = SetBkColor(lpdis->hDC, NewBg);
	OldFg = SetTextColor(lpdis->hDC, mswin_get_color(NHW_MENU, MSWIN_COLOR_FG)); 

    GetTextMetrics(lpdis->hDC, &tm);

	x = lpdis->rcItem.left + 1;

	/* print check mark if it is a "selectable" menu */
	if( data->how!=PICK_NONE ) {
		if( NHMENU_IS_SELECTABLE(*item) ) {
			HGDIOBJ saveBrush;
			HBRUSH	hbrCheckMark;
			char buf[2];

			switch(item->count) {
			case -1: hbrCheckMark = CreatePatternBrush(data->bmpChecked); break;
			case 0: hbrCheckMark = CreatePatternBrush(data->bmpNotChecked); break;
			default: hbrCheckMark = CreatePatternBrush(data->bmpCheckedCount); break;
			}

			y = (lpdis->rcItem.bottom + lpdis->rcItem.top - TILE_Y) / 2; 
			SetBrushOrgEx(lpdis->hDC, x, y, NULL);
			saveBrush = SelectObject(lpdis->hDC, hbrCheckMark);
			PatBlt(lpdis->hDC, x, y, TILE_X, TILE_Y, PATCOPY);
			SelectObject(lpdis->hDC, saveBrush);
			DeleteObject(hbrCheckMark);

			x += TILE_X + 5;

			if(item->accelerator!=0) {
				buf[0] = item->accelerator;
				buf[1] = '\x0';

				SetRect( &drawRect, x, lpdis->rcItem.top, lpdis->rcItem.right, lpdis->rcItem.bottom );
/*JP
				DrawText(lpdis->hDC, NH_A2W(buf, wbuf, 2), 1, &drawRect, DT_LEFT | DT_VCENTER | DT_SINGLELINE | DT_NOPREFIX);
*/
				DrawText(lpdis->hDC, NH_A2W(buf, wbuf, 2), -1, &drawRect, DT_LEFT | DT_VCENTER | DT_SINGLELINE | DT_NOPREFIX);
			}
			x += tm.tmAveCharWidth + tm.tmOverhang + 5;
		} else {
			x += TILE_X + tm.tmAveCharWidth + tm.tmOverhang + 10;
		}
	}

	/* print glyph if present */
	if( item->glyph != NO_GLYPH ) {
		HGDIOBJ saveBmp;

		saveBmp = SelectObject(tileDC, GetNHApp()->bmpTiles);				
		ntile = glyph2tile[ item->glyph ];
		t_x = (ntile % TILES_PER_LINE)*TILE_X;
		t_y = (ntile / TILES_PER_LINE)*TILE_Y;

		y = (lpdis->rcItem.bottom + lpdis->rcItem.top - TILE_Y) / 2; 

		nhapply_image_transparent(
			lpdis->hDC, x, y, TILE_X, TILE_Y, 
			tileDC, t_x, t_y, TILE_X, TILE_Y, TILE_BK_COLOR );
		SelectObject(tileDC, saveBmp);
	}

	x += TILE_X + 5;

	/* draw item text */
	if( item->has_tab ) {
		p1 = item->str;
		p = strchr(item->str, '\t');
		column = 0;
		SetRect( &drawRect, x, lpdis->rcItem.top, min(x + data->menu.tab_stop_size[0], lpdis->rcItem.right),
			lpdis->rcItem.bottom );
//.........这里部分代码省略.........
开发者ID:yzh,项目名称:yzhack,代码行数:101,代码来源:mhmenu.c

示例14: TextWndProc

LRESULT CALLBACK TextWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	HWND control;
	HDC hdc;
	PNHTextWindow data;
	
	data = (PNHTextWindow)GetWindowLong(hWnd, GWL_USERDATA);
	switch (message) 
	{
	case WM_INITDIALOG:
	    /* set text control font */
		control = GetDlgItem(hWnd, IDC_TEXT_CONTROL);
		if( !control ) {
			panic("cannot get text view window");
		}

		hdc = GetDC(control);
		SendMessage(control, WM_SETFONT, (WPARAM)mswin_get_font(NHW_TEXT, ATR_NONE, hdc, FALSE), 0);
		ReleaseDC(control, hdc);

#if defined(WIN_CE_SMARTPHONE)
		/* special initialization for SmartPhone dialogs */ 
		NHSPhoneDialogSetup(hWnd, FALSE, GetNHApp()->bFullScreen);
#endif
		/* subclass edit control */
		editControlWndProc = (WNDPROC)GetWindowLong(control, GWL_WNDPROC);
		SetWindowLong(control, GWL_WNDPROC, (LONG)NHTextControlWndProc);

		if( !program_state.gameover && GetNHApp()->bWrapText ) {
			DWORD styles;
			styles = GetWindowLong(control, GWL_STYLE);
			if( styles ) {
				SetWindowLong(control, GWL_STYLE, styles & (~WS_HSCROLL));
				SetWindowPos(control, NULL, 0, 0, 0, 0, 
							  SWP_FRAMECHANGED | SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE );
			}
		}

		SetFocus(control);
	return FALSE;

	case WM_MSNH_COMMAND:
		onMSNHCommand(hWnd, wParam, lParam);
	break;

	case WM_SIZE:
		LayoutText(hWnd);
	return FALSE;

	case WM_COMMAND:
		switch (LOWORD(wParam)) 
        { 
          case IDOK: 
		  case IDCANCEL:
			data->done = 1;
			return TRUE;
		}
	break;

	case WM_CTLCOLORBTN:
	case WM_CTLCOLOREDIT:
	case WM_CTLCOLORSTATIC: { /* sent by edit control before it is drawn */
		HDC hdcEdit = (HDC) wParam; 
		HWND hwndEdit = (HWND) lParam;
		if( hwndEdit == GetDlgItem(hWnd, IDC_TEXT_CONTROL) ) {
			SetBkColor(hdcEdit, mswin_get_color(NHW_TEXT, MSWIN_COLOR_BG));
			SetTextColor(hdcEdit, mswin_get_color(NHW_TEXT, MSWIN_COLOR_FG)); 
			return (BOOL)mswin_get_brush(NHW_TEXT, MSWIN_COLOR_BG);
		}
	} return FALSE;

	case WM_DESTROY:
		if( data ) {
			mswin_free_text_buffer(data->window_text);
			free(data);
			SetWindowLong(hWnd, GWL_USERDATA, (LONG)0);
		}
	break;

	}
	return FALSE;
}
开发者ID:Agyar,项目名称:NetHack,代码行数:82,代码来源:mhtext.c

示例15: thread_proc


//.........这里部分代码省略.........
					/*InvalidateRect(hWnd, NULL, TRUE);*/

					/* show the window and set the timers for animation and overall visibility */
					ShowWindow(hWnd, SW_SHOWNOACTIVATE);

					SetTimer(notification_window, TIMER_ANIMATION, fade_duration, NULL);
					SetTimer(notification_window, TIMER_NOTIFICATION, notify_duration, NULL);
				}
			}
		}
		break;
	case WM_LIBNOTIFYCLOSE:
		/* clean up and reset flags */
		{
			if(hook_mouse_over)
			{
				UnhookWindowsHookEx(hook_mouse_over);
				hook_mouse_over = NULL;
			}

			KillTimer(hWnd, TIMER_ANIMATION);
			KillTimer(hWnd, TIMER_NOTIFICATION);
			is_fading_out = FALSE;

			ShowWindow(hWnd, SW_HIDE);
		}
		break;
	case WM_PAINT:
		if(notification_data && notification_data->summary && 
			notification_data->body && notification_data->icon)
		{
			hdc = BeginPaint(hWnd, &ps);

			SetTextColor(hdc, RGB(255, 255, 255));
			SetBkMode(hdc, TRANSPARENT);

			hOldFont = (HFONT) SelectObject(hdc, font_summary);

			if(hOldFont)
			{
				/* set the padding as left offset and center the icon horizontally */
				DrawIcon(hdc, icon_padding, (notification_window_height / 2) - (icon_size / 2), notification_data->icon);

				/* calculate and DrawText for both summary and body based on the geometry given above */
				rc.left = icon_size + (icon_padding * 2);
				rc.right = notification_window_width - icon_padding;
				rc.top = icon_padding;
				rc.bottom = summary_body_divider + (icon_padding * 2);

				DrawText(hdc, notification_data->summary, -1, &rc, DT_SINGLELINE | DT_VCENTER | DT_END_ELLIPSIS | DT_NOPREFIX);

				if(SelectObject(hdc, font_body))
				{
					rc.top = rc.bottom;
					rc.bottom = notification_window_height - icon_padding;

					DrawText(hdc, notification_data->body, -1, &rc, DT_WORDBREAK | DT_EDITCONTROL | DT_NOCLIP | DT_NOPREFIX | DT_EXTERNALLEADING);
				}

				SelectObject(hdc, hOldFont);
			}

			EndPaint(hWnd, &ps);
		}
		break;
	case WM_DESTROY:
开发者ID:esotericnomen,项目名称:artha,代码行数:67,代码来源:libnotify.c


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