Directing Window Ouput
-
Hey Guys I have a CView dirived class i am using as my main view in an MDI application and i have a CWnd derived class which is a control i am writing how do i get the control to be drawn inside the CView Class i have tried BeginPaint and Print with no luck. At the moment i create the control in the create part of the CView and then check for a safe handle in the paint of teh cview before calling BeginPaint of the control which doesn't work. Cheers Peter
-
Hey Guys I have a CView dirived class i am using as my main view in an MDI application and i have a CWnd derived class which is a control i am writing how do i get the control to be drawn inside the CView Class i have tried BeginPaint and Print with no luck. At the moment i create the control in the create part of the CView and then check for a safe handle in the paint of teh cview before calling BeginPaint of the control which doesn't work. Cheers Peter
If you have created you CWnd derived control as a chile window of the CView, then as long as its visible and withoin the CView's client area then it should appear. Make sure when creating the control that the WS_CHILD and WS_VISIBLE style have been set. For example, in one of my apps, I create a list of controls like this:
m\_Log.Create("Log window", WS\_CHILD | WS\_VISIBLE | SS\_SUNKEN | SS\_CENTERIMAGE | SS\_NOTIFY| WS\_CLIPSIBLINGS, CRect(10, 10, 100, 100), this, IDC\_EDIT1) ; m\_WhizWheel.Create("Wheel", WS\_CHILD | WS\_VISIBLE | SS\_BITMAP | SS\_NOTIFY | WS\_CLIPSIBLINGS, CRect(0, 0, 20, 20), this, IDC\_WHIZ\_WHEEL) ; m\_WhizWheel.SetBitmap(m\_WheelBitmap\[m\_BitmapIndex\]) ; m\_TrayProgress.Create(WS\_CHILD | WS\_VISIBLE | PBS\_SMOOTH | SS\_NOTIFY | WS\_CLIPSIBLINGS, CRect(10, 10, 15, 100), this, IDC\_TRAY\_PROGRESS) ; m\_SampleProgress\[0\].Create(WS\_CHILD | WS\_VISIBLE | PBS\_SMOOTH | SS\_NOTIFY | WS\_CLIPSIBLINGS, CRect(20, 10, 25, 100), this, IDC\_SAMPLE\_PROGRESS1) ; m\_SampleProgress\[1\].Create(WS\_CHILD | WS\_VISIBLE | PBS\_SMOOTH | SS\_NOTIFY | WS\_CLIPSIBLINGS, CRect(20, 10, 25, 100), this, IDC\_SAMPLE\_PROGRESS2) ; m\_SampleProgress\[2\].Create(WS\_CHILD | WS\_VISIBLE | PBS\_SMOOTH | SS\_NOTIFY | WS\_CLIPSIBLINGS, CRect(20, 10, 25, 100), this, IDC\_SAMPLE\_PROGRESS3) ; m\_SampleProgress\[3\].Create(WS\_CHILD | WS\_VISIBLE | PBS\_SMOOTH | SS\_NOTIFY | WS\_CLIPSIBLINGS, CRect(20, 10, 25, 100), this, IDC\_SAMPLE\_PROGRESS4) ; m\_ValveStatus.Create("?", WS\_CHILD | WS\_VISIBLE | SS\_NOTIFY | WS\_CLIPSIBLINGS, CRect(0, 0, 15, 15), this, IDC\_VALVE\_LED) ; m\_DadStatus.Create("?", WS\_CHILD | WS\_VISIBLE | SS\_NOTIFY | WS\_CLIPSIBLINGS, CRect(0, 0, 15, 15), this, IDC\_DAD\_LED) ; m\_LampStatus.Create("?", WS\_CHILD | WS\_VISIBLE | SS\_NOTIFY | WS\_CLIPSIBLINGS, CRect(0, 0, 15, 15), this, IDC\_LAMP\_LED) ; m\_DeviceStatus\[0\].Create("?", WS\_CHILD | WS\_VISIBLE | SS\_NOTIFY | WS\_CLIPSIBLINGS, CRect(0, 0, 15, 15), this, IDC\_DEVICE1\_LED) ; m\_DeviceStatus\[1\].Create("?", WS\_CHILD | WS\_VISIBLE | SS\_NOTIFY | WS\_CLIPSIBLINGS, CRect(0, 0, 15, 15), this, IDC\_DEVICE2\_LED) ;
I then later on use MoveWindow() on each of the controls to place them exactly where I want them to be. Roger Allen Sonork 100.10016 I think I need a new quote, I am on the prowl, so look out for a soft cute furry looking animal, which is really a Hippo in disguise. Its probably me.