 |
|
 |
Hi,
if you replace the
dc.DrawIcon(m_nIconOffset,m_nIconOffset,m_hIcon);
line in OnPaint() with
::DrawIconEx(dc, m_nIconOffset, m_nIconOffset, m_hIcon, 0, 0, NULL, NULL, DI_NORMAL);
you can use icon sizes that exceed the OnDraw() 32x32 pixel limit. Your call to SetIconHandle() should look like this:
SetIconHandle((HICON)LoadImage(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_YOUR_ICON_RESOURCE_HERE), IMAGE_ICON, 48, 48, LR_DEFAULTCOLOR));
This would display a 48x48 pixel icon. To use your icon's default size, replace both the x and y size (48 in this example) with 0.
Enjoy the show,
--j
-----------------------------------------
There are three kinds of people:
Those who can count and those who cannot.
|
|
|
|
 |
|
 |
What license do I have to respect when using it in commercial applications?
Greetings...
|
|
|
|
 |
|
 |
您的程序太好了,谢谢.
Thanks.
|
|
|
|
 |
|
 |
Hi,
I liked your article. It helped me a lot. I got a simple query, how to make this propertysheet as a stand alone application like a dialog.
Thanks & Regards,
Satyam Kumar.
Make your self a void pointer so that you can type cast it every data type.
|
|
|
|
 |
|
 |
Hi,
I got the answer.
Thanks & Regards,
Satyam Kumar.
Make your self a void pointer so that you can type cast it every data type.
|
|
|
|
 |
|
 |
While I use it in the CFormView, the header didn't appear,
Why?
Can you help me?
thanks
|
|
|
|
 |
|
 |
Probably you may have find the solution now. Override the OnInitialUpdate() like this
void CMembersView::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
// TODO: Add your specialized code here and/or call the base class
m_HeaderCtrl.SetTitleText("Add New Member");
m_HeaderCtrl.SetDescText("Add a new member.");
m_HeaderCtrl.SetIconHandle(AfxGetApp()->LoadIcon(IDI_ICONMEMBERS));
m_HeaderCtrl.Init(this);
m_HeaderCtrl.MoveCtrls(this);
}
"We don't see things how they are. We see things as we are." -Talmud
-- modified at 6:53 Thursday 20th April, 2006
|
|
|
|
 |
|
 |
Hi,
Please let me know how to use this class with wizard type taking place of tap type
|
|
|
|
 |
|
 |
Can anybody tell me how to align the property sheet vertically.
Thanks...
|
|
|
|
 |
|
 |
MFC allows you to specify title, subtitle and icon in CPropertyPage::m_psp.
By altering the CMyPropertyPage::AddPage to:
void CMyPropertySheet::AddPage(CPropertyPage* pPage)
{
//Variables
PSHEETITEM psItem;
//Add page to property sheet
CPropertySheet::AddPage(pPage);
//Add blank item to array
if (m_bHeaderCtrl)
{
// HACK: get settings from original property page
PSHEETITEM sheetItem = GetDefaultPSItem();
sheetItem.sTitle = pPage->m_psp.pszHeaderTitle;
sheetItem.sDesc = pPage->m_psp.pszHeaderSubTitle;
sheetItem.hIcon = pPage->m_psp.hIcon;
m_aTabItems.Add(sheetItem);
}
}
you can now set the title, subtitle and icon within CPropertyPage's constructor like this:
CPPSettingsConnection::CPPSettingsConnection()
: CPropertyPage(CPPSettingsConnection::IDD)
{
m_psp.pszHeaderTitle = "Internet connection";
m_psp.pszHeaderSubTitle = "Choose your internet connection settings";
m_psp.hIcon = AfxGetApp()->LoadIcon( IDI_SETTINGS );
}
|
|
|
|
 |
|
 |
if you set DEFAULTHEADERHEIGHT to 65 , the size is not vary diffeent but it be possible to have 3 lines of text..
if you change this:
void CDialogHeader::OnPaint()
{
...
//old
text.top=rect.top + m_nIconOffset;
//new
text.top=rect.top + m_nIconOffset - ((m_sTitle=="")?15:0);
...
}
it is possible to have 4 lines of text if no title is provided
thanks once again
MSN:maxsnts@hotmail.com
|
|
|
|
 |
|
|
 |
|
 |
We can do this by adding blow codes into the class CDialogHeader:
a:Add two member variables
protected:
.
.
COLORREF m_cText;
COLORREF m_cDisc;
b:Add a member function:
void CDialogHeader::SetFontColors(const COLORREF Text, const COLORREF Disc)
{
m_cText=Text;
m_cDisc=Disc;
//Force update of fonts in the OnPaint handler
m_bFonts=FALSE;
//Repaint the header
RepaintHeader();
}
c: add tow lows in "void CDialogHeader::OnPaint()"
{
.
.
SetTextColor(dc.m_hDC,m_cText); //Add
DrawText(dc.m_hDC,m_sTitle,m_sTitle.GetLength(),text,
m_uAlign | DT_WORDBREAK | DT_END_ELLIPSIS | DT_EDITCONTROL);
.
.
SetTextColor(dc.m_hDC,m_cDisc); //Add
DrawText(dc.m_hDC,m_sDesc,m_sDesc.GetLength(),text,
m_uAlign | DT_WORDBREAK | DT_END_ELLIPSIS | DT_EDITCONTROL);
.
.
}
d:Now you can set text color by call the function "SetFontColors(RGB(..),RGB(..))" in you program.
MayBe there are more easy ways to do this ,pls post to me.Thanks!
|
|
|
|
 |
|
|
 |
|
 |
Please let me know if something like this is also
available for a CFormView.
Sincerely,
Danielle (an overworked graduate student)
|
|
|
|
 |
|
 |
hi i used this great piece of software within my code however, i cannot seem to get the icon to appear int he header dialog box for some strange reason Could anyone help me with this issue??
Kindest Regards
Matt
|
|
|
|
 |
|
 |
what icon are you using?
system icon or one of your own?
I think system icons will not appear.
MSN:maxsnts@hotmail.com
|
|
|
|
 |
|
 |
thank for this code !.
this dialog header could be dialog footer but add some code;
modify Init(void* ptrWnd) --> Init(void* ptrWnd, bool isTop)
just modify a little bit code:
if(isTop)
{
pWnd->SetWindowPos(NULL,0,0,rect.Width(),rect.Height() + m_nHeaderHeight,
SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
//Create the header window
CreateEx (NULL,NULL,NULL,WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_BORDER,
-1,-1,rect.Width(),m_nHeaderHeight,pWnd->m_hWnd,0,0);
}
else
{
pWnd->SetWindowPos(NULL,0,0,rect.Width(),rect.Height(),
SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
CreateEx(NULL,NULL,NULL,WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_BORDER,
-1,rect.bottom - m_nHeaderHeight ,rect.Width(),m_nHeaderHeight,pWnd->m_hWnd,0,0);
}
then call this function
Init(this,false); //false for footer and true for header
for Dialog Footer do not call this function
MoveCtrls(this)
Mohd Alwi
|
|
|
|
 |
|
 |
Hi,
Excellent work.
How would you go about adding a bitmap as the background to the Header.
Thanks in Advance.
|
|
|
|
 |
|
 |
How do I replace the bland background with a bitmap ?
|
|
|
|
 |
|
|
 |
|
 |
Hi, I'm going to use your class in my code, but I added this piece of code which makes it much more good looking:
Instead of drawing a plain rectangle, I draw a gradient rectangle: (code taken from a sample in the msdn)
TRIVERTEX vert[2] ;
GRADIENT_RECT gRect;
vert [0] .x = rect.left;
vert [0] .y = rect.top;
vert [0] .Red = 0x0000;
vert [0] .Green = 0x0000;
vert [0] .Blue = 0x6600;
vert [0] .Alpha = 0x0000;
vert [1] .x = rect.right;
vert [1] .y = rect.bottom;
vert [1] .Red = 0xff00;
vert [1] .Green = 0xff00;
vert [1] .Blue = 0xff00;
vert [1] .Alpha = 0x0000;
gRect.UpperLeft = 0;
gRect.LowerRight = 1;
dc.GradientFill(vert,2,&gRect,1,GRADIENT_FILL_RECT_H);
|
|
|
|
 |
|
 |
HOW to make text background transperent.
When text is getting displayed,it has gray background if I don't call FillSolidrect with white color.
And if call FillSoildRect with white color befor your suggested code, text has white background.
Is there any better solution is there.
By the way.
In order to use GradientFill, we need to include following two files.
Wingdi.h, Windows.h
and also msimg32.lib need to include in link option.
Thanks in advance.
|
|
|
|
 |
|
 |
Try adding these two lines in the CDialogHeader OnPaint handler.
Add them right before the dc.FillSolidRect.
//New code
dc.SetBkColor(m_cBackground);
dc.SetBkMode(TRANSPARENT);
//New code
//Old code
//Fill the rect with solid color
//Leaving space for line at bottom of rect
dc.FillSolidRect(rect.left,rect.top,rect.Width(),rect.Height() - m_nxEdge,
m_cBackground);
I'm using win XP with themes and all so I don't have this prob. but I'm sure other people will.
So, Try this and please let me know if that works. Thanks
|
|
|
|
 |
|
 |
It works
Once again thanks.
|
|
|
|
 |