|
Google!!!!
tut1[^]
tut2[^]
sometimes it helps to look at the IL generated code
a MS guy on develop.com "answering" .NET issues
|
|
|
|
|
How can I add a background image to a CTreeCtrl (tree control)?
--
Nice greets, Daniel.
|
|
|
|
|
I think the only way is to subclass CTreeCtrl and then override OnEraseKkgnd(...)
Then you can paint your own picture as background!
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
Thanks!
--
Nice greets, Daniel.
|
|
|
|
|
hi all,,,
i have a text file to be passed on to a text area inside a frame....i have used FramesCollection to get the frame handles...could u plz help me in finding a way of passing the text...
|
|
|
|
|
I have been looking for a FormView bitmap class. Does anyone know if it exists? I have found Dialog and even MDI Background classes, but no FormView. Thank you for your help.
Darroll
Not one person lives in the present. Only the past. I can prove it.
|
|
|
|
|
OK I finnally found the " More results from ..." on Google and found one. If you have a favorite, or great success with one please let me know. No saying this one I found works.
Update. Ok that was an aweful experiance. I am still looking. If you can help please do.
|
|
|
|
|
Darroll wrote:
I have found Dialog
I think for Formview is the same way as Dialog.
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
It should work in the same way as a CDialog derived class, override the WM_ERASEBKGND message handler.
Michael
"Time and tide melts the snowman."
-- The Doctor (Doctor Who: Time and the Rani
|
|
|
|
|
hey guys,
i need to place a bitmap on a dialog using StretchBlt() function.
can u give me an example for that...
thanx,
Kapil
Regards,
Kapil
|
|
|
|
|
You simply do it in WM_ERASEBKGND, or whatever it is. Are you loading from resources, or from disk ? Where are you stuck ?
Christian
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
I'm trying to write a dialog based application that has a tab control but I'm having trouble figuring out how to add the 'pages' to the tabs. It's my understanding that I can create the tabs at design time using the resoure editor but then how do I add the tabs to a tab control? The only function I could find was CTabCtrl::InsetItem but none of it's overloads take a resoure ID, so I guess my question is how do I take a resource defined dialog and add it to a tab control?
Any help on this would be very much appreciated.
- monrobot13
|
|
|
|
|
The "tab" that you add to a tab control is not the same as the property page added to a property sheet. Tab control tabs are just the "top" part of the property sheet.
To simulate the behavior of a property sheet, you'll need to create a modeless dialog for each page, and show the appropriate dialog (and hide the others) at the proper time. The tab control notifies you when a new tab is selected. A couple of things to remember:- Set the tab control's "transparent" bit (in the resource editor) to true.
- Call
BringWindowToTop() followed by SetFocus() to properly show the selected modeless dialog. This may sound like a lot of work but it's not. Using a CTabCtrl and modeless dialogs gives you more control than using a modeless CPropertySheet and CPropertyPage s.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Have you any sample application?
--
Nice greets, Daniel.
|
|
|
|
|
|
Hi Daniel,
I don't have a sample app, but can email you a code fragment if you like. I'll need your email address.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Here's the fragment I emailed you - hotmail mail has recently been bouncing and I wasn't sure if you'd get my reply.
CDlgHolding represents a tabbed dialog that can display 3 types of holdings (stock, cash and margin debt). Each type is represented by a modeless dialog. CDlgHolding contains a tab control, creates the modeless dialogs, and shows the appropriate one based on the user's selection. Here's a screenshot[^].
BEGIN_MESSAGE_MAP(CDlgHolding, CDialog)
ON_NOTIFY(TCN_SELCHANGE, TAB_CTRL, OnTabSelected)
END_MESSAGE_MAP()
BOOL CDlgHolding::OnInitDialog()
{
CDialog::OnInitDialog();
CTabCtrl* pTabCtrl = (CTabCtrl *) GetDlgItem (TAB_CTRL);
ASSERT (pTabCtrl != NULL);
pTabCtrl->InsertItem (0, " Stock Holding ");
pTabCtrl->InsertItem (1, " Cash Holding ");
pTabCtrl->InsertItem (2, " Margin Debt ");
VERIFY (m_dlgStockHolding.Create (IDD_STOCK_HOLDING, this));
VERIFY (m_dlgCashHolding.Create (IDD_CASH_HOLDING, this));
VERIFY (m_dlgMarginHolding.Create (IDD_MARGIN_HOLDING, this));
updateTabSelection();
m_dlgStockHolding.SetFocus();
return FALSE;
}
void CDlgHolding::OnTabSelected
(NMHDR* pNMHDR, LRESULT* pResult)
{
CTabCtrl* pTabCtrl = (CTabCtrl *) GetDlgItem (TAB_CTRL);
ASSERT (pTabCtrl != NULL);
long nCurrentTab = pTabCtrl->GetCurSel();
m_dlgStockHolding.ShowWindow (SW_HIDE);
m_dlgCashHolding.ShowWindow (SW_HIDE);
m_dlgMarginHolding.ShowWindow (SW_HIDE);
CWnd* pWndCurrentTab = NULL;
switch (nCurrentTab) {
case 0:
pWndCurrentTab = &m_dlgStockHolding;
break;
case 1:
pWndCurrentTab = &m_dlgCashHolding;
break;
case 2:
pWndCurrentTab = &m_dlgMarginHolding;
break;
default:
ASSERT (FALSE);
break;
}
if (pWndCurrentTab != NULL) {
CRect rectCtrl;
GetDlgItem (FRAME_TAB_DIALOG)->GetWindowRect (&rectCtrl);
ScreenToClient (&rectCtrl);
pWndCurrentTab->MoveWindow (&rectCtrl, TRUE);
pWndCurrentTab->ShowWindow (SW_SHOW);
pWndCurrentTab->Invalidate();
pWndCurrentTab->UpdateWindow();
pWndCurrentTab->BringWindowToTop();
pWndCurrentTab->SetFocus();
}
*pResult = 0;
}
Hope this helps!
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Thanks for the example Ravi it helped out quite a bit. I just have two questions, in the statement:
GetDlgItem (FRAME_TAB_DIALOG)->GetWindowRect (&rectCtrl) what is FRAME_TAB_DIALOG ? Also I noticed that your always simply getting a pointer to the tab control instead of having a member variable for it, is getting a pointer better than using a member variable?
Thanks again.
- monrobot13
|
|
|
|
|
FRAME_TAB_DIALOG is just a static frame control I use to position the modeless dialogs. Because the control's visible style is "false", it doesn't interfere with the display but yet gives me a good idea of where the modeless dialogs will appear when I'm in the resource editor.
monrobot13 wrote:
is getting a pointer better than using a member variable?
No - actually what I'm doing is slightly more inefficient. Imho, it's better to relate a member variable (of class CTabCtrl ) with the tab control rather than calling GetDlgItem() and doing the cast. It's just a habit. A bad one.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Thanks again Ravi, your help has been very much appreciated.
- monrobot13
|
|
|
|
|
Glad to be of help!
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Hey Again,
I've finally tried implementing your CTabCtrl example and I'm having some trouble with it. I've implemented the code that you sent me but it still isn't working. The dialog with the tab control will load up and show the tab that I inserted, but it wont show the dialog that's supposed to be on the tab. Here's my OnInitDialog function:
BOOL CDataManDlg::OnInitDialog()
{
CDialog::OnInitDialog();
m_tabData.InsertItem (0, " Media Sales ");
m_tabData.InsertItem (1, " Temp Garbage ");
VERIFY (m_dlgSales.Create (IDD_MEDIASALES_DIALOG, this));
m_dlgSales.SetFocus ();
return FALSE;
} I added a bogus tab so that I could test the TCN_SELCHANGE handler and when I click onto the first tab it creates the dialog but it's not inside the tab control, it's way off to the side. Here's my TCN_SELCHANGE handler:
void CDataManDlg::OnTabSelected(NMHDR* pNMHDR, LRESULT* pResult)
{
int nCurrentTab = m_tabData.GetCurSel ();
m_dlgSales.ShowWindow (SW_HIDE);
CWnd* pWndCurrentTab = NULL;
switch (nCurrentTab) {
case 0:
pWndCurrentTab = &m_dlgSales;
break;
case 1:
break;
default:
ASSERT (FALSE);
break;
}
if (pWndCurrentTab != NULL) {
CRect rectCtrl;
GetDlgItem (FRAME_TAB_DIALOG)->GetWindowRect (&rectCtrl);
ScreenToClient (&rectCtrl);
pWndCurrentTab->MoveWindow (&rectCtrl, TRUE);
pWndCurrentTab->ShowWindow (SW_SHOW);
pWndCurrentTab->Invalidate ();
pWndCurrentTab->UpdateWindow ();
pWndCurrentTab->BringWindowToTop ();
pWndCurrentTab->SetFocus ();
}
*pResult = 0;
} I'm just wondering if you could tell what I'm doing wrong here, and would it be possible for you to send me a complete VC6 project?
Thanks again for the help it's been very much appreciated.
-monrobot13
|
|
|
|
|
Man, sorry for so many posting but I'm really trying to get this working. I got the TCN_SELCHANGE handler to work by changing the style of the dialog (that should be in the CTabCtrl ) to child and it's border to none (maybe I'm an idiot for not doing that in the first place) but the dialog still wont show on the initialization. Again any help would be much appreciated.
- monrobot13
|
|
|
|
|
changing the style of the dialog (that should be in the CTabCtrl) to child and it's border to none
Sorry, I should've mentioned that!
the dialog still wont show on the initialization.
The dialog should only show up when the tab selection message is handled.
when I click onto the first tab it creates the dialog but it's not inside the tab control, it's way off to the side.
If it's showing up at a bad location, check the location of the FRAME_TAB_DIALOG static control.
Sorry, but I can't send you a sample VC++ project because I snipped the code I sent you from a much larger codebase.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
I think I got it all working now
Thanks a lot for you help Ravi I don't think I could have got it working without it.
Cheers!
- monrobot13
|
|
|
|