📄 static.c
字号:
/******************************************************************************
*
* Copyright 2006 National ASIC Center, All right Reserved
*
* FILE NAME: Static.c
* PROGRAMMER: ming.c
* Date of Creation: 2006/08/8
*
* DESCRIPTION:
*
* NOTE:
*
* FUNCTIONS LIST:
* -----------------------------------------------------------------------------
*
* -----------------------------------------------------------------------------
*
* MODIFICATION HISTORY
* LastModify 2006/10/30
******************************************************************************/
#include "mingui.h"
//---------------------------------------------------------------------------
static HRESULT CALLBACK DefStaticProc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam)
{ switch(message)
{ case WM_PAINT:
{ HDC dc = BeginPaint(hWnd);
char *LabelCaption;
int clientwidth=crWidth(hWnd);
int clientheight=crHeight(hWnd);
if(WNDPTR(hWnd)->Logo)
{ int x,y;
if( WNDPTR(hWnd)->Logo->Width < clientwidth )
{ x = (clientwidth - WNDPTR(hWnd)->Logo->Width)>>1 ;
} else x=0;
if( WNDPTR(hWnd)->Logo->Height < clientheight )
{ y = (clientheight - WNDPTR(hWnd)->Logo->Height)>>1 ;
} else y=0;
DrawBitmap(dc,x,y,WNDPTR(hWnd)->Logo);
}
LabelCaption=GetWindowText(hWnd);
if(LabelCaption && *LabelCaption)
{ DrawText(dc,0,0,clientwidth,clientheight,LabelCaption,alCenter|alMiddle);
}
EndPaint(hWnd);
}
return 0;
case WM_SETTEXT:
if(SaveWindowText(hWnd,(char *)lParam))
{ Invalidate(hWnd);
}
return 0;
case WM_SETLOGO:
WNDPTR(hWnd)->Logo=(TBitmap *)lParam;
Invalidate(hWnd);
return 0;
case WM_ENABLE:
Invalidate(hWnd);
return 0;
}
return DefWindowProc(hWnd,message,wParam,lParam);
}
//---------------------------------------------------------------------------
void CM_RegisterStatic(void)
{ TWNDCLASS wc;
memset(&wc,0,sizeof(wc));
wc.clForeground=CL_BTNTEXT;
wc.clBackground=CL_BTNFACE;
wc.lpfnWndProc=DefStaticProc;
wc.lpszClassName="static";
RegisterClass(&wc);
}
/*---------------------------------------------------------------------------
END --- Thank you! ming.c
---------------------------------------------------------------------------*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -