|
I am currently writing an application using C++ and MFC. I need to put out about 100 words of text that are instructions to the user. I am doing this by using the method CDC::TextOut in my OnPaint routine. However, something about doing it this way does not seem right to me. I am also concerned that there maybe formatting issues. That is, the text does not look particular nice. I am hoping there is a better way to put this text out. Any ideas?
Thanks
Bob
|
|
|
|
|
BobInNJ wrote: I am doing this by using the method CDC::TextOut in my OnPaint routine.
Does this mean you have an SDI or MDI application? If so, and the view based on CFormView , you could add a static control to the top of it and write the instructions there.
Another option would be a modeless dialog. It could contain the instructions while still allowing you to interact with the parent window.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Thanks for the response. I am not using the document view architecture. Therefore, I conclude that
my application is not SDI or MDI.
Bob
|
|
|
|
|
Ok, you either use a separate, modeless dialog for the instructions, or put a static control on your dialog for them.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
(without much context, I cannot offer more help )
Why not simply creating a dialog (modal or modeless) and display the text in a simple multi-line edit box ?
This signature was proudly tested on animals.
|
|
|
|
|
|
Thanks for all the responses. After looking at the alternatives, I came to the conclusion that just putting out plain text using TextOut was the way to go.
Bob
|
|
|
|
|
HI , every body ,,
I build an application In MFC that Uses highgui in OpenCV to show the picture in new window ,,
BUT .. I want to show the picture in the same window of MFC insted of showing in new window ,,
I search about it , but I can't find the answer ,,
please tell me the answer step by step ,,
regards ,,
|
|
|
|
|
The program is to keep records and perform statistical for a class of students.
the class may have up to 40 students. They have 5 quizzes, and all the students are identified by a 4 digit student number
and the program will print the students scores and calculate and print the statistics for each quiz
Student Quiz 1 Quiz 2 Quiz 3 Quiz 4 Quiz 5
1234 78 83 87 91 86
2134 67 77 84 82 79
3124 77 89 93 87 71
High Score 78 89 93 91 86
Low Score 67 77 84 82 71
Average 73.4 83.0 88.2 86.6 78.6
but this is what i have so far
#include<stdio.h>
#define ROW 4
#define COLS 5
int main(void)
{
// Local Declarations
int table [ROW] [COLS] =
{
{1234,52,7,100,78,34}'
{2134,90,36,90,77,30},
{3124,100,45,20,90,70},
{4532,11,17,81,32,77}
};
int line [ROW * COLS];
// Statments
for (int row = 0; row <ROWS;row++)
for (int column =0; column < cols, column++)
line[row * cols + column] = table [row] [column];
for (int row = 0; row <ROWS * cols; row++)
printf("%02d", line [row]);
return 0;
} // main
When i execute im getting 42 errors
|
|
|
|
|
im stuck i cant seem to complete this
and i cant understan y im gettin 42 errors
|
|
|
|
|
biggiant22000 wrote: When i execute im getting 42 errors
what are the errors ?
{1234,52,7,100,78,34}'
change that ' to a ,
|
|
|
|
|
See here.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hey folks!
Got 2 minor questions i thought i ask here maybe you know an answer to.
First: do you know about any way to check if a given hotkey is available on the system or not? I'm talking about hotkeys you can register using RegisterHotKey[^]. I know this method will fail if the key specified is already registered by someone but if it is not it WILL register the key, but i would like a way to check if i could register it WITHOUT actually doing it (that would happen later on). I know one way would be to try and register it and if it succeeds unregister it again right away but this solution doesn't sound so nice.
Second: I'd like to have a window staying above all other windows that belong to the same process, so it is kind of an always-on-top window but not a system-wide always-on-top window, i do not want this window to stay above all the other windows on the system that belong to different processes.
Thanks in advance for any suggestions.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Code-o-mat wrote: do you know about any way to check if a given hotkey is available on the system or not?
From the documentation you linked to:
RegisterHotKey fails if the keystrokes specified for the hot key have already been registered by another hot key.
|
|
|
|
|
Thanks for the answer. As i said, i am aware that RegisterHotKey will fail in case the hotkey is already used BUT at the point i want to check if it is available i do not wish to actually register it.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Code-o-mat wrote: As i said
Yes you did. My fault, I read your post the first time and missed that part. Unfortunately there might not be another way to do it.
|
|
|
|
|
Oh well, i'll go with what i can get, i was just hoping for a more sophisticated way to do it. Thanks.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
|
Thanks, i will check if i can use any of that, the project is not an MDI app but an SDI one with a few floating windows and i want one modeless dialog to stay above all the floats.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Then you probably want to check out the SetWindowPos flag WS_EX_TOPMOST
|
|
|
|
|
The problem with WS_EX_TOPMOST is that it will make the window "globally" always on top, menaing it will cover all non-always-on-top windows on the system but i only want it to cover the windows of itw own process.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Hi every one.
I have used 'NTGraph3D.dll' from [3D Graph ActiveX Control] with out any problem,
But When I want to compile the source using Visula Studio 2008 SP1 the below error occurred!
GraphCtl.obj : error LNK2019: unresolved external symbol "char * __stdcall _com_util::ConvertBSTRToString(wchar_t *)" (?ConvertBSTRToString@_com_util@@YGPADPA_W@Z) referenced in function "public: void __thiscall CGraphCtl::DrawAxisLabels(struct HDC__ *)" (?DrawAxisLabels@CGraphCtl@@QAEXPAUHDC__@@@Z)
.\Debug/NTGraph3D.dll : fatal error LNK1120: 1 unresolved externals
any one could help??
or how could I use the source of this control in my program
instead of ActiveX control prepared by the source.[thanks]
|
|
|
|
|
Amir_m wrote: any one could help??
Have you read this?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
 of course, but I was confused with so much cases that generate this error,
Only I know that this function in its last 7 lines cause the error, if you cuold recognize it please tell me.
void CGraphCtl::DrawAxisLabels(HDC hdc)
{
float X,Y,Z,res;
int i;
char str[50];
CPoint3D pt;
COLORREF colX, colY, colZ;
OleTranslateColor(m_clrXGridColor, m_hPal, &colX);
OleTranslateColor(m_clrYGridColor, m_hPal, &colY);
OleTranslateColor(m_clrZGridColor, m_hPal, &colZ);
res = (dRangeX[MAX] - dRangeX[MIN]) / m_nGridX ;
for ( i = 0 ; i <= m_nGridX ; i++)
{
X = dRangeX[MIN] + (res * (float)i);
sprintf(str,"%g",X);
X = ((float)i)/m_nGridX;
SetColor(colX);
pt=CPoint3D(-0.5,-0.5,0.5);
pt.Translate(X,0.0,0.3);
PrintText(hdc, pt, str);
}
res = (dRangeY[MAX] - dRangeY[MIN]) / m_nGridY ;
for ( i = 0 ; i <= m_nGridY ; i++)
{
Y = dRangeY[MIN] + (res * (float)i) ;
sprintf(str,"%g",Y);
Y = ((float)i)/m_nGridY;
SetColor(colY);
pt = CPoint3D(-0.5,-0.5,0.5);
pt.Translate(0.0,Y,0.3);
PrintText(hdc, pt, str);
}
res = (dRangeZ[MAX] - dRangeZ[MIN]) / m_nGridZ ;
for ( i = 0 ; i <= m_nGridZ ; i++)
{
Z = dRangeZ[MIN] + (res * (float)i) ;
sprintf(str,"%g",Z);
Z = ((float)i)/m_nGridZ;
SetColor(colZ);
pt = CPoint3D(0.5,-0.5,-0.5);
pt.Translate (0.2,0.0,Z);
PrintText(hdc, pt, str);
}
SetColor(RGB(0,0,0));
using namespace _com_util;
SetColor(colX);
PrintText(hdc,CPoint3D(0.0f,0.7f,-0.5f),ConvertBSTRToString(m_bstrXLabel));
SetColor(colY);
PrintText(hdc,CPoint3D(0.7f,0.0f,-0.5f),ConvertBSTRToString(m_bstrYLabel));
SetColor(colZ);
PrintText(hdc,CPoint3D(-0.5f,0.7f,0.0f),ConvertBSTRToString(m_bstrZLabel));
glEnd();
}
[thanks]
|
|
|
|
|
Are you linking with the correct library? Have you seen this and this and this?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|