|
VC2010 + CxSkinButton : Button is not displayed! Why? I'm confused!
Thank You!
|
|
|
|
|
Hi,
I'm creating on the fly Check and Radio buttons,
when I use the Radio buttons all the Check buttons switch to uncheck!
It's my fault?
I've changed this function on my code:
//---------------------------------------------------------
LRESULT CxSkinButton::OnRadioInfo(WPARAM /*wparam*/, LPARAM)
{
if (m_Checked){ //only checked buttons need to be unchecked
m_Checked = false;
Invalidate();
}
return 0;
}
//---------------------------------------------------------
LRESULT CxSkinButton::OnRadioInfo(WPARAM /*wparam*/, LPARAM)
{
if (m_Checked && (m_Style==BS_RADIOBUTTON) ) { //only checked buttons need to be unchecked
m_Checked = false;
Invalidate();
}
return 0;
}
Bye,
Max!
|
|
|
|
|
Hi David, Thank you very much for excellent Article.
I found one issue, Tab order is nor working for button, usually when we highlight the control using TAB key particular button should get highlighted(even though Tab stop property set as true).
Can you check and help to resolve the same.
Regards,
Kumar
|
|
|
|
|
In the background of the interface moves the control has a background image of the ghost
|
|
|
|
|
I change demo code
from
m_btn4.SetTextColor(RGB(255,0,0));
m_btn4.SetToolTipText("Button1");
m_btn4.SetSkin(IDB_B1NORM,IDB_B1DOWN,IDB_B1OVER,IDB_B1GRAY,0,IDB_B1MASK,0,0,0);
to
m_btn4.SetSkin(IDB_B1NORM,IDB_B1DOWN,IDB_B1OVER,IDB_B1GRAY,0,0,1,0,0);
but the Background is not transparent, when mask is 0.
if mask is 0, how to make the button's Background is transparent?
Thank you very much.
|
|
|
|
|
When I set draw mode as '1' (stretch mode) and button window bigger than bitmap size, buttons don't work properly if mouse position is out of original bitmap's area. I guess it's caused by CreateRgnFromBitmap function since you don't take into account drawmode to generate buttons' clip regions.
I'm fixing it now, but i still looking for your patch
ghjghjfjgh
|
|
|
|
|
First of all, thx for your great work
I've fixed this issue in my app for years, now but I noticed you haven't fixed it in your most recent release, yet, so I decided to post here:
In CxSkinButton::CreateRgnFromBitmap
delete pRgnData;
should be
delete[] pRgnData;
as it's allocated via new BYTE[...]. This occurs twice.
BR & thx again,
WiZaRd
|
|
|
|
|
I am creating CxSkinButtons on the fly - somethng like following:
<br />
CxSkinButton *myButton = new CxSkinButton(); <br />
myButton->Create(L"", WS_VISIBLE|BS_OWNERDRAW, r2, this, 0);
myButton->SetSkin(....)
The problem I am having is that I am not getting any transparency when I do this. When I create some static buttons (using DDX_Control), then of course transparency works, but now when I am doing dynamic create.
Any ideas? or Hints? I will greatly appreciate if someone can help me.
Cheers
|
|
|
|
|
Okay, I saw that my SelectClipRgn API is returning 0 (in SetSkin menthod). Can anyone tell me how do I debug why SelectClipRgn is failing? I am sure it is something that's trivial.
|
|
|
|
|
Hello,
I compiled/linked your demo program using VS2008.
No dialog is displayed?
Any ideas?
Thanks,
-jc
|
|
|
|
|
I can not add more than one button. It builds and compiles OK but the dialog won't show UP, and the program doesn't start at all.
When I have one button its OK, but when I add one more I can't start the program.
Lex
|
|
|
|
|
Recall SetSkin function should be increase the GDI ,why?
|
|
|
|
|
I hope the other endevors were as rewarding. You must be good in anything you do. Thanks for all the contributions.
|
|
|
|
|
i recently building a mfc regular dll using xSkinButton
but if i use a radio button,
when check one radio button ,the other radio buttons can't automatically
uncheck itself,
who knows why this happen?
how to solve the problem?
thanks a lot!
arlerzhang
life is like a pack of chaocolite
|
|
|
|
|
how can add icon in bitmap?
|
|
|
|
|
I found this really useful, and want to use this in my application !
Can I use this in a commercial application? Does the license permit it ?
|
|
|
|
|
Whenever I Use the Mask Bmp the Button Gets Disabled please help me why button gets Disable when I use Mask image.
m_Button_ScanTool2.SetSkin(IDB_CROP_NORMAL,IDB_CROP_PRESSED,IDB_CROP_HOVER,IDB_CROP_PRESSED,0,IDB_MASK,0,0,0);
|
|
|
|
|
I'd like to automatically map appropriate images according to resource ID. What's the easiest way to get nIDCtl from the subclass?
Is it possible to use:
OnDrawItem(UINT nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)
Instead of:
DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
Or, is there another way that I could try?
Thanks!
|
|
|
|
|
My dialog have 10-20 "CxSkinButton" buttons
And some buttons does now draw text!
In debug version - it's ok
But in release - there are no text on the buttons!
Can anyone help me?
ps Compiled with VC++ 6.0, Windows 98 SE
|
|
|
|
|
My dialog have 10-20 "CxSkinButton" buttons
And some buttons does now draw text!
In debug version - it's ok
But in release - there are no text on the buttons!
Can anyone help me?
ps Compiled with VC++ 6.0, Windows 98 SE
|
|
|
|
|
In xSkinButton.cpp, line 311, change the code as follows:
< dcBmp.SelectObject(hBmp);
> HBITMAP hOldBitmap = (HBITMAP)dcBmp.SelectObject(hBmp);
Then add the following line 356 (just before dcBmp.DeleteDC()):
dcBmp.SelectObject( hOldBitmap );
Otherwise, you will be deleting the DC with the bitmap still selected.
Steve
|
|
|
|
|
There are many other places where SelectObject() needs to store the return value and then select the old object before calling DeleteDC(). Here are a few, but it's best if you simply search for all calls to SelectObject() and DeleteDC().
For example, SelectObject() calls near lines 198, 202, and 207 need to be changed so they store the return value. For example:
HBITMAP hOldBitmap1 = (HBITMAP)hdcMem.SelectObject(hBitmap);
Then you need to deselect the old bitmap just before the calls to DeleteDC() (near lines 225, 228, and 243) by adding code similar to:
hdcMem.SelectObject( hOldBitmap1 );
Steve
|
|
|
|
|
There is still at least one other GDI leak in the SetSkin() method assuming that one will set the skin more than once:
Change the the follwing lines in CxSkinButton::SetSkin(...):
SetWindowRgn(m_hClipRgn, TRUE);
SelectClipRgn((HDC) GetDC(),m_hClipRgn);
to:
SetWindowRgn(m_hClipRgn, TRUE);
CDC *pDC = GetDC();
SelectClipRgn(pDC->GetSafeHdc(), m_hClipRgn);
ReleaseDC(pDC);
to ensure, that the DC is properly released.
modified on Friday, December 19, 2008 3:08 AM
|
|
|
|
|
There's IMO a flaw in CxSkinButton::DrawItem method.
If the CxSkinButton object represents e.g. a checkbox with "normal" button text, the text in the pushed/checked state of the button is not displayed properly if the button becomes disabled. That is the position of the checked, disabled button text is wrong.
To fix this change the appropriate section in the DrawItem() method as follows:
// Select the correct skin
if (lpDrawItemStruct->itemState & ODS_DISABLED){ // DISABLED BUTTON
if(m_bDisabled.m_hObject==NULL)
// no skin selected for disabled state -> standard button
pDC->FillSolidRect(&r,GetSysColor(COLOR_BTNFACE));
else // paint the skin
DrawBitmap(pDC,(HBITMAP)m_bDisabled,r,m_DrawMode);
// if needed, draw the standard 3D rectangular border
if (m_Border) pDC->DrawEdge(&r,EDGE_RAISED,BF_RECT);
// paint the etched button text
pDC->SetTextColor(GetSysColor(COLOR_3DHILIGHT));
//Fix: Check if button is in checked/pushed state
if (m_Checked)
OffsetRect(&tr,1,1);
pDC->DrawText(sCaption,&tr,DT_SINGLELINE|DT_VCENTER|DT_CENTER);
pDC->SetTextColor(GetSysColor(COLOR_GRAYTEXT));
//Fix: Remove this line: OffsetRect(&tr,-1,-1);
pDC->DrawText(sCaption,&tr,DT_SINGLELINE|DT_VCENTER|DT_CENTER);
} else { // SELECTED (DOWN) BUTTON
...
|
|
|
|
|
Great class!
I'm working on a user-skinnable application so I need to load the images from files. The way I accomplished this was to replace the UINT's with LPCTSTR's in the SetSkin() parameters and modified the following code:
if (normal>0)
{
HBITMAP hNormal=(HBITMAP)::LoadImage(AfxGetInstanceHandle(),
normal,
IMAGE_BITMAP,
0,
0,
LR_LOADFROMFILE);
m_bNormal.Attach(hNormal);
}
My question is, will this cause any problems, or is there any additional clean-up that I need to be concerned with? I'm fairly new to C++.
Thanks,
Wolf
|
|
|
|
|