|
I know that creating controls in wm_paint is bad and crazy and waw.
Each shape on the dialog has a button (drawn inside the shape) to do some action on the shape.
but lets suppose that i have one shape now, and i created its button outside the wm_paint.
now in run_time the user will add new shape,
but how i ll create a new button to associate with the new shape?
|
|
|
|
|
|
I suggestion
Use HWND hwnd[20];
if user will add new shape then user use WM_LBUTTONDOWN
and you can then create button if you need use handle button in the onpaint
|
|
|
|
|
I think you need to re-think your design; you simply cannot create controls in the OnPaint.
in your main view, you will draw an OBJECT.
that OBJECT will be a class ( CWnd derived ) that will take care of creating/owning its Button and drawing the shape.
for example, a rough implementation :
class CButtonShape : public CWnd
{
DECLARE_DYNAMIC(CButtonShape)
CBrush m_Brush;
CButton m_Button;
public:
CButtonShape();
virtual ~CButtonShape();
protected:
DECLARE_MESSAGE_MAP()
public:
afx_msg void OnPaint();
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
};
and use the view to create and display that class ( or many as you wish ).
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Hi all,
Do anybody know why the font size is normally said as 8, 10, 12, 14, 16, 18, 20, 24, 36, 48, etc?
Is there any speciality for these numbers?
- NS -
|
|
|
|
|
|
This is a new knowledge to me.
Thanks a lot.
- NS -
|
|
|
|
|
I am displaying the directories and files in ListView on clicking the treeview node.But on clicking the listview item
it does not shows the subitems in listview.
Can somebody please send the any link or code ?
|
|
|
|
|
|
How to test TCP/IP connection on the client-side? Some software needed (Win32).
Thanks
Rose
|
|
|
|
|
I like this tool: http://www.protodevelopment.com/en/index.html
|
|
|
|
|
|
Hi friends
Please look at following questions.
1) Can I get list of printers and print servers from active directory. If yes how?
2) Can I monitor printer jobs for a shared printer installed on some different machine.
3) Can I abort above kind of jobs
4) Can I modify above kind of printer jobs and add watermark or user name?
Thanx
VikramS
|
|
|
|
|
i'm using fread to read a file ,and get all the characters in file into a buffer.
char buffer1[nfilelength];
numread=fread(buffer,sizeof(char),1,"text1.txt");
then when i compile, an error occured need me to put a constant integer in declaration of char buffer[], how can i do coz the file length is dynamic.
HelpMe
|
|
|
|
|
Allocate buffer1 with new.
And don't forget to delete it, later.
|
|
|
|
|
rather than putting nfilelength in buffer1[] put some value say buffer1[512]
never say die
|
|
|
|
|
To specify an array with dynamic size, you should allocate it dynamically.
eg.
char* buffer1 = new char[nfilelength];
// read the file.
// do other thing that you need.
delete [] buffer1;
But I think there is a logical mistake in your code. You read only one char from the file using fread. If you intended to do so then you don't have to give any array.
If not you should specify the size as nfilelenght or sizeof(char)*nfilelength instead of sizeof(char).
- NS -
|
|
|
|
|
What is the difference between ItemExpanding and ItemExpanded in treeview ?
Thanks
|
|
|
|
|
pankajgarg12 wrote: What is the difference between ItemExpanding and ItemExpanded in treeview ?
MSDN has explained the difference quite nicely.
Nibu thomas
Software Developer
|
|
|
|
|
|
TVN_ITEMEXPANDING is sent before the expand/collapse happens, and gives you the chance to prevent the change. TVN_ITEMEXPANDED is sent after.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
IF i have a array which contains the color values then how to create a bit map using that array.
eg. unsigned char Arr[ROW][COL][3];
Arr contain Row*Col*RQuad valus;
then i create a BITMAPFILEHEADER, and BITMAPINFOHEADER
and these two a erite into a file, then i face aproblem how to write a color value in file so that .bmp file will generate.
Thanks in advance
Rahul here
|
|
|
|
|
these days I also concerned how to operate bitmap,I think you can down a bitmap operation project to learning,you can learn it frome the "Save as" menu respond function.Good luck!
|
|
|
|
|
Hi,
I am working with vc++. I need to write an excel file with the below format in VC++.
Events Table - 1st row
Description of table - 2nd row
Date&Time,Source,Cause,Description,Fault - 3rd row
Mar 13 2006 12:25:05.000078,HMI,H-0001,Startup,N
Mar 13 2006 12:25:05.000187,HMI,H-0005,Caution,Y
Basically the first row in the excel file must have the table heading, second row must have the table description and the third row will have the column names and fourth row onwards the actual data.
I am able to create an excel file if all the rows have the same number of columns.
But I am unable to create an excel file with different numberof columns in the rows as shown above.
I am using the CSpreadSheet class from codeproject website:
http://www.codeproject.com/database/cspreadsheet.asp
but this class is not allowing to write data in the above format..
Can anyone please help me to do this.
Thanks
Madhavi.
|
|
|
|
|
Just a thought, why don't you use 5 columns for all lines?
I.e:
Line 1: "Events Table", " ", " ", " ", " "
Line 2: "Description of table", " ", " ", " ", " "
Line 3: "Date&Time","Source","Cause","Description","Fault"
"If you can't beat them, join them"...
|
|
|
|