|
The first two that Lauren mentioned will format the data in your string into another buffer, then you can use TextOut to draw to your view. You should place the call to TextOut in your OnDraw handler if you are using MFC, or in your handler for WM_PAINT if you are using regular window 32.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
you would normally either let your user type directly into the view (like a text editor) or enter stuff thru a dialog box
then in your OnPaint() handler you would put the other code
situations to avoid #37: "good morning ... how many sugars do you take in your coffee ... and what was your name again?"
coming soon: situations to avoid #38: "...and the dog was there too?"
|
|
|
|
|
Hi,
I have an SDI project (doc/view architecture), my view is derived from CFormView which contains a ListBox.
I wish to ask the user to save the application data (the content of the ListBox) when exiting or when File/New menu command is selected.
How to do that (save the content of the ListBox) ?
(I know that i should save it's content to my CDocument... but how to do it exactly ? step by step ?).
Thank's
|
|
|
|
|
Overriden Serialize ,and define strings for your listbox and do something like this:
void CTestAppDoc:: (CArchive& ar)
{
if (ar.IsStoring())
{
ar << m_string;
}
else
{
ar >> m_string;
}
}
Mazy
"The path you tread is narrow and the drop is shear and very high,
The ravens all are watching from a vantage point near by,
Apprehension creeping like a choo-train uo your spine,
Will the tightrope reach the end;will the final cuplet rhyme?"Cymbaline-Pink Floyd
|
|
|
|
|
You can use doc's default serialization feature if your know the kind of data and the exact size of your data. Otherwise, you should override all save, saveas, save file, etc. and write your own read/write functions for input and output.
Kuphryn
|
|
|
|
|
where can i find some tutorials that will show me how to use the windows tab control with visual c++ 6?
- Thanks
|
|
|
|
|
check out the controls section on cp
it has a few things on tabs that should help
situations to avoid #37: "good morning ... how many sugars do you take in your coffee ... and what was your name again?"
coming soon: situations to avoid #38: "...and the dog was there too?"
|
|
|
|
|
> situations to avoid #37
LOL! *g*
is there a list of more?
|
|
|
|
|
The font of a CEdit box can be changed with SetFont(..), but that function doesn't change the Background color of the text.
How on earth can I change it, I'm getting pretty desperate, as it appears there is no function that does the job properly.
And subclassing a control will result in rewriting almost the entire paint process of the CEdit class.
I need to do the same with Group boxes.
Who can help me out? Any help would be greatly appreciated!
|
|
|
|
|
|
HI
Is there any way to hide all desktop details from the User and provide my own customize shell.
<|>
|
|
|
|
|
My question may be stupid but i can't remember if we can initialize and affect an array in the same code line. Something like:
int Array[10]=[1,2,3,4,5,6,7,8,9,10];
could someone tell me if it's possible and how to do...please
|
|
|
|
|
int array[10] = {1,2,3,4,5,6,7,8,9,10};
situations to avoid #37: "good morning ... how many sugars do you take in your coffee ... and what was your name again?"
coming soon: situations to avoid #38: "...and the dog was there too?"
|
|
|
|
|
Hi!
I have drawn three radio buttons, and want to set one of this three one to aktivated state. How can I do this???? Please Help me soon, I need it for a project at school!
thx Michi
|
|
|
|
|
If you have used Visual Studio to generated the dialog you will have set the first one in the group with the WS_GROUP style.
The easiest way is to use Visual Studio the attatch a variable to the auto radio button group. Set the variable to 0 to avtivate the first,
1 for the second and 3 for the third. Then call UpdateData(FALSE);
Happy programming!!
|
|
|
|
|
first you need to make them all part of the same group in the dialog editor
then you need to assign a variable with them in the class wizard
then you need to set the variable to the zero-based index of the button you want on in your data exchange code
situations to avoid #37: "good morning ... how many sugars do you take in your coffee ... and what was your name again?"
coming soon: situations to avoid #38: "...and the dog was there too?"
|
|
|
|
|
|
thx 4 help!!!!!
thx Michi
|
|
|
|
|
want to load arrays and display arrays that will have numbers 1-25 in this format
1 2 3 4 5
6 7 8 9 10
11 12 13 and so on...
i have got 2 functions
i will load arrays n second will display
[code]
void loadArray()
{
int r, c, cnt=1;
for( r=0; r<5; r++ )
for( c=0; c<5; c++ )
data[r][c] = cnt++;
}
void displayArray( )
{
int r, c, temp;
cout << "The 5 x 5 2D array:\n\n";
for (r=0;r<5;r++)
{
for(c=0;c<5;c++)
{
cout << " " << data[r][c];
}
}
displayArray();
getchar();
pause();
}
i want to display arrays when ever i call func DisplayArrays();
|
|
|
|
|
what is the part that is not working properly?
|
|
|
|
|
I made just a couple of very minor tweaks to your code to do what I think you're asking for. If this isn't what you want, then you'll need to be more specific as to the exact problem you're having.
Code
#include "iostream.h"
int data[5][5];
void loadArray()
{
int r, c, cnt=1;
for( r=0; r<5; r++ )
for( c=0; c<5; c++ )
data[r][c] = cnt++;
}
void displayArray( )
{
int r, c;
cout << "The 5 x 5 2D array:\n\n";
for (r=0;r<5;r++)
{
for(c=0;c<5;c++)
{
int value = data[r][c];
cout << " " << ((10 > value) ? " " : "") << value;
}
cout << "\n";
}
}
void _tmain(int argc, _TCHAR* argv[])
{
loadArray();
displayArray();
int i;
cin >> i;
}
Output
The 5 x 5 2D array:
1 2 3 4 5
6 7 8 9 10
11 12 13 14 15
16 17 18 19 20
21 22 23 24 25
Cheers,
Tom Archer
Author, Inside C#
Author, Visual C++.NET Bible
A total abstainer is one who abstains from everything but abstention, and especially from inactivity in the af
|
|
|
|
|
Hi Tom, why don't you use ISO C++?
I mean #include <iosteam>
Maxwell Chen
People say "No news is good news". Then, no code is good code!?
|
|
|
|
|
|
Hi,
inside a method I need to know the current width of my listbox. thx for help!
CClientDC dc(this);
int nSave = dc.SaveDC();
CRect rect;// and now?
...
dc.RestoreDC(nSave);
|
|
|
|
|
GetWindowRect should work for you
Cheers,
Tom Archer
Author, Inside C#
Author, Visual C++.NET Bible
A total abstainer is one who abstains from everything but abstention, and especially from inactivity in the af
|
|
|
|