⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 listdraw.c

📁 用MINIGUI编写的窗口代码
💻 C
字号:
#include <minigui/common.h>
#include <minigui/minigui.h>
#include <minigui/gdi.h>
#include <minigui/window.h>
#include <minigui/control.h>
#include <minigui/mgext.h>
#include <minigui/mywindows.h>
#include <stdlib.h>
#include "list.h"
#include "listdraw.h"

/**********************************************************************
**函数名:void LDrawLabel(HDC hdc,struct label lb,char driection)
**功能:画出标签,driection为文字方向
**参数:画图的窗口DC,标签类型lb,文字方向driection:'V':垂直;'H':水平;'R':右对齐
**返回值:无
**作者:陈永奎
**时间:2008.03.31
***********************************************************************/
void LDrawLabel(HDC hdc,struct label lb,char driection)
{
	RECT rc;

	rc.left=lb.Xorg;
	rc.top=lb.Yorg;
	rc.right=lb.Xorg+lb.Width;
	rc.bottom=lb.Yorg+lb.Height;

	SetPenColor(hdc,lb.framcolor);//设置画笔颜色,绘制label边框
	Rectangle(hdc,rc.left,rc.top,rc.right,rc.bottom);
	SetBkColor(hdc,lb.bkclor);     //设置背景色
	SetTextColor(hdc,lb.fontcolor); //设置字体颜色
	//用背景色覆盖标签中的文字
	SetBrushColor(hdc, lb.bkclor);
	FillBox (hdc, rc.left+1, rc.top+1, rc.right-rc.left-1, rc.bottom-rc.top-2); // 加1减1目的是为了防止把边框刷掉
	
	switch(driection)
	{
		case 'H': 
			DrawText(hdc, lb.text, -1, &rc, DT_CENTER | DT_VCENTER | DT_SINGLELINE); 
			break;
		case 'V':
			rc.top+=6;
			rc.left+=1;
			rc.right-=1;
			DrawText(hdc, lb.text, -1, &rc, DT_CENTER | DT_WORDBREAK);
			break;
		case 'R':
			DrawText(hdc, lb.text, -1, &rc, DT_RIGHT | DT_VCENTER | DT_SINGLELINE); 
			break;
		default: break;
	}

}

/**********************************************************************
**函数名:void LDrawRect(HDC hdc,RECT rc,DWORD color)
**功能:画出一个矩形框
**参数:画图的窗口DC,矩形框参数,颜色
**返回值:无
**作者:陈永奎
**时间:2008.03.31
***********************************************************************/
void LDrawRect(HDC hdc,RECT rc,DWORD color)
{
	SetPenColor(hdc,color);
	Rectangle(hdc,rc.left,rc.top,rc.right,rc.bottom);
}

/**********************************************************************
**函数名:void LDrawGrid(HDC hdc, int col, int row, char * GridVal, DWORD Color)
**功能:显示出row行,col列处的文字
**参数:画图的窗口DC,文字所处行row和列col,文字内容GridVal
**返回值:无
**作者:陈永奎
**时间:2008.04.24
***********************************************************************/
void LDrawGrid(HDC hdc, int col, int row, char * GridVal, DWORD Color)
{
	struct label *p;
	p=(struct label *)malloc(sizeof(struct label));
	p->bkclor=COLOR_black;
	p->fontcolor=Color;
	p->framcolor=COLOR_black;
	p->Height=LHHeight;
	p->text=GridVal;
	p->Width=LHWidth;
	p->Xorg=FirstLHXorg+col*(ListPerWidth+ListGap)-(ListPerWidth+ListGap);
	p->Yorg=FirstLHYorg+LHHeight+2+row*(p->Height)+1;
	LDrawLabel(hdc,*p,'H');
	free(p);
	p=NULL;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -