DrawText问题 [英] DrawText problem

查看:93
本文介绍了DrawText问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好吗,孩子们!

这是我的问题.

我必须创建一个硬件存储程序,在其中将库存放入链接列表中.然后在客户区域中打印该库存.显然,该程序具有更多的规范.
我的问题是它只打印函数的前四行:

How are you doing kids!

Here is my problem.

I have to create a hardware store program where I put the inventory in a linked list. And then print that inventory in the client area. Obviously the program has more specifications than that.
My problem is that it prints only the first four lines of the function:

void Linked_List::display(CPaintDC *dc)
{
	node* print = new node;
	print = start;
	
        CString temp;
	int x, y=0;
	do{
	x = 0;
		CRect wow(0,y+=20,100,100);
	dc->DrawText(print->StockN ,wow, DT_SINGLELINE); 
	
	wow.MoveToX(x+=100);
	temp.Format(_T("%d"),print->Qty);
	dc->DrawText (temp,wow, DT_SINGLELINE); 
	
	
	wow.MoveToX(x+=100);
	dc->DrawText(print->Description ,wow, DT_SINGLELINE); 
	
	wow.MoveToX(x+=100);
	temp.Format(_T("%.2f"),print->Price);
	dc->DrawText( temp,wow, DT_SINGLELINE); 
	print = print->next;
	}while(print != NULL);
		
} 



这是我填充链接列表的方式:



This is the way I populate the linked list:

invent.insert("A100",20,"Hammer",9.95);
invent.insert("A250",25,"Saw",13.95);
invent.insert("B400",50,"Flat-Head Nails",11.99);
invent.insert("C888",50,"Flat-Head Screwdriver",6.59);
invent.insert("A499",75,"Pliers",4.95);
invent.insert("C667",50,"Drill",22.95);
invent.insert("B875",70,"Plumbers's Wrench",11.90);
invent.insert("D547",60,"Ladder 10 foot",70.44);
invent.insert("A910",85,"Flashlight 10 inch",9.99);
invent.insert("B123",90,"Assorted Buss Fuses",4.99);



同样,它只对前四行执行此操作.我很确定问题出在那个函数中.

提前致谢. :rolleyes:



And again it only does it with the first four lines. I''m pretty sure the problem is in that function.

Thanks in advance. :rolleyes:

推荐答案

我发现了问题...
在发现逻辑错误之前发布的函数中.
在以下行中:
CRect哇(0,y + = 20,100,100);
dc-> DrawText(print-> StockN,wow,DT_SINGLELINE);

在第一行中,我要打印直到y坐标为100.但是如果我将其更改为:

CRect哇(0,y + = 20,100,800);
dc-& gt; DrawText(print-& gt; StockN,哇,DT_SINGLELINE);
它确实起作用.我不会那样做,我将其作为y的函数.

无论如何,还是谢谢,这次我解决了我自己的问题:-\
I Found the problem...
In the function I posted before I found a logical error.
In the lines:
CRect wow(0,y+=20,100,100);
dc->DrawText(print->StockN ,wow, DT_SINGLELINE);

In the first line, I''m saying to print up until the y-coordinates of 100. but if I change that to:

CRect wow(0,y+=20,100,800);
dc->DrawText(print->StockN ,wow, DT_SINGLELINE);
It does work. I''m not gonna leave it like that, I''ll put it as a function of y.

Thanks anyways, althoug this time I solved my own problem :-\


这篇关于DrawText问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆