GDIPlus进度条
包含gdiplus头
#include <gdiplus.h>
using namespace Gdiplus;
引用lib
#pragma comment(lib,"gdiplus.lib")
为了使用GDI要在 WinMain里 初始化设置 GDI
int WINAPI WinMain()
{
GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
GdiplusStartup(&gdiplusToken,&gdiplusStartupInput,NULL);
//---------------------------
// 插入你的窗口代码 窗口类,和显示窗口,消息循环
//最后还要释放GDIPlus
GdiplusShutdown(gdiplusToken);
return 0;
}
int Render()
{
if(i>830){
i = 0;
InvalidateRect(hWnd,&rect,true);
}
Graphics graphics(hdc);
GraphicsPath path;
Pen pen(Color(255,255,255,255),2);
Point points[] = {Point(40,60),Point(50,70),Point(30,90)};
/*Point p[] = {Point(10,100),
Point(rand()%50,5),Point(100,10),Point(100,10),
Point(rand()%100,10),Point(200,10),Point(200,100),
Point(rand()%190,190),Point(120,200),Point(100,200),
Point(rand()%100,200),Point(20,200),Point(10,100),};
graphics.DrawBeziers(&pen,p,13);*/
SolidBrush brush(Color(255,255,255,250));
path.AddRectangle(Rect(100,100,50,50));
Rect frame(90,90,900,60);
graphics.DrawRectangle(&pen,frame);
graphics.TranslateTransform(i,-5.0f);
graphics.DrawPath(&pen,&path);
graphics.FillPath(&brush,&path);
i++;
Sleep(10);
return 0;
}
Render()函数 放在 PeekMessage控制的消息循环里,另外利用Bezier曲线 函数来控制起点,终点,调整控制点也 看明白了。 这样复杂的变化曲线图象就可以利用Bezier曲线构造了。
而静态的则 通过PS 等 绘图工具方便制作。
浙公网安备 33010602011771号