1.易语言 使用外部字体
2.用C语言画一个哆啦A梦_附源码
3.本人是源码学程序设计的,想了解下最基本的源码程序源码,怎样变成像WINDOWS上这样窗口化的源码软件?
易语言 使用外部字体
需要用 AddFontResource(WINAPI)函数将载入 TTF 字体资源,这样就可以使用了。源码通达信布林线主图公式源码但是源码如果字体文件不是位于字体文件夹,字体就不会出现在字体列表中,源码但是源码你可以设置使用这个字体。如果不是源码用的话,用 RemoveFontResource 函数将其移除。源码
用C语言画一个哆啦A梦_附源码
// 通过C语言与Windows API,源码成功绘制出哆啦A梦的源码php5.5 源码图像,并附上源代码示例。源码
以下是源码用于实现这一目标的代码:
c
#include
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow) {
static TCHAR szAppName[] = TEXT("MyWindows");
HWND hwnd;
MSG msg;
WNDCLASS wndclass;
// 窗口风格设置
wndclass.style = CS_HREDRAW | CS_VREDRAW;
wndclass.lpfnWndProc = WndProc;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
wndclass.hInstance = hInstance;
wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = szAppName;
if (!RegisterClass(&wndclass)) {
MessageBox(NULL, TEXT("这个程序需要在 Windows NT 才能执行!"),源码 szAppName, MB_ICONERROR);
return 0;
}
hwnd = CreateWindow(szAppName, TEXT("Windows"), WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, , , NULL, NULL, hInstance, NULL);
ShowWindow(hwnd, iCmdShow);
UpdateWindow(hwnd);
while (GetMessage(&msg, NULL, 0, 0)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) {
HDC hdc;
PAINTSTRUCT ps;
RECT rect;
HPEN hBlackPen, hOldPen, hWhite2Pen;
HBRUSH hWhiteBrush, hOldBrush, hBlackBrush, hRedBrush, hYellowBrush;
static HBRUSH hBlueBrush, blue_brush, green_brush;
static HPEN hBlue3Pen, blue_pen, green_pen;
POINT pxRightHand[4], pxiLeftHand[4];
int xCursor, yCursor;
POINT point;
switch (message) {
case WM_PAINT:
hdc = BeginPaint(hwnd, &ps);
GetClientRect(hwnd, &rect);
// 在窗口上写字
Rectangle(hdc, rect.right / 2 - , 5, rect.right / 2 - , );
Rectangle(hdc, rect.right / 2 + , 5, rect.right / 2 + , );
TextOut(hdc, rect.right/2 -, , L"画蓝色哆啦A梦", 7);
TextOut(hdc, rect.right/2 + , , L"画绿色哆啦A梦", 7);
// 绘制哆啦A梦各个部位
// 绘制头部、脸、源码眼睛、webflot怎么保存源码瞳孔、鼻子、嘴巴、胡子、身体、接弹球c 源码肚子、项圈、铃铛、百宝袋、腿、怪异macd指标源码脚掌、手臂与手掌等细节
// 绘制哆啦A梦的整体结构与细节
// 绘制哆啦A梦的各个部分
// 结束绘制
EndPaint(hwnd, &ps);
break;
// 其他消息处理
// 更多消息处理逻辑
}
return 0;
}
本人是学程序设计的,想了解下最基本的程序源码,怎样变成像WINDOWS上这样窗口化的软件?
呵呵,一年半前我和你一样,也处于这个状态,如果你做windows的程序设计的话,编程像windows这样的窗口化的软件,你必须接触VS,旗下的VC++或VC#,你学完c和c++先接触VC++的MFC较为容易,使用MFC APP向导可以直接生成你所说的windows这样窗口程序,刚开始你是不知道如何生成的,为此你需要边学windows程序设计,建议使用《windows程序设计》,里面介绍了一个基本窗体生成的原理和步骤。如果你要学VC#,那你得先学C#,离做一个windows这样窗口程序比较远,而且也不知道它生成的原理,当然既然c和c++学的不错的话,c#入门也不难。如下是一个窗体生成的windows源码:
/*--------------------------------------
CLOCK.C -- Analog Clock Program
(c) Charles Petzold,
--------------------------------------*/
#include <windows.h>
#include <math.h>
LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ;
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
PSTR szCmdLine, int iCmdShow)
{
static TCHAR szAppName[] = TEXT ("Clock") ;
HWND hwnd;
MSG msg;
WNDCLASS wndclass ;
wndclass.style = CS_HREDRAW | CS_VREDRAW ;
wndclass.lpfnWndProc = WndProc ;
wndclass.cbClsExtra = 0 ;
wndclass.cbWndExtra = 0 ;
wndclass.hInstance = hInstance ;
wndclass.hIcon = NULL ;
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW) ;
wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ;
wndclass.lpszMenuName = NULL ;
wndclass.lpszClassName = szAppName ;
if (!RegisterClass (&wndclass))
{
MessageBox (NULL, TEXT ("Program requires Windows NT!"),
szAppName, MB_ICONERROR) ;
return 0 ;
}
hwnd = CreateWindow (szAppName, TEXT ("GDI Test"),
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
NULL, NULL, hInstance, NULL) ;
ShowWindow (hwnd, iCmdShow) ;
UpdateWindow (hwnd) ;
while (GetMessage (&msg, NULL, 0, 0))
{
TranslateMessage (&msg) ;
DispatchMessage (&msg) ;
}
return msg.wParam ;
}
LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
static HDC hdc;
static PAINTSTRUCT ps;
static COLORREF color;
static UINT ixClient,iyClient;
static RECT rtWindow , rtClient;
switch (message)
{
case WM_CREATE :
GetWindowRect( hwnd , &rtWindow );
GetClientRect( hwnd , &rtClient );
return 0 ;
case WM_NCPAINT:
hdc = GetWindowDC( hwnd );
color = GetPixel( hdc , , 5 );
SetBkColor( hdc , color );
SetTextColor( hdc , RGB(,0,0) );
TextOut( hdc , , ,
"Editor : CM" , strlen("Editor : CM") );
ReleaseDC( hwnd , hdc );
return 0;
case WM_SIZE :
ixClient = LOWORD( wParam );
iyClient = HIWORD( wParam );
return 0 ;
case WM_TIMER :
return 0 ;
case WM_PAINT :
hdc = BeginPaint (hwnd, &ps) ;
TextOut( hdc , , , "Editor : CM" , strlen("Editor : CM") );
EndPaint (hwnd, &ps) ;
return 0 ;
case WM_DESTROY :
PostQuitMessage(0);
return 0 ;
}
return DefWindowProc (hwnd, message, wParam, lParam) ;
}