|
how did you fix this bug?
|
|
|
|
|
vjairamDoes any have fix for this
|
|
|
|
|
Hi
The XP-style Button Control is fine, the problem is, only the Buttons show in XP-style, but what bout the other controls like the Edit box, List controls and other dialog box controls, they are still in the old style...
Can anyone tell me how to change the other controls to XP-style, so that the dialog box doesn't looks odd.
Thanks and Regards
Manoj Singh
|
|
|
|
|
If I create XP buttons in my own workspace I can't see the buttons but I can click on it. What's wrong?
|
|
|
|
|
void yourbuttonclass::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
...
GetWindowText(strText);
CFont* oldFont = pDC->SelectObject(GetParent()->GetFont());
...
pDC->SelectObject(oldFont);
return;
}
|
|
|
|
|
void yourbuttonclass::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
...
GetWindowText(strText);
CFont* oldFont = pDC->SelectObject(GetParent()->GetFont());
...
pDC->SelectObject(oldFont);
return;
}
|
|
|
|
|
I found a little bug in this control; here's what I changed:
1) i did not want the BOLD font, so used another font, but that's personal...
2) if you use '&Ok' to underline the O of 'Ok', it works okay for disabled buttons, not for enabled. This code fixes that bug.
Ivo
// Draw the text
if (!m_title.IsEmpty()/*!strText.IsEmpty()*/)
{
CFont *oldFont=(CFont*)pDC->SelectStockObject(DEFAULT_GUI_FONT);
CString displayName=m_title;
displayName.Remove('&');
CSize Extent = pDC->GetTextExtent(displayName/*strText*/);
CPoint pt( rect.CenterPoint().x - Extent.cx/2,
rect.CenterPoint().y - Extent.cy/2 );
if (state & ODS_SELECTED)
pt.Offset(1,1);
int nMode = pDC->SetBkMode(TRANSPARENT);
//pOldPen = pDC->SelectObject(pBoundryPen);
//CFont *pOldFont = SelectStockFont( pDC );
if (state & ODS_DISABLED)
pDC->DrawState(pt, Extent, m_title/*strCaption*/, DSS_DISABLED, TRUE, 0, (HBRUSH)NULL);
else
pDC->DrawState(pt, Extent, m_title/*strCaption*/, DSS_NORMAL, TRUE, 0, (HBRUSH)NULL);
//pDC->TextOut(pt.x, pt.y, m_title/*strCaption*/);
//pDC->SelectObject(pOldPen);
//pDC->SelectObject(pOldFont);
pDC->SetBkMode(nMode);
pDC->SelectObject(oldFont);
}
|
|
|
|
|
|
I can find a lot of CXPButton, CButtonXP, CWinXPButton...
but I cannot find the CXPEdit or CEditXP except WTL
|
|
|
|
|
I like the button style but I want to set buttons to different initial color states. The pushed state or hover state can be common to all buttons.
Bob
|
|
|
|
|
hi, is you your button class accept Icons if yes tell me hwo???
please reply,
Thanks,
Bye
liquid
|
|
|
|
|
|
I compile the project and i don´t know how to change font, can you help me?
thanks
|
|
|
|
|
|
Ok, I forgot it, I´m trying to learn Visual c++, I'm not very experimented with the Functions, so could you give me an example, p.ex. with the font MS Sans Serif?
|
|
|
|
|
m_buttonctrl.SetFont(...) doesn't look to work
The following code perfectly works with CButton and doesn't with CXPButton:
CFont *pFont = new CFont;
pFont->CreateFont( 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "Tahoma");
m_btn1.SetFont(pFont, TRUE);
|
|
|
|
|
Try declairing pFont as a member variable or global, as the code above will become invalid / out of scope as soon as your function ends.
I feel like I'm diagonally parked in a parallel universe
Jerry Davis
http://www.astad.org http://www.jvf.co.uk
|
|
|
|
|
To change the XPButton font in the class (for all buttons):
1) In CXPButton.h add bold lines.
class CXPButton : public CButton
{
DECLARE_DYNCREATE(CXPButton)
// Construction
private:
CFont pFont;
public:
CXPButton();
2) In CXPButton.cpp, add bold lines:
CXPButton::CXPButton()
{
pBoundryPen.CreatePen(PS_INSIDEFRAME|PS_SOLID,1,RGB(0,0,0));
pInsideBoundryPenLeft.CreatePen(PS_INSIDEFRAME|PS_SOLID,3,RGB(250,196,88));
pInsideBoundryPenRight.CreatePen(PS_INSIDEFRAME|PS_SOLID,3,RGB(251,202,106));
pInsideBoundryPenTop.CreatePen(PS_INSIDEFRAME|PS_SOLID,2,RGB(252,210,121));
pInsideBoundryPenBottom.CreatePen(PS_INSIDEFRAME|PS_SOLID,2,RGB(229,151,0));
pFillActive.CreateSolidBrush(RGB(222,223,236));
pFillInactive.CreateSolidBrush(RGB(222,223,236));
pInsideBoundryPenLeftSel.CreatePen(PS_INSIDEFRAME|PS_SOLID,3,RGB(153,198,252));
pInsideBoundryPenTopSel.CreatePen(PS_INSIDEFRAME|PS_SOLID,2,RGB(162,201,255));
pInsideBoundryPenRightSel.CreatePen(PS_INSIDEFRAME|PS_SOLID,3,RGB(162,189,252));
pInsideBoundryPenBottomSel.CreatePen(PS_INSIDEFRAME|PS_SOLID,2,RGB(162,201,255));
pFont.CreateFont(14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "Arial");
m_bOverControl = m_bTracking = m_bSelected = Focus = 0;
}
CXPButton::~CXPButton()
{
// TODO: Cleanup your control's instance data here.
pBoundryPen.DeleteObject();
pFillActive.DeleteObject();
pFillInactive.DeleteObject();
pFont.DeleteObject();
pInsideBoundryPenLeft.DeleteObject();
pInsideBoundryPenRight.DeleteObject();
pInsideBoundryPenBottom.DeleteObject();
pInsideBoundryPenTop.DeleteObject();
pInsideBoundryPenLeftSel.DeleteObject();
pInsideBoundryPenTopSel.DeleteObject();
pInsideBoundryPenRightSel.DeleteObject();
pInsideBoundryPenBottomSel.DeleteObject();
}
void CXPButton::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
...
// Draw the text
if (!m_title.IsEmpty()/*!strText.IsEmpty()*/)
{
CFont *pOldFont = pDC->SelectObject(&pFont);
// Don't draw ambersands meant for hotkeys.
m_title.Replace("&", "");
CSize Extent = pDC->GetTextExtent(m_title/*strText*/);
CPoint pt( rect.CenterPoint().x - Extent.cx/2,
rect.CenterPoint().y - Extent.cy/2 );
if (state & ODS_SELECTED)
pt.Offset(1,1);
int nMode = pDC->SetBkMode(TRANSPARENT);
if (state & ODS_DISABLED)
pDC->DrawState(pt, Extent, m_title/*strCaption*/, DSS_DISABLED, TRUE, 0, (HBRUSH)NULL);
else
pDC->TextOut(pt.x, pt.y, m_title/*strCaption*/);
pDC->SelectObject(pOldFont);
pDC->SetBkMode(nMode);
}
}
-- modified at 14:20 Thursday 13th October, 2005
|
|
|
|
|
Anyone know how to use this with PropertySheets?
|
|
|
|
|
how about this:
CXPButton m_butOK;
CXPButton m_butCancel;
In OnInitDialog() of PropertySheet drived class add:
m_butOK.SubclassDlgItem(IDOK, this);
m_butCancel.SubclassDlgItem(IDCANCEL, this);
|
|
|
|
|
SubclassWindow() no effect! I use it by WTL...Help
|
|
|
|
|
Hi, can this cool button program be converted to a dll to work with vb.net? I'm not good at c++ and was wondering if anyone has converted it?
Thanks
|
|
|
|
|
VB.NET already supports XP buttons, just place a normal button on a form and set the button's FlatStyle to system. (Of course you need to add a manifest to your project for it to use XP themes)
--------------------------------
Mladen Mihajlovic
|
|
|
|
|
But what if you wanted to use the control in an app that runs on 2k and you build it with .NET? I've been searching for a control that will do just that .. anyone found one (or developed one)?
TIA!
M.
|
|
|
|
|
I downloaded the small demo ZIP file for your program and tried to compile it. It fails to do so. It seems as if a file named dlg.rc is is missing from your ZIP file. Can you provide an update with that file?
MJK
|
|
|
|
|