Windows画太极函数(已封装)

Windows画太极


void Taiji(HDC hdc,int xLeft,int yTop,int xRight,int yBottom){
	
	HBRUSH hBrush;
	HBRUSH hOldBrush;
	HPEN hPen;

	hBrush = CreateSolidBrush(RGB(255, 255, 255));   
	hOldBrush = (HBRUSH)SelectObject(hdc,hBrush);  
	Chord(hdc,xLeft,yTop,xRight,yBottom,(xRight+xLeft)/2,yBottom,(xRight+xLeft)/2,yTop);     
	SelectObject(hdc, hOldBrush);
	DeleteObject(hBrush);//画右边半圆(白色)

	hBrush = CreateSolidBrush(RGB(0, 0, 0));   
	hOldBrush = (HBRUSH)SelectObject(hdc,hBrush);
	Chord(hdc,xLeft,yTop,xRight,yBottom,(xRight+xLeft)/2,yTop,(xRight+xLeft)/2,yBottom);    
	SelectObject(hdc, hOldBrush);
	DeleteObject(hBrush);//画左边半圆(黑色)

	hBrush = CreateSolidBrush(RGB(0, 0, 0));   
	hOldBrush = (HBRUSH)SelectObject(hdc,hBrush);   
	Ellipse(hdc,(xRight+xLeft)/2-(xRight-xLeft)/4,yTop,(xRight+xLeft)/2+(xRight-xLeft)/4,(yBottom+yTop)/2);       
	SelectObject(hdc, hOldBrush);
	DeleteObject(hBrush);//画太极图阴块大头

	hPen = CreatePen(PS_SOLID, 1, RGB(255,255,255));
	SelectObject(hdc, hPen);
	hBrush = CreateSolidBrush(RGB(255, 255, 255));   
	hOldBrush = (HBRUSH)SelectObject(hdc,hBrush);
	Chord(hdc,(xRight+xLeft)/2-(xRight-xLeft)/4,(yBottom+yTop)/2,(xRight+xLeft)/2+(xRight-xLeft)/4,yBottom,(xRight+xLeft)/2,(yBottom+yTop)/2,(xRight+xLeft)/2,yBottom);    
	SelectObject(hdc, hOldBrush);
	DeleteObject(hBrush);//画太极图阳块大头

	hPen = CreatePen(PS_SOLID, 1, RGB(0,0,0));
	SelectObject(hdc, hPen);
	Arc(hdc,(xRight+xLeft)/2-(xRight-xLeft)/4,(yBottom+yTop)/2,(xRight+xLeft)/2+(xRight-xLeft)/4,yBottom,(xRight+xLeft)/2,(yBottom+yTop)/2,(xRight+xLeft)/2,yBottom);//描边
		
	hBrush = CreateSolidBrush(RGB(0, 0, 0));   
	hOldBrush = (HBRUSH)SelectObject(hdc,hBrush);   
	Ellipse(hdc,(xRight+xLeft)/2-(xRight-xLeft)*3/40,(yBottom+yTop)/2+(xRight-xLeft)*7/40,(xRight+xLeft)/2+(xRight-xLeft)*3/40,(yBottom+yTop)/2+(xRight-xLeft)*7/40+(xRight-xLeft)*3/20);       
	SelectObject(hdc, hOldBrush);
	DeleteObject(hBrush);//阴小点

	hBrush = CreateSolidBrush(RGB(255, 255, 255));   
	hOldBrush = (HBRUSH)SelectObject(hdc,hBrush);   
	Ellipse(hdc,(xRight+xLeft)/2-(xRight-xLeft)*3/40,yTop+(xRight-xLeft)*7/40,(xRight+xLeft)/2+(xRight-xLeft)*3/40,yTop+(xRight-xLeft)*7/40+(xRight-xLeft)*3/20);       
	SelectObject(hdc, hOldBrush);
	DeleteObject(hBrush);//阳小点
}

上图
Windows画太极函数(已封装)_第1张图片


Java小白修炼手册

你可能感兴趣的:(封装好的函数)