|
To display the series on the same line, simply construct the string and use TextOut() to display it, as in:
CString strNumbers;
for (int nNum=1; (nNum <= 50); nNum++) {
CString strNum;
strNum.Format ("%d ", nNum);
strNumbers += strNum;
}
VERIFY (pDC->TextOut (10, 10, strNumbers));
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
i don't understand final code :
VERIFY (pDC->TextOut (10, 10, strNumbers);
what's it mean ?
Lgx
|
|
|
|
|
Surivevoli wrote: VERIFY (pDC->TextOut (10, 10, strNumbers);
VERIFY means to verify that your statement is properly fired or not.. try you local copy of msdn for these keywords
|
|
|
|
|
See this[^] link for information on the VERIFY and ASSERT macros.
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
Hi Surivevoli,
CString Str;
int i=0;
while(i<50)
{
Str.Format("%d",i);
dc.SetBkMode(0);
dc.TextOut(X,50,Str,Str.GetLength());
X+=20;
i++;
}
|
|
|
|
|
Thank you !
dc.SetBkMode(0)is uderstanded as dc.SetBkMode(TRANSPARENT)???
if before i draw a rectangle filled Red color
{i use CBrush ...},
i try release that command{dc.SetBkMode} and use TextOut() to draw number text on the rectangle, but i see nothing changed
if i want display formated "01","02","03",...
Can you help me ?
Lgx
-- modified at 6:34 Saturday 8th April, 2006
|
|
|
|
|
Surivevoli,
CString Str;
int i=0;
while(i<50)
{
Str.Format("0%d",i);
dc.SetBkMode(0);
dc.TextOut(X,50,Str,Str.GetLength());
X+=32;
i++;
}
-- modified at 7:13 Saturday 8th April, 2006
|
|
|
|
|
//Now test this code then again test without SetBkMode
CPaintDC dc(this);
CString Str;
int i=0;
dc.FillRect(CRect(0,50,800,80),&CBrush(RGB(120,120,200)));
while(i<50)
{
Str.Format("''0%d''",i);
dc.SetBkMode(0);
dc.SetTextColor(RGB(255,255,255));//White
dc.TextOut(X,55,Str,Str.GetLength());
X+=40;
i++;
}
|
|
|
|
|
thank you very much !
what is the difference between CPaintDC and CClientDC ?
for you, what class should i use ?
for example :
i want draw a bitmap at coordinate of mouse when it is pressed Left
|
|
|
|
|
|
Surivevoli wrote: I want to display series of numbers from 1 to 50 (that handled by variable i) use CPaintDC.TextOut();Please help me !Thanks !
use wsprintf to add number in string and you can easily display that using the TextOut, but IMHO you should use CDC::ExtTextOut for same!
|
|
|
|
|
what's difference between TextOut() and ExtTextOut() ???
why should you ExtTextOut()??
|
|
|
|
|
Hey everybody. I'm so pissed off and angry on this thing I'm working on, that I exhausted myself. Before angrily going to sleep, I'm going to tell you a
bit of this problem, maybe there are some bright minds out there which can figure out what I couldn't, all day.
I got a main window. One "Static" window in it (a label child) with some text. Even though the main window is HWND_TOPMOST, sometimes Window's OS tooltips get over it. In those cases, I need to repaint. So I invalidate and repaint. The problem is that the child flickers. If I do 10 repaits per second I see an annoying flicker. I've been killing myself all day with back-drawing in memory DCs but with no use grr. Whatever I do, that label keeps flickering! What can I do about it!? ANY IDEAS? ANY? ANY LITTLE THING. I'm desperate ::- (.
I was thinking 5 minutes ago to make a snapshot of the window in a HBITMAP and then simply BitBlt that each redraw. But probably the label will keep flickering since probably it's WM_PAINT code will execute before or after the main's window WM_PAINT (don't know the order of events right now) so I'm going to have worked in vain to construct that snapshots system.
-= E C H Y S T T A S =-
The Greater Mind Balance
|
|
|
|
|
Well, since you're inviting any ideas, I thought I would ask why you can't draw the text directly onto the client surface of the window without using a static?
|
|
|
|
|
Axonn Echysttas wrote: If I do 10 repaits per second I see an annoying flicker.
This is a common problem, especially in applications that need to constantly update a status string. A workaround is to use a "smart" SetText() method, as in:
void SmartSetText
(CWnd* pWnd,
CString strText)
{
ASSERT (pWnd != NULL);
ASSERT (pWnd->GetSafeHwnd() != NULL);
CString strOldText;
pWnd->GetWindowText (strOldText);
if (strOldText.Compare (strText) != 0)
pWnd->SetWindowText (strText);
}
It's a simple solution that works quite well.
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
I am migrating to Windows Forms Applications included in visual studio. However, I am having trouble getting the c++ code to interface with the controls on the Form. If anyone knows of any good (preferably c++) tutorials it would be greatly appreciated.
Thanks.
|
|
|
|
|
I am wondering what other developers think is the best way to register file extensions with windows.
Thanks.
|
|
|
|
|
If by Register file extensions, you mean have a default icon and open with for a new file type, then this is also fairly easy. You need to add your file extension to the registry. This[^] might help you.
|
|
|
|
|
Thanks
|
|
|
|
|
hi i also want to know about this kind of reg assign if u can have any idea about this problem then tell to me aalso
thanks
sasikumar
|
|
|
|
|
If using MFC, I would use EnableShellOpen() and RegisterShellFileTypes() , both of which are methods of CWinApp .
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
In MS Word or OpenOffice when you try to load a file you get a dialog window asking you to find the file you want to open. I am trying to implement that dialog window in a program, and I am wondering if there is a library or function call which would make my job easier that starting from scratch.
Thanks.
-- modified at 13:21 Friday 7th April, 2006
|
|
|
|
|
There are open/save dialogs in the common dialogs library. Have a look here[^]
|
|
|
|
|
Thanks
|
|
|
|
|
There's also MFC's CFileDialog class.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|