易码技术论坛

 找回密码
 加入易码
搜索
查看: 4101|回复: 75

[求助] 在Visual C++ 6.0中想画点或者直线怎么办!

[复制链接]
发表于 2008-3-18 14:59:45 | 显示全部楼层 |阅读模式
包含 graphics.h 不可以啊

[ 本帖最后由 TYCY 于 2008-3-18 15:03 编辑 ]
发表于 2008-3-18 15:09:08 | 显示全部楼层
不可以……
你可以用GDI或者D3D、OGL等等。
 楼主| 发表于 2008-3-18 15:11:02 | 显示全部楼层
要用类去实现?
发表于 2008-3-18 15:44:06 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
 楼主| 发表于 2008-3-18 15:46:21 | 显示全部楼层
C是不是要简单点?
发表于 2008-3-18 15:54:15 | 显示全部楼层
一般来说还是用GDI吧。
获取窗体的绘图上下文后即可在窗体上绘图了。
发表于 2008-3-18 16:37:54 | 显示全部楼层
画点:SetPixel
画线:LineTo
 楼主| 发表于 2008-3-18 19:51:31 | 显示全部楼层
LEE说的是C上用的还是C++?
发表于 2008-3-18 21:55:40 | 显示全部楼层
都能用,是windows就能用
 楼主| 发表于 2008-3-19 08:50:32 | 显示全部楼层
有没有用法?
建工程时是建立那里工程才可以?
发表于 2008-3-19 10:24:43 | 显示全部楼层
GID绘图,WINDOWS下的。
自己尝试下就知道了,用起来简单。。。
 楼主| 发表于 2008-3-19 11:20:19 | 显示全部楼层
GID?
好吧,我上百度看看有没有教程,LS有好的也可以告诉我一声!
 楼主| 发表于 2008-3-19 11:22:10 | 显示全部楼层
百度上找不到相关资料,LS能不能给我一份(链接也行)
发表于 2008-3-19 11:48:01 | 显示全部楼层
The SetPixel function sets the pixel at the specified coordinates to the specified color.

COLORREF SetPixel(

    HDC hdc,        // handle of device context  
    int X,        // x-coordinate of pixel
    int Y,        // y-coordinate of pixel
    COLORREF crColor         // pixel color
   );       


Parameters

hdc

Identifies the device context.

X

Specifies the x-coordinate, in logical units, of the point to be set.

Y

Specifies the y-coordinate, in logical units, of the point to be set.

crColor

Specifies the color to be used to paint the point.



Return Values

If the function succeeds, the return value is the RGB value that the function sets the pixel to. This value may differ from the color specified by crColor; that happens when an exact match for the specified color cannot be found.
If the function fails, the return value is -1. To get extended error information, call GetLastError.

Remarks

The function fails if the pixel coordinates lie outside of the current clipping region.
Not all devices support the SetPixel function. For more information, see GetDeviceCaps.

See Also

GetDeviceCaps, GetPixel, SetPixelV
 楼主| 发表于 2008-3-19 11:50:14 | 显示全部楼层
求助:
#include <stdio.h>
#include <windows.h>
void mian()
{
        SetPixel(0,20,20,5);
        getchar();
}

C++中写的源码。编译通过
--------------------Configuration: pro - Win32 Debug--------------------
Compiling...
Skipping... (no relevant changes detected)
main.cpp

main.obj - 0 error(s), 0 warning(s)

但是组建的时候怎么错了?
--------------------Configuration: pro - Win32 Debug--------------------
Linking...
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/pro.exe : fatal error LNK1120: 1 unresolved externals
执行 link.exe 时出错.

pro.exe - 1 error(s), 0 warning(s)
错在那里??
发表于 2008-3-19 11:51:54 | 显示全部楼层
创建win32 aplication
发表于 2008-3-19 11:52:44 | 显示全部楼层
是main,不是mian
 楼主| 发表于 2008-3-19 11:53:19 | 显示全部楼层
我创建的是
Win32 Console Application
 楼主| 发表于 2008-3-19 11:53:51 | 显示全部楼层
不可以吗?要创建他上面那个?


另,我怎么显示离线?
发表于 2008-3-19 11:54:16 | 显示全部楼层
原帖由 leesoft 于 2008-3-19 11:52 发表

是main,不是mian


真是@#$%
您需要登录后才可以回帖 登录 | 加入易码

本版积分规则

Archiver|手机版|小黑屋|EMAX Studio

GMT+8, 2024-4-24 06:51 , Processed in 0.017511 second(s), 19 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表