|
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
|
|
|
|
|
I am having a strange problem with the following dialog callback function:
BOOL CALLBACK MergeProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
static int MostRooms;
bool bError;
char *room,*year,*exam;
switch(Message)
{
case WM_INITDIALOG:
if (strlen(dlgdata[0])) {
year = new char [10];
strncpy(year,dlgdata[0]+2,4);
strcpy(year+4,"\0");
SendDlgItemMessage(hwnd,SD_MERGE_YEAR, WM_SETTEXT,20,(LPARAM) year);
delete year;
}
SendDlgItemMessage(hwnd,SD_MERGE_YEAR, EM_LIMITTEXT,4,0);
SendDlgItemMessage(hwnd,SD_MERGE_ROOM, EM_LIMITTEXT,30,0);
SendDlgItemMessage(hwnd,SD_MERGE_EXAM, EM_LIMITTEXT,10,0);
MostRooms = atoi(dlgdata[1]);
EnumChildWindows(hwnd,EnumChildProc,(LPARAM)hFnt);
return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDOK:
bError = false;
room = new char [30];
year = new char [10];
exam = new char [30];
room[0] = (char)10;
year[0] = (char)10;
exam[0] = (char)30;
SendDlgItemMessage(hwnd,SD_MERGE_YEAR,EM_GETLINE,0,(LPARAM)year);
SendDlgItemMessage(hwnd,SD_MERGE_ROOM,EM_GETLINE,0,(LPARAM)room);
SendDlgItemMessage(hwnd,SD_MERGE_EXAM,EM_GETLINE,0,(LPARAM)exam);
if (strlen(room) > 0) {
if (!count_rooms(room,MostRooms+1) ) {
char tmp [128];
sprintf(tmp,"Please enter rooms between 0 and %i!",MostRooms+1);
MessageBox(0,tmp,0,0);
bError = true;
}
}
else if (!bError) {
MessageBox(hwnd,"Please enter a room!",0,0);
SetFocus(GetDlgItem(hwnd,SD_MERGE_ROOM));
bError = true;
}
if ( (strlen(year) > 0) && (!bError) ) {
if ((atoi(year) > 2000)&&(atoi(year) < 2100)) {
char *text = new char [10];
strcpy(text,"¸ß");
strcat(text,year);
strcat(text,"¼¶");
strcpy(year,text);
delete text;
}
else if (!bError) {
MessageBox(hwnd,"Please enter a year between 2000 and 2100!",0,0);
SetFocus(GetDlgItem(hwnd,SD_MERGE_YEAR));
bError = true;
}
}
else if (!bError) {
MessageBox(hwnd,"Please enter a year!",0,0);
SetFocus(GetDlgItem(hwnd,SD_MERGE_YEAR));
bError = true;
}
if ((strlen(exam) > 0) && (!bError) ) {
}
else if (!bError) {
MessageBox(hwnd,"Please enter an exam name!",0,0);
SetFocus(GetDlgItem(hwnd,SD_MERGE_EXAM));
bError = true;
}
if (bError) {
delete exam;
delete room;
delete year;
MessageBox(0,"An Error occured",0,0);
}
else {
dlgdata[0] = year;
dlgdata[1] = room;
dlgdata[2] = exam;
EndDialog(hwnd,1);
}
break;
case IDCANCEL:
EndDialog(hwnd,0);
break;
}
break;
default:
return FALSE;
}
return TRUE;
}
Sorry to post so much. Basically all this does is retrieves the text from the three edit boxes, tests the values and returns. If you follow the IDOK event, you can see if an error occurs I display a message box and set the bError = true. Now for some reason, only with a release build, bError is false right through, until I test if it is true. No message boxes are displayed besides the final "An Error occured". I just can't understand why.
I have placed a message box on just about every line, they have confirmed that bError is false. But the if (bError) { is always true.
|
|
|
|
|