请问要实现点击按钮一次thetaInDegrees+1,应该怎么实现?
void CSpeedmeterDlg::OnPaint()
{
CPaintDC dc(this); CPen *pOldPen;
CPen *pNewPen=new CPen();
CRect rect;pNewPen->CreatePen(PS_DASH,4,RGB(0,255,0));
pOldPen=dc.SelectObject(pNewPen);
//int thetaInDegrees=m_edit;
int thetaInDegrees=1;
double theta =thetaInDegrees * (3.14159/180);
int x,y,x1,y1,i,speed;
GetClientRect(&rect);
//speed=3;
x=30;
y=312;
//for(speed>0;x=30;y=312)
//for(i=0;i<speed;i++)
//for(int x = x1; x<=x2; x++)
// for(int y = x1; y<=y2; y++)
//{
x1=int(x-140)*cos(theta)-(y-312)*sin(theta)+140;
y1=int(x-140)*sin(theta)-(y-312)*cos(theta)+312;
dc.MoveTo(140,312);
dc.LineTo(x1,y1);
//x=x1;
//y=y1;
//}
dc.SelectObject(pOldPen);
pNewPen->DeleteObject();
delete pNewPen;
}
void CSpeedmeterDlg::OnPaint()
{
CPaintDC dc(this); CPen *pOldPen;
CPen *pNewPen=new CPen();
CRect rect;pNewPen->CreatePen(PS_DASH,4,RGB(0,255,0));
pOldPen=dc.SelectObject(pNewPen);
//int thetaInDegrees=m_edit;
int thetaInDegrees=1;
double theta =thetaInDegrees * (3.14159/180);
int x,y,x1,y1,i,speed;
GetClientRect(&rect);
//speed=3;
x=30;
y=312;
//for(speed>0;x=30;y=312)
//for(i=0;i<speed;i++)
//for(int x = x1; x<=x2; x++)
// for(int y = x1; y<=y2; y++)
//{
x1=int(x-140)*cos(theta)-(y-312)*sin(theta)+140;
y1=int(x-140)*sin(theta)-(y-312)*cos(theta)+312;
dc.MoveTo(140,312);
dc.LineTo(x1,y1);
//x=x1;
//y=y1;
//}
dc.SelectObject(pOldPen);
pNewPen->DeleteObject();
delete pNewPen;
}
解决方案 »
- 有没有非阻塞版本的MessageBox(非模态版本的MessageBox)
- CreateProcess创建外部程序的进程后,如何保证其完全启动起来
- 急!请教关于EnterCriticalSection
- 高手请看一下:opengl 的一段代码如何修改
- 如何实现VC++格式的窗口标题栏样式
- 有关贝塞尔曲线的问题!
- Q_Q()大侠前来拿分(2)
- 怎么给#define的常量限制个有效的定义域?
- 寻求验证Window2000密码的方法(在线等待)
- 急!GetPrivateProfileSection 读ini文件
- Cimage加载图片闪烁
- 不能将参数 2 从“CPoint *”转换为“const Gdiplus::PointF *”
把变量放到按钮的响应事件里
thetaInDegrees++;
if (thetaInDegrees >= 360)
thetaInDegrees = 0;