您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ DrawRect函数代码示例

51自学网 2021-06-01 20:30:09
  C++
这篇教程C++ DrawRect函数代码示例写得很实用,希望能帮到您。

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

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

示例1: DrawRect

void CDDrawRecord::ClearScreen(DWORD color){	DrawRect(color, NULL, lpDDSBack);}
开发者ID:mildrock,项目名称:Media,代码行数:4,


示例2: drawRect

 Drawing drawRect( const QPen & pen, const QBrush & brush, const QRectF & rect ) {     return DrawRect( pen, brush, rect ); }
开发者ID:camio,项目名称:sani,代码行数:4,


示例3: DrawRect

void AeroControlBase::DrawFocusRect(LPRECT prcFocus, HDC hdcPaint){    DrawRect(prcFocus, hdcPaint, DashStyleDot, Color(0xFF, 0,0,0), 1.0);}
开发者ID:yuexiaoyun,项目名称:tortoisesvn,代码行数:4,


示例4: EraseRect

void RingDragger::Drag(int xMouse,int yMouse){	EraseRect(xMouse,yMouse);	DrawRect(m_width);}
开发者ID:tianjigezhu,项目名称:UI-Library,代码行数:5,


示例5: White

void FormView::Paint(Draw& w){	if (!IsLayout())	{		w.DrawRect(GetRect(), White());		return;	}	Rect r = Zoom(GetPageRect());	DrawGrid(w);	DrawRect(w, r, 1, LtBlue());	w.DrawRect(0, 0, r.left, 3000, White());	w.DrawRect(r.right + 1, 0, 3000, 3000, White());	w.DrawRect(r.left, 0, 5000, r.top, White());	w.DrawRect(r.left, r.bottom + 1, 3000, 3000, White());//	if (_showInfo)//	{//		r.SetSize( Zoom(Size(804, 604)) );//		DrawRect(w, r.Offseted( Zoom(Size(-2, -2)) ), 1, LtMagenta());//		r = Zoom(GetPageRect());//	}	if (GetObjectCount() > 0 && _showInfo == 2)	{		Rect b = Zoom(GetObjectsRect()).Offseted(1, 1);		b.SetSize( b.GetSize() + Size(-2, -2) );		DrawRect(w, b, 1, Yellow());	}	Vector<int> sel = GetSelected();	bool coloring = GetBool("View.Coloring");	int ci = 0;	if (sel.GetCount() > 0)	{		if (sel.GetCount() == 1)		{			for (int i = 0; i < GetObjectCount(); ++i)			{				if (ci++ == _colors.GetCount() - 1) ci = 0;				if (coloring && i != sel[0])					DrawObject(w, i, _colors[ci], false);				else					DrawObject(w, i, (!coloring && (i == sel[0])) ? _colors[ci] : LtGray(),						i == sel[0]);			}		}		else		{			for (int i = 0; i < GetObjectCount(); ++i)			{				if (ci++ == _colors.GetCount() - 1) ci = 0;				bool found = false;				for (int j = 0; j < sel.GetCount(); ++j)					if ( i == sel[j])					{						found = true;						break;					}				if (coloring && !found)					DrawObject(w, i, _colors[ci], false);				else					DrawObject(w, i, (!coloring && found) ? _colors[ci] : LtGray(), false);			}			Size g = GetGridSize();			Rect s = GetSelectionRect().Offseted(-g.cx / 2, -g.cy / 2);			s.SetSize(s.GetSize() + Size(g.cx, g.cy));			Vector<int> sel = GetSelected();			bool a1 = true;	// allow horz align			bool a2 = true;	// allow vert align			dword f1;		// first horz align			dword f2;		// first vert align				for (int i = 0; i < sel.GetCount(); ++i)			{				FormObject *pI = GetObject(sel[i]);				if (!pI) continue;				if (i == 0) { f1 = pI->GetHAlign(); f2 = pI->GetVAlign(); }				if (f1 != pI->GetHAlign()) { a1 = false; }				if (f2 != pI->GetVAlign()) { a2 = false; }			}			DrawSprings(w, Zoom(s), f1, f2, a1, a2, a1, a2, false);			DrawRect(w, Zoom(s), 1, LtRed());			s = GetSelectionRect().Offseted(-g.cx, -g.cy);			s.SetSize(s.GetSize() + Size(g.cx * 2, g.cy * 2));			DrawGroupTools(w, Zoom(s));		}//.........这里部分代码省略.........
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:101,


示例6: temp

//---------------------------------------------------------------------------void    TRForm::HandleSelRect(int   X ,int  Y){    TPoint  temp(X ,Y);    temp -= leftDownPt;    switch(Image1->Cursor)    {    case TCursor(crSizeAll_): // crSizeAll    {        DrawRect(originPt, movePt, pmNotXor);        //DrawRect(Point(selectedRt.left,selectedRt.top) ,        //         Point(selectedRt.right,selectedRt.bottom) , pmNotXor);        // 重新构造originPt movePt,左上角,右下角        originPt = TPoint(selectedRt.left,selectedRt.top);        originPt += temp;        movePt = TPoint(selectedRt.right,selectedRt.bottom);        movePt += temp;        DrawRect(originPt, movePt, pmNotXor);        break;    }    case TCursor(crSizeNWSE_): //crSizeNWSE    {        if(selectdPos==epLeftUp)        {            //ShowMessage("selectdPos==epLeftUp");            DrawRect(originPt, movePt, pmNotXor);            originPt = TPoint(selectedRt.right,selectedRt.bottom);            movePt = TPoint(selectedRt.left,selectedRt.top);            movePt += temp;            DrawRect(originPt, movePt, pmNotXor);        }        else        {            DrawRect(originPt, movePt, pmNotXor);            originPt = TPoint(selectedRt.left,selectedRt.top);            movePt = TPoint(selectedRt.right,selectedRt.bottom);            movePt += temp;            DrawRect(originPt, movePt, pmNotXor);        }        break;    }    case TCursor(crSizeNESW_): // crSizeNESW    {        if(selectdPos==epLeftDown)        {            //ShowMessage("selectdPos==epLeftUp");            DrawRect(originPt, movePt, pmNotXor);            originPt = TPoint(selectedRt.right,selectedRt.top);            movePt = TPoint(selectedRt.left,selectedRt.bottom);            movePt += temp;            DrawRect(originPt, movePt, pmNotXor);        }        else        {            DrawRect(originPt, movePt, pmNotXor);            originPt = TPoint(selectedRt.left,selectedRt.bottom);            movePt = TPoint(selectedRt.right,selectedRt.top);            movePt += temp;            DrawRect(originPt, movePt, pmNotXor);        }        break;    }    case crCross:    {        /*------ */        break;    }    case TCursor(crCursor_):        break;    default :        break;    }}
开发者ID:huangjunkun,项目名称:code_joy_with_cpp_builder_6,代码行数:73,


示例7: lineStart

void MyApp::DrawSingleMode(){	FvRobotClientAppPtr spApp = FvRobotMainApp::Instance().GetRobotInSingleMode();	int lineStart(LINE_START);	int lineStep(LINE_STEP);	//! 显示地图信息	DrawString(0, lineStart, CLR_WHITE, "-------Single Mode-------");	lineStart += lineStep;	DrawString(0, lineStart, CLR_WHITE, "ShowHelpInfo: H");	lineStart += lineStep;	if(!spApp)	{		DrawString(0, lineStart, CLR_WHITE, "Err: No Selected Robot");		lineStart += lineStep;		return;	}	if(1)	{		DrawString(0, lineStart, CLR_WHITE, "ServerTime:%.1f", spApp->GetServerConnection()->ServerTime());		lineStart += lineStep;		DrawString(0, lineStart, CLR_WHITE, "ServerToDScaling:%.2f,ServerToD:%.2f", spApp->GetToDScaling(), spApp->GetToD());		lineStart += lineStep;		DrawString(0, lineStart, CLR_WHITE, "SpaceID:%d, Type:%d, RobotID:%d", spApp->SpaceID(), spApp->SpaceType(), spApp->RobotID());		lineStart += lineStep;		//! 显示Space		const FvRobotMainApp::SpaceInfo* pkSpaceInfo = FvRobotMainApp::Instance().FindSpaceInfo(spApp->SpaceType());		if(!pkSpaceInfo)		{			DrawString(0, lineStart, CLR_WHITE, "Err:No Space Info");			lineStart += lineStep;			return;		}		else		{			if(m_bResetWindow4Space)			{				m_bResetWindow4Space = false;				SetWindowFit2Rect(pkSpaceInfo->kSpaceRect);			}			for(int i=0; i<(int)pkSpaceInfo->kCells.size(); ++i)			{				DrawRect(pkSpaceInfo->kCells[i], CLR_YELLOW);			}			DrawRect(pkSpaceInfo->kSpaceRect, CLR_YELLOW);		}		//! 显示实体		if(1)		{			const FvRobotClientApp::EntityMap& kEntityMap = spApp->GetEntityMap();			//! 显示实体数量			DrawString(0, lineStart, CLR_WHITE, "Entities:%d", kEntityMap.size());			lineStart += lineStep;			FvRobotClientApp::EntityMap::const_iterator itrB = kEntityMap.begin();			FvRobotClientApp::EntityMap::const_iterator itrE = kEntityMap.end();			while(itrB != itrE)			{				FvEntity* pkEntity = itrB->second;				p2Clr clr;				const FvVector3& p3 = pkEntity->GetPos();				FvVector2 p2(p3.x, p3.y);				int x,y;				char charID[32] = {0};				char robotID[32] = {0};				char charPos[64] = {0};				bool bConvertPos(false);				if(m_bShowEntityID)				{					bConvertPos = true;					sprintf(charID, "%d", pkEntity->GetEntityID());				}				if(m_bShowRobotID)				{					bConvertPos = true;					sprintf(robotID, "%d", pkEntity->GetRobotID());				}				if(m_bShowEntityPos)				{					bConvertPos = true;					sprintf(charPos, "%.2f,%.2f,%.2f", p3.x, p3.y, p3.z);				}				if(bConvertPos)				{					ConvertWorldToScreen(p2, x, y);				}				if(pkEntity->IsCtrler())//! ctrler				{					clr = CLR_RED;					DrawPoint(p3, clr);					if(m_bShowEntityID)					{						DrawString(x, y, clr, charID);					}//.........这里部分代码省略.........
开发者ID:Kiddinglife,项目名称:geco-game-engine,代码行数:101,


示例8: FillRect

void TextInput::Draw( Rect area ){   FillRect( Bounds(), 0x888888 );   DrawRect( Bounds(), 0x999999 );   DrawString( 2,2, m_text, 0 );}
开发者ID:AdamRLukaitis,项目名称:spoon,代码行数:6,


示例9: Update

void Car::Draw(){	Update();	if (yDraw < (float)(y - 1) || yDraw >(float)(y + 1))	{		yDraw += ((float)y - yDraw) / 10.0f;	}	int yInt = (int)yDraw;	if (mode == 'n' && y <= -200)	{		DrawRect(x, y, 122, 135, color.r, color.g, color.b);		if (btnBubble->ClickedOnThisFrame() && gPause)		{			mode = 'w';			chargeCurrent = 0.0;			timeDue = gTime + addTime;			active = false;		}		btnBubble->Draw();	}	else	{		active = true;		//sprite->Draw(x, yInt);		DrawRect(x, yInt, 122, 192, color.r, color.g, color.b);		text->Draw(x + 5, yInt + 10, "Chrg:     " + std::to_string(((int)chargeCurrent)) + "%");		text->Draw(x + 5, yInt + 25, "ChrgRate: " + std::to_string((int)(chargeRate*gFramesToSeconds)) + "ps");		text->Draw(x + 5, yInt + 50, "TimeWait: " + SecondsToTime(waitTime));		if (timeDue + GetChargeTime() >= gTime) text->Draw(x + 5, yInt + 80, "TimeToCh: " + ToTime(GetChargeTime()), 0, 150, 0);		else									text->Draw(x + 5, yInt + 80, "TimeToCh: " + ToTime(GetChargeTime()), 150, 0, 0);		if (timeDue >= gTime)	text->Draw(x + 5, yInt + 95, "TimeDue:  " + SecondsToTime(timeDue), 0, 225, 0);		else					text->Draw(x + 5, yInt + 95, "TimeDue:  " + SecondsToTime(timeDue), 225, 0, 0);		//text->Draw(x + 20, yInt + 30, "Max: " + std::to_string((int)(chargeMax)) + "kWh");		//text->Draw(x + 20, yInt + 110, "Use: " + std::to_string((int)(chargeUse*100.0f)) + "pf");		std::string bar = "";		for (unsigned i = 0; i < (int)chargeCurrent; i += 10)		{			bar += "|";		}		text->Draw(x + 24, yInt + 140, bar, 0, 200, 0);		if (gPause)		{			btnReturn->y = yInt + 160;			btnReturn->Draw();		}		if (btnReturn->ClickedOnThisFrame() && gPause)		{			Reset();		}		if (gPause)		{			btnL1->y = yInt + 75;			btnR1->y = yInt + 75;			btnL2->y = yInt + 92;			btnR2->y = yInt + 92;			if (btnL1->Clicked())			{				if (GetChargeTime() > 0.01)				{					chargeRate += 0.0005;				}			}			if (btnR1->Clicked())			{				if (chargeRate > 0.005)				{					chargeRate -= 0.0005;					if (timeDue < gTime + GetMaxChargeTime() + 1)					{						addTime = GetMaxChargeTime() + 1;						timeDue = gTime + addTime;					}				}			}			if (btnR2->Clicked())			{				addTime += 0.1;				timeDue = gTime + addTime;			}//.........这里部分代码省略.........
开发者ID:Milun,项目名称:Swag-Cars,代码行数:101,


示例10: DrawRect

NS_IMETHODIMPnsThebesRenderingContext::DrawRect(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight){    DrawRect(nsRect(aX, aY, aWidth, aHeight));    return NS_OK;}
开发者ID:MozillaOnline,项目名称:gecko-dev,代码行数:6,


示例11: DrawRect

void Renderer::DrawRect(const Vector2D& lefttop, const Vector2D& rightbottom, float lineWidth) { 	DrawRect(Rect2D(lefttop, rightbottom), lineWidth); }
开发者ID:SimpleManGames,项目名称:DirectEngine,代码行数:4,


示例12: WatchJoystick

//.........这里部分代码省略.........                break;            case SDL_JOYBALLMOTION:                printf("Joystick %d ball %d delta: (%d,%d)/n",                       event.jball.which,                       event.jball.ball, event.jball.xrel, event.jball.yrel);                break;            case SDL_JOYBUTTONDOWN:                printf("Joystick %d button %d down/n",                       event.jbutton.which, event.jbutton.button);                break;            case SDL_JOYBUTTONUP:                printf("Joystick %d button %d up/n",                       event.jbutton.which, event.jbutton.button);                break;            case SDL_KEYDOWN:                if ((event.key.keysym.sym != SDLK_ESCAPE) &&                    (event.key.keysym.sym != SDLK_AC_BACK)) {                    break;                }                /* Fall through to signal quit */            case SDL_FINGERDOWN:            case SDL_MOUSEBUTTONDOWN:            case SDL_QUIT:                done = SDL_TRUE;                break;            default:                break;            }        }        /* Update visual joystick state */        SDL_SetRenderDrawColor(screen, 0x00, 0xFF, 0x00, SDL_ALPHA_OPAQUE);        for (i = 0; i < SDL_JoystickNumButtons(joystick); ++i) {            if (SDL_JoystickGetButton(joystick, i) == SDL_PRESSED) {                DrawRect(screen, (i%20) * 34, SCREEN_HEIGHT - 68 + (i/20) * 34, 32, 32);            }        }        SDL_SetRenderDrawColor(screen, 0xFF, 0x00, 0x00, SDL_ALPHA_OPAQUE);        for (i = 0; i < SDL_JoystickNumAxes(joystick); ++i) {            /* Draw the X/Y axis */            int x, y;            x = (((int) SDL_JoystickGetAxis(joystick, i)) + 32768);            x *= SCREEN_WIDTH;            x /= 65535;            if (x < 0) {                x = 0;            } else if (x > (SCREEN_WIDTH - 16)) {                x = SCREEN_WIDTH - 16;            }            ++i;            if (i < SDL_JoystickNumAxes(joystick)) {                y = (((int) SDL_JoystickGetAxis(joystick, i)) + 32768);            } else {                y = 32768;            }            y *= SCREEN_HEIGHT;            y /= 65535;            if (y < 0) {                y = 0;            } else if (y > (SCREEN_HEIGHT - 16)) {                y = SCREEN_HEIGHT - 16;            }            DrawRect(screen, x, y, 16, 16);        }
开发者ID:Chenhx,项目名称:moai-dev,代码行数:66,


示例13: CheckBox_Paint

//----CheckBox绘制函数----------------------------------------------------------//功能:这是CheckBox控件的MSG_PAINT消息响应函数//参数:pMsg,消息指针//返回:固定true//-----------------------------------------------------------------------------static  bool_t CheckBox_Paint(struct WindowMsg *pMsg){    HWND hwnd;    HDC hdc;    RECT rc;    RECT rc0;    hwnd=pMsg->hwnd;    hdc =BeginPaint(hwnd);    if(NULL!=hdc)    {        GetClientRect(hwnd,&rc0);        SetTextColor(hdc,RGB(1,1,1));        SetDrawColor(hdc,RGB(40,40,40));        SetFillColor(hdc,RGB(200,200,200));        FillRect(hdc,&rc0);        if(hwnd->Style&CBS_SELECTED)        {            CopyRect(&rc,&rc0);            rc.right =rc.left+RectH(&rc0);            InflateRect(&rc,-2,-2);            SetDrawColor(hdc,RGB(70,70,70));            DrawRect(hdc,&rc);            InflateRect(&rc,-1,-1);            SetDrawColor(hdc,RGB(110,110,110));            DrawRect(hdc,&rc);            InflateRect(&rc,-1,-1);            SetFillColor(hdc,RGB(240,240,240));            FillRect(hdc,&rc);            InflateRect(&rc,-4,-4);            SetDrawColor(hdc,RGB(150,150,240));            DrawRect(hdc,&rc);            InflateRect(&rc,-1,-1);            SetDrawColor(hdc,RGB(100,100,220));            DrawRect(hdc,&rc);            InflateRect(&rc,-1,-1);            SetFillColor(hdc,RGB(50,50,200));            FillRect(hdc,&rc);        }        else        {            CopyRect(&rc,&rc0);            rc.right =rc.left+RectH(&rc0);            InflateRect(&rc,-2,-2);            SetDrawColor(hdc,RGB(100,100,100));            DrawRect(hdc,&rc);            InflateRect(&rc,-1,-1);            SetDrawColor(hdc,RGB(160,160,160));            DrawRect(hdc,&rc);            InflateRect(&rc,-1,-1);            SetFillColor(hdc,RGB(220,220,220));            FillRect(hdc,&rc);        }        CopyRect(&rc,&rc0);        InflateRectEx(&rc,-RectH(&rc),0,0,0);        DrawText(hdc,hwnd->Text,-1,&rc,DT_LEFT|DT_VCENTER);        EndPaint(hwnd,hdc);    }    return true;}
开发者ID:djyos,项目名称:djyos,代码行数:81,


示例14: switch

void enemyS::Draw(int tex_id, int tex_id_bala, int estat){	float xo = 0.0f, yo = 0.0f, xf = 0.0f, yf = 0.0f;	char psentit = 'X';	if (estat == 0) {		switch (GetState())		{			//1		case STATE_LOOKLEFT:	xo = 0.0f;	yo = 0.0f;			psentit = 'L';			break;			//4		case STATE_LOOKRIGHT:	xo = 0.0f;	yo = 0.0f;			psentit = 'R';			break;			//1..3			//11 sprites en dues files 1/11=0.0909		case STATE_WALKLEFT:	xo = 0.093f + (GetFrame()*0.0909f);			if (xo > 0.92f) yo = 0.5f;			psentit = 'L';			NextFrame(22);			break;			//4..6		case STATE_WALKRIGHT:	xo = 0.093f + (GetFrame()*0.0909f);			if (xo > 0.92f) yo = 0.5f;			psentit = 'R';			NextFrame(22);			break;		}		xf = xo + 0.0909f;		yf = yo + 0.5f;		if (psentit == 'L') {			DrawRect(tex_id, xo, yo, xf, yf, psentit, false);			for (int i = 0; i < 100; ++i) {				if (i <= aaa) {					DrawRectBullet(psentit, tex_id_bala, i);				}			}			if (aaa < 99) {				if (GetFrame() == 1) bL = true;				if (bL && GetFrame() != 1) {					aaa = aaa + 1;					bL = false;				}			}			else aaa = 0;		}		else {			DrawRect(tex_id, xo, yo, xf, yf, psentit, false);			for (int i = 0; i < 100; ++i) {				if (i <= bbb) {					DrawRectBullet(psentit, tex_id_bala, i);				}			}			if (bbb < 99) {				if (GetFrame() == 1) bR = true;				if (bR && GetFrame() != 1) {					bbb = bbb + 1;					bR = false;				}			}			else bbb = 0;		}	}	else if (estat == 1) {	//mort		if (GetFrame() == 5) {			xo = 0.833333f;			xf = 1.0f;			yo = 0.0f;			yf = 1.0f;			switch (GetState())			{			case STATE_LOOKLEFT:				psentit = 'L';				break;			case STATE_LOOKRIGHT:				psentit = 'R';				break;			case STATE_WALKLEFT:				psentit = 'L';				break;			case STATE_WALKRIGHT:				psentit = 'R';				break;			}		}		else {			switch (GetState())			{			case STATE_LOOKLEFT:	xo = 0.0f;	yo = 0.0f;				psentit = 'L';				break;			case STATE_LOOKRIGHT:	xo = 0.0f;	yo = 0.0f;				psentit = 'R';				break;				//1/6=0.16667			case STATE_WALKLEFT:	xo = 0.16667f + (GetFrame()*0.16667f);//.........这里部分代码省略.........
开发者ID:darioo57,项目名称:joc2D,代码行数:101,


示例15: ATLASSERT

//------------------------------------------------------    BOOL CRectTracker::TrackHandle( HWND hWnd, const LPPOINT point, int HitTest ){	ATLASSERT(point);    if ((HitTest != hitBegin) && (HitTest != hitEnd) && (HitTest != hitMiddle))        return FALSE;    if (!IsValidPos())        return FALSE;    // set mouse cursor parameters    RECT CursorRect;    if (IsRectEmpty(&ValidRect))    {        GetClientRect(hWnd, &CursorRect);    }    else    {        // valid rectangle is not empty        if (HitTest == hitMiddle)        {            RECT BeginRect = ValidRect;			OffsetRect(&BeginRect, point->x, point->y);			OffsetRect(&BeginRect,  -CurPos.Begin.x, -CurPos.Begin.y);            NormalizeRect(&BeginRect);            RECT EndRect = ValidRect;			OffsetRect(&EndRect, point->x, point->y);			OffsetRect(&EndRect,  -CurPos.End.x, -CurPos.End.y);            NormalizeRect(&EndRect);            CursorRect = ValidRect;            IntersectRect(&CursorRect, &CursorRect, &BeginRect);            IntersectRect(&CursorRect, &CursorRect, &EndRect);        }        else            CursorRect = ValidRect;    };    if (IsRectEmpty(&CursorRect))        return FALSE;    ClientToScreen(hWnd, (LPPOINT)&CursorRect );    ClientToScreen(hWnd, ((LPPOINT)&CursorRect)+1 );    ClipCursor(&CursorRect);    SetCapture(hWnd);	// get DC for drawing	HDC dc = GetDC(hWnd);    // set dc parameters    HPEN LinePen = CreatePen( PS_SOLID, LineWidth, CLR_WHITE );    HPEN hOldPen = (HPEN)SelectObject(dc, LinePen);    SetROP2(dc, R2_XORPEN );    KLinePos OriginalPos = CurPos;    BOOL bCanceled = FALSE;    // draw the rectangle for the first time	DrawRect(dc, &CurPos.Begin, &CurPos.End);	// get messages until capture lost or cancelled/accepted    BOOL bExit = FALSE;    KLinePos NewPos;	while (!bExit)	{		MSG msg;		BOOL b = ::GetMessage(&msg, NULL, 0, 0);		ATLASSERT(b);		if (GetCapture() != hWnd)			break; // exit loop		switch (msg.message)		{		    // handle movement/accept messages		    case WM_LBUTTONUP:		    case WM_MOUSEMOVE:                {			        NewPos = CurPos;                    POINT MousePoint = { (int)(short)LOWORD(msg.lParam), (int)(short)HIWORD(msg.lParam) };                    switch (HitTest)                    {                        case hitBegin:                            NewPos.Begin = MousePoint;                            break;                        case hitEnd:                            NewPos.End = MousePoint;                            break;                        case hitMiddle:                             NewPos.Begin.x = OriginalPos.Begin.x + (MousePoint.x-point->x);                             NewPos.Begin.y = OriginalPos.Begin.y + (MousePoint.y-point->y);                             NewPos.End.x = OriginalPos.End.x + (MousePoint.x-point->x);//.........这里部分代码省略.........
开发者ID:Mariale13,项目名称:UDS_Protocol,代码行数:101,


示例16: DrawRect

void NXSurface::DrawPixel(int x, int y, uint8_t r, uint8_t g, uint8_t b){	DrawRect(x, y, x, y, r, g, b);}
开发者ID:millvis,项目名称:nxengine-libretro,代码行数:4,


示例17: RENDER_Frame

ULONG RENDER_Frame(piClass *cl,piObject *o,Msg msg){	UWORD x,y,w,h;	struct Node_Frame *nf;	struct Node_Window *nw;	BOOL fill=FALSE;	piGetAttr(o,OBJ_Node,(ULONG *)&nf);	piGetAttr(nf->nf_Window,OBJ_Node,(ULONG *)&nw);	x=piCX(o);	y=piCY(o);	w=piCW(o);	h=piCH(o);	SetAPen(nw->nw_Window->RPort,DrawInfo->dri_Pens[BACKGROUNDPEN]);	SetDrMd(nw->nw_Window->RPort,JAM1);	RectFill(nw->nw_Window->RPort,x,y,x+w,y+h);	switch(nf->nf_FrameType)	{		case FTYPE_BUTTON:			DrawBevelBox(nw->nw_Window->RPort,x,y,w+1,h+1,				GTBB_FrameType, BBFT_BUTTON,				(nf->nf_Flags&MYFR_Recessed) ? GTBB_Recessed : TAG_IGNORE, TRUE,				GT_VisualInfo,VisualInfo,				TAG_DONE);			break;		case FTYPE_ICONDROPBOX:			DrawBevelBox(nw->nw_Window->RPort,x,y,w+1,h+1,				GTBB_FrameType, BBFT_ICONDROPBOX,				(nf->nf_Flags&MYFR_Recessed) ? GTBB_Recessed : TAG_IGNORE, TRUE,				GT_VisualInfo,VisualInfo,				TAG_DONE);			break;		case FTYPE_RIDGE:			DrawBevelBox(nw->nw_Window->RPort,x,y,w+1,h+1,				GTBB_FrameType, BBFT_RIDGE,				(nf->nf_Flags&MYFR_Recessed) ? GTBB_Recessed : TAG_IGNORE, TRUE,				GT_VisualInfo,VisualInfo,				TAG_DONE);			break;		case FTYPE_HORIZONTALLINE:			DrawBevelBox(nw->nw_Window->RPort,x,y,w+1,2,				GTBB_FrameType, BBFT_BUTTON,				(nf->nf_Flags&MYFR_Recessed) ? GTBB_Recessed : TAG_IGNORE, TRUE,				GT_VisualInfo,VisualInfo,				TAG_DONE);			nf->nf_Height=2;			break;		case FTYPE_VERTICALLINE:			DrawBevelBox(nw->nw_Window->RPort,x,y,2,h+1,				GTBB_FrameType, BBFT_BUTTON,				(nf->nf_Flags&MYFR_Recessed) ? GTBB_Recessed : TAG_IGNORE, TRUE,				GT_VisualInfo,VisualInfo,				TAG_DONE);			nf->nf_Width=2;			break;	}	if(nf->nf_Selected && GUI.gui_Mode==MODE_FRAME)	{		SetAPen(nw->nw_Window->RPort,1);		SetDrMd(nw->nw_Window->RPort,COMPLEMENT);		DrawRect(nw->nw_Window->RPort,x,y,fill);		DrawRect(nw->nw_Window->RPort,x+w-5,y,fill);		DrawRect(nw->nw_Window->RPort,x+w-5,y+h-5,fill);		DrawRect(nw->nw_Window->RPort,x,y+h-5,fill);		DrawRect(nw->nw_Window->RPort,x+(w/2)-2,y,fill);		DrawRect(nw->nw_Window->RPort,x+(w/2)-2,y+h-5,fill);		DrawRect(nw->nw_Window->RPort,x,y+(h/2)-2,fill);		DrawRect(nw->nw_Window->RPort,x+w-5,y+(h/2)-2,fill);/*		RectFill(nw->nw_Window->RPort,x,        y,        x+6,      y+3);		RectFill(nw->nw_Window->RPort,x+w-6,    y,        x+w,      y+3);		RectFill(nw->nw_Window->RPort,x+w-6,    y+h-3,    x+w,      y+h);		RectFill(nw->nw_Window->RPort,x,        y+h-3,    x+6,      y+h);		RectFill(nw->nw_Window->RPort,x+(w/2)-3,y,        x+(w/2)+3,y+3);		RectFill(nw->nw_Window->RPort,x+(w/2)-3,y+h-3,    x+(w/2)+3,y+h);		RectFill(nw->nw_Window->RPort,x,        y+(h/2)-2,x+6,      y+(h/2)+2);		RectFill(nw->nw_Window->RPort,x+w-6,    y+(h/2)-2,x+w,      y+(h/2)+2);*/	}	return TRUE;}
开发者ID:thom-ek,项目名称:GadToolsBox,代码行数:85,


示例18: DrawRect

void Wall::draw() {  DrawRect(x, y, w, h, (color){0.0f, 0.5f, 1.0f, 1.0f}, noTex);}
开发者ID:dmitriy-lodyanov,项目名称:zeptolab-test,代码行数:3,


示例19: GetObject

void FormView::DrawObject(Draw& w, int id, const Color& c, bool springs){	if (!IsLayout())		return;	FormObject *pI = GetObject(id);	if (!pI) return;	Rect offseted = Offseted(pI->GetRect());	offseted = Zoom(offseted);	if (_showInfo == 2)			w.DrawRect(offseted, c);	String type = pI->Get("Type");	if (type == "Label")		DrawRect(w, offseted.Offseted(-1, 0), 1, LtGray());	if (pI->IsSelected() && springs)	{		DrawSprings(w, offseted, pI->GetHAlign(), pI->GetVAlign());		w.DrawImage(offseted.right, offseted.bottom, FormViewImg::SizerBR());		DrawRect(w, offseted, 1, LtRed());	}	else if (pI->IsSelected() && !springs)		DrawRect(w, Point(offseted.left, offseted.top),			Size(offseted.Width(), offseted.Height()), 1, LtRed());	else if (_showInfo == 2 || pI->GetBool("OutlineDraw"))		DrawRect(w, offseted, 1, Black());	if (pI->GetBool("OutlineDraw"))	{		Rect l = offseted.Offseted( ZoomX(3), ZoomY(3) );		l = Rect( l.TopLeft(), l.GetSize() - Size(ZoomX(6), ZoomY(6)) );		DrawRect(w, l, 1, LtCyan());	}	String temp = pI->Get("Variable");	Size t = GetTextSize( temp, _Font );	int cx = t.cx;	int y = offseted.BottomCenter().y - t.cy - ZoomY(3);	if (_showInfo > 0)	{		if (offseted.Width() > t.cx + 15)		{			int x1 = ZoomX(pI->GetRect().right) - DeZoomX(2) - 4 - t.cx + ZoomX(X(0));			w.DrawRect( x1 - 2, y, t.cx + 3, t.cy, White());//			DrawRect(w, Point(x1 - 2, y), Size(t.cx + 3, t.cy), 1, LtGray());			w.DrawText( x1, y, temp, _Font, LtBlue);		}		temp = AsString(id) + " " + type;		t = GetTextSize(temp, _Font);		Size s = GetTextSize(AsString(id), _Font);		if (offseted.Width() - cx > t.cx + 10)		{			w.DrawRect( offseted.left + ZoomX(5) - 2, y, t.cx + 3, t.cy, White());//			DrawRect(w, Point(offseted.left + ZoomX(5) - 2, y), Size(t.cx + 3, t.cy),//				1, LtGray());			w.DrawText( offseted.left + ZoomX(5), y, temp, _Font, Gray());		}		else if (offseted.Width() > s.cx + 5)		{			w.DrawRect( offseted.left + ZoomX(5) - 2, y, s.cx + 3, s.cy, White());//			DrawRect(w, Point(offseted.left + ZoomX(5) - 2, y), Size(s.cx + 3, s.cy),//				1, LtGray());			w.DrawText( offseted.left + ZoomX(5), y, AsString(id), _Font, Gray());		}	}}
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:73,


示例20: DrawSimpleBorder

 // override base class border drawing routines: we always draw just a // single simple border void DrawSimpleBorder(wxDC& dc, wxRect *rect)     { DrawRect(dc, rect, m_penFg); }
开发者ID:czxxjtu,项目名称:wxPython-1,代码行数:4,


示例21: DrawRect

	MapilVoid D3DCanvas2D::Draw( const Rectangle2D& rect )	{		DrawRect( rect.m_X1, rect.m_Y1, rect.m_X2, rect.m_Y2, rect.m_Col, rect.m_Width, rect.m_IsFilled );	}
开发者ID:nutti,项目名称:MAPIL,代码行数:4,


示例22: DrawRect

void wxStdRenderer::DrawExtraBorder(wxDC& dc, wxRect *rect){    DrawRect(dc, rect, m_penLightGrey);}
开发者ID:czxxjtu,项目名称:wxPython-1,代码行数:4,


示例23: switch

//.........这里部分代码省略.........                                argb = 0xFF000000;                                break;                            case SS_GRAYRECT:                                argb = 0xFF808080;                                break;                            case SS_WHITERECT:                                argb = 0xFFFFFFFF;                                break;                            default:                                ASSERT(0);                                break;                            }                            Color clr(argb);                            FillRect(&rcClient, hdcPaint, clr);                        }                        else if(SS_BLACKFRAME==dwStaticStyle || SS_GRAYFRAME==dwStaticStyle || SS_WHITEFRAME==dwStaticStyle)                        {                            ARGB argb = 0L;                            switch (dwStaticStyle)                            {                            case SS_BLACKFRAME:                                argb = 0xFF000000;                                break;                            case SS_GRAYFRAME:                                argb = 0xFF808080;                                break;                            case SS_WHITEFRAME:                                argb = 0xFFFFFFFF;                                break;                            }                            Color clr(argb);                            DrawRect(&rcClient, hdcPaint, DashStyleSolid, clr, 1.0);                        }                        else                        {                            DTTOPTS DttOpts = {sizeof(DTTOPTS)};                            DttOpts.dwFlags = DTT_COMPOSITED | DTT_GLOWSIZE;                            DttOpts.crText   = RGB(255, 255, 255);                            DttOpts.iGlowSize = 12; // Default value                            VERIFY(DetermineGlowSize(&DttOpts.iGlowSize));                            HFONT hFontOld = (HFONT)SendMessage(hWnd, WM_GETFONT, 0L, NULL);                            if(hFontOld)                                hFontOld = (HFONT) SelectObject(hdcPaint, hFontOld);                            int iLen = GetWindowTextLength(hWnd);                            if(iLen)                            {                                iLen+=5; // 1 for terminating zero, 4 for DT_MODIFYSTRING                                LPWSTR szText = (LPWSTR)LocalAlloc(LPTR, sizeof(WCHAR)*iLen);                                if(szText)                                {                                    iLen = GetWindowTextW(hWnd, szText, iLen);                                    if(iLen)                                    {                                        DWORD dwFlags = DT_WORDBREAK;                                        switch (dwStaticStyle)                                        {                                        case SS_CENTER:                                            dwFlags |= DT_CENTER;                                            break;                                        case SS_RIGHT:
开发者ID:yuexiaoyun,项目名称:tortoisesvn,代码行数:67,


示例24: glColor4f

void AppStateLobby::Draw() {	if (!lobbyIsReady)		return;    Rect<double> viewport = Camera::getInstance()->Get_Viewport();    ////////////////////////////////////////////////////////////////////////////    // Draw players table    TextureManager *textureManager = TextureManager::GetInstance();    glColor4f(1, 1, 1, 1);    textureManager->background_game2->DrawAtRect(0, 0, 1024, 1024);    std::stringstream stream;    stream << directedLobbyName;    DrawText(10, 10, stream.str().c_str(), textureManager->fonts.font_Impact_20, &WHITE);    int drawx = viewport.w - 300;    int drawy = 70;    DrawText(drawx, drawy - 22, "Team Red", textureManager->fonts.font_Impact_20, &WHITE);    // Draw all team 0 players; not the fastest way, but we don't need speed.    int offset = 0;    for (int i = 0; i < MaximumClients; i++)    {        if (clients[i] == NULL || clients[i]->team_id == BLUE_TEAM)            continue;        // Add other things like exp lvl?        stream.str(std::string());        stream << clients[i]->player_name;        DrawText(drawx, drawy + offset * 18, stream.str().c_str(), textureManager->fonts.font_FreeMono_16, &WHITE);        offset++;    }    drawy += offset * 18 + 80;    DrawText(drawx, drawy - 22, "Team Blue", textureManager->fonts.font_Impact_20, &WHITE);    // Draw all team 1 players    offset = 0;    for (int i = 0; i < MaximumClients; i++)    {        if (clients[i] == NULL || clients[i]->team_id == RED_TEAM)            continue;        // Add other things like exp lvl?        stream.str(std::string());        stream << clients[i]->player_name;        DrawText(drawx, drawy + offset * 18, stream.str().c_str(), textureManager->fonts.font_FreeMono_16, &WHITE);        offset++;    }    ////////////////////////////////////////////////////////////////////////////    ////////////////////////////////////////////////////////////////////////////    // Draw Map    DrawRect(10, 40, 480, 440, true, &BLACK);    map->DrawLobbyPreview(10, 40, 480, 440);    DrawRect(10, 40, 480, 440, false, &WHITE);    stream.str(std::string());    stream << "Map name (seed): MAP" << map->SEED;    DrawText(10, 440, stream.str().c_str(), textureManager->fonts.font_FreeMono_20, &WHITE);    stream.str(std::string());    stream << "Min players per team: " << map->min_players_per_team;    DrawText(10, 464, stream.str().c_str(), textureManager->fonts.font_FreeMono_16, &WHITE);    stream.str(std::string());    stream << "Max players per team: " << map->max_players_per_team;    DrawText(10, 482, stream.str().c_str(), textureManager->fonts.font_FreeMono_16, &WHITE);    ////////////////////////////////////////////////////////////////////////////    stateText.Draw(viewport.w / 2 - stateText.width / 2, viewport.h - stateText.height - 10);}
开发者ID:sgluebbert,项目名称:CISS465NetworkGame,代码行数:75,


示例25: PointContrast

void CEditPrevWnd::OnMouseMove(UINT nFlags, CPoint point) {	if(!m_bCropPress)	{		if(m_bMoveEnabled)		{			m_ptChanged = point - m_ptMoveStart;			m_ptMoveStart = point;			if(!m_bMoveFore)			{				if(m_ptChanged != CPoint(0,0))					PointContrast();			}			else	//move fore image			{				CSize sz(0,0);				sz = CSize((LONG)(m_ptChanged.x/m_dScaling), (LONG)(m_ptChanged.y/m_dScaling));				if(sz != CSize(0,0))				{					(((CPhotoEditDlg*)m_pParentWnd)->GetCurObject())->MoveForeImage(sz);					((CPhotoEditDlg*)m_pParentWnd)->SetCurImageModified(true);					CDC* pDC = GetDC();					DrawFore(pDC);					ReleaseDC(pDC);				}			}		}		else		{			::SetCursor(::AfxGetApp()->LoadCursor(IDC_CURSOR_HAND_ON));		}	}	else	{		if(((CPhotoEditDlg*)m_pParentWnd)->GetEditType() == EDIT_RESIZE)		{		if(!m_rtImageRect.PtInRect(point))			return;		::SetCursor(::AfxGetApp()->LoadStandardCursor(IDC_CROSS));		{						if((nFlags & MK_LBUTTON) == MK_LBUTTON)//&&(m_rtImageRect.PtInRect(m_OldPoint)))			{				if(m_bAfterCrop)				{					Invalidate();					m_bAfterCrop = FALSE;				}							CDC * pDC = GetDC();				CRect rtOld;				if(m_OldPoint.x < m_rtImageRect.left)					 m_OldPoint.x = m_rtImageRect.left;				if (m_OldPoint.x > m_rtImageRect.right)					 m_OldPoint.x = m_rtImageRect.right;				if(m_OldPoint.y < m_rtImageRect.top)					 m_OldPoint.y = m_rtImageRect.top;				if (m_OldPoint.y > m_rtImageRect.bottom)					 m_OldPoint.y = m_rtImageRect.bottom;				int x1 = m_OldPoint.x;				int y1 = m_OldPoint.y;				int x2 = m_PrePoint.x;				int y2 = m_PrePoint.y;				rtOld.left = min(x1,x2);				rtOld.top = min(y1,y2);				rtOld.right = max(x1,x2);				rtOld.bottom = max(y1,y2);				DrawRect(pDC,rtOld);				if(point.x < m_rtImageRect.left)					 point.x = m_rtImageRect.left;				if (point.x > m_rtImageRect.right)					 point.x = m_rtImageRect.right;				if(point.y < m_rtImageRect.top)					 point.y = m_rtImageRect.top;				if (point.y > m_rtImageRect.bottom)					 point.y = m_rtImageRect.bottom;				m_PrePoint = point;				CRect rtNew;				x1 = m_OldPoint.x;				y1 = m_OldPoint.y;				x2 = point.x;				y2 = point.y;				rtNew.left = min(x1,x2);				rtNew.top = min(y1,y2);				rtNew.right = max(x1,x2);				rtNew.bottom = max(y1,y2);				m_rtPreRect = rtNew;				DrawRect(pDC,m_rtPreRect);							m_bRectExist = TRUE;				//Draw(pDC);				ReleaseDC(pDC);			}			}		}	}	CWnd::OnMouseMove(nFlags, point);}
开发者ID:sxcong,项目名称:fytPhoto,代码行数:99,


示例26: GetWndRect

void CDDrawRecord::ClearScreen(int iWnd, DWORD color){	RECT dst;	GetWndRect(iWnd, dst);	DrawRect(color, &dst, lpDDSBack);}
开发者ID:mildrock,项目名称:Media,代码行数:6,



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


C++ DrawRectangle函数代码示例
C++ DrawNow函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。