C/C++ 绘制初等函数曲线图形初等函数曲线图形的简易绘制:设屏幕显示文本是25行,80列,可以用“

发布时间:2021-02-25 07:24:10

C/C++ 绘制初等函数曲线图形初等函数曲线图形的简易绘制:设屏幕显示文本是25行,80列,可以用“+”和“——〉”号画坐标系,用“*”号画曲线上的点,给出初等函数,例如cos(x),ex, x3-3x+1,等等,还要给出x的一个估计的范围,程序就画出这个初等函数的简易图形.这个就是原题了 一个字没少 其实要求也不是很高平台最好是VC++6.0 语言用C或者C++

网友回答

可以 CDC * pDC = pWnd->GetDC();
然后直接调用 CDC的成员函数实现曲线的绘制,具体看看msdn,上面有详细的说明,对于你所说的函数曲线直线片段来实现,使用for循环,递增t的值得到y的值.
打开位图BMP,使用 LoadImage 函数,MSDN上有说明,指定相应的参数即可,注意指定 LR_LOADFROMFILE 参数,返回值是图形的句柄,然后通过CDC的函数BitBlt来在设备描述符上绘制图象,
CBitmap bmp;
if (bmp.LoadBitmap(IDB_BITMAP1))
{ // Get the size of the bitmap
BITMAP bmpInfo;
bmp.GetBitmap(&bmpInfo);
// Create an in-memory DC patible with the
// display DC we're using to paint
CDC dcMemory;
dcMemory.CreateCompatibleDC(pDC);
// Select the bitmap into the in-memory DC
CBitmap* pOldBitmap = dcMemory.SelectObject(&bmp);
// Find a centerpoint for the bitmap in the client area
CRect rect;
GetClientRect(&rect);
int nX = rect.left + (rect.Width() - bmpInfo.bmWidth) / 2;
int nY = rect.top + (rect.Height() - bmpInfo.bmHeight) / 2;
// Copy the bits from the in-memory DC into the on-
// screen DC to actually do the painting. Use the centerpoint
// we puted for the target offset.
pDC->BitBlt(nX, nY, bmpInfo.bmWidth, bmpInfo.bmHeight, &dcMemory,
0, 0, SRCCOPY);
dcMemory.SelectObject(pOldBitmap);
}}这段MSDN上的代码你参考一下
另外,虚机团上产品团购,超级便宜
以上问题属网友观点,不代表本站立场,仅供参考!