 |
|
 |
Won't compile under VS2008 at Unicode char set.
After I added _T to needed strings, started to crash.
|
|
|
|
 |
|
|
 |
|
 |
I was testing this code, which is really cool and nice, but found that tooltips do not appear? AM I missing something ?
Moh
|
|
|
|
 |
|
 |
Hi,
I'm trying to use your nice button class, it works fine on standard dialogs (CDialog), but the transparancy stops working if I use the button on a dialog of type CDHtmlDialog.
Best way to reproduce the problem is to use the MFC wizard to create a two new MFC dialog projects, one using CDHtmlDialog and another using CDialog.
Any suggestions how to fix this?
thanks,
Lambert
|
|
|
|
 |
|
 |
oh,very very good!!!
haha
henhao ,xiexie!
ni de da da de hao!
|
|
|
|
 |
|
|
 |
|
 |
抓住了,围观。。。
|
|
|
|
 |
|
 |
I think you should see WowButtons project & use GdiDrawStream function to hide other not needed parts of any bitmap images!!!
Zqr
|
|
|
|
 |
|
 |
nice job,Indeed I learn a lot form it. But I found that in Visual Studio 2005 the "Owner Draw" Properties of the Button should be set to "True", or else the button wouldn't display any pic. Anyway, it's a good work! 8)
rincle
|
|
|
|
 |
|
 |
this sample is very good,
but when i use this class in my project i find a problem,on the button cirle have white line. i don't known how to hide those white line.
my english not vary good,do you understand my question.
please help me!
fdafda
-- modified at 1:01 Wednesday 12th April, 2006
|
|
|
|
 |
|
 |
Hi~
My english not very good, too.
I think the reason of white line is button image.
If you watch for button image in zoom mode,
circle line is not white(255, 255, 255).
May be you used function like this.
[ m_btnPlay.SetButtonImage("play.bmp",RGB(255,255,255)); ]
So, if you want destroy circle line,
reproduce circle line of image perfectly white.
It just my opinion.;P
^^
|
|
|
|
 |
|
 |
very good.
but how to use Resource'bmp .no such function
thanks
|
|
|
|
 |
|
 |
It actually pretty easy to make the class work with resources. While there are no corresponding functions in CKbcButton and CKbcBitmap, the class CPicture actually has all you need to open a resource bitmap. Open the CPicture class - you will see a function called Load. It is an overloaded function and the second version actually supports using resources directly. The instructions for opening a resource bitmap are also included.
If you have trouble getting it to work, do the following. First thing, go to Resources and open up the required bitmap as a custom type. If you are using .NET, create a new cutom resource of type BMP. When the blank resource is created, which will be given the name IDR_BMP1 and placed under the type "BMP", select File->Open and open up the bitmap file as a binary. Then select all the contents and copy them to the clipboard. Go back to your empty IDR_BMP1 resource and paste from the clipboard. Now the custom resource has all the data of the actual bitmap. Now create, in class CKbcBmp an overloaded version of the LoadBitmap function with the following code:
void CKbcBmp::LoadBitmap(UINT nResource)
{
m_picImg.Load(nResource, "BMP");
m_nWidth = m_picImg.m_Width;
m_nHeight = m_picImg.m_Height;
m_nSliceWidth = m_nWidth/4;
}
At last, in the class CKbcButton, create an overloaded version of the SetButtonImage function with the following header:
void CKbcButton::SetButtonImage(UINT nResource,UINT nMask)
Now copy all the contents from the original SetButtonImage function and change the first line from
m_bmpImage.LoadBitmap(strFileName);
to...
m_bmpImage.LoadBitmap(nResource);
Tada...you're done.
Now all you have to do to load a bitmap from a resource is to call the overloaded SetButtonImage function as follows:
MyButton.SetButtonImage(IDR_BMP1,RGB(255,255,255));
where IDR_BMP1 is the bitmap's resource ID and MyButton is a button of type CKbcButton.
|
|
|
|
 |
|
 |
Hi,
This class is so good, however when i apply rich text, it didn't work. Anyway i give the best rate for you
|
|
|
|
 |
|
 |
I totally understand my button isn't perfect.
but you've given a best rate, I am ashamed of myself.
next time, I'll consider put buttons on rich text.
thanks.
Sig.
Let it be.
|
|
|
|
 |
|
 |
hahaa.......i learnt something from your code...so it is useful for me...regardless whatsoever trick you have use to create it. I think we should move to the easy GDI+ to create the onhover button
.just my opinion
|
|
|
|
 |
|
 |
Your control is nice, but it allows the user to click outside the button and press the button.
|
|
|
|
 |
|
 |
yeah, I know that problem.
at corner of the buttons that problem would raise.
just kind of cheat
but later I will find a way to fix that problem,
anyway thanks for your visit and indication.
bye~
Sig.
Let it be.
|
|
|
|
 |
|
 |
I want to know if this problem has been solved. Thank you
_____________________________
Xia Xiongjun loves this site.
|
|
|
|
 |
|
 |
I have a simple MFC Dialog and implemented the six files as per the instructions, but when I run the app, it says (in a messagebox):
"An unsupported operation was attempted"
I traced it back to the DDX_Control(...) line I added.
Then the app crashes on this addition:
m_ButtonBITRun.SetButtonImage("res\\play.bmp",RGB(255,255,255));
m_ButtonBITRun.SetToolTipText("Play~!");
Im using a stock standard MFC Dialog project made by VC6+SP5 in WinXP SP2. Whats going on?
I can recompile and run the CKbcButton source code perfectly fine... I may just restart the project with this source code and add my code...
|
|
|
|
 |
|
 |
you change the function parameter's on the followng functions
void CKbcButton::SetButtonImage(UINT strFileName,LPCSTR res,UINT nMakse)
{
m_bmpImage.LoadBitmap(strFileName,res);
....................
}
void CKbcBmp::LoadBitmap(UINT strFileName,LPCSTR Resource)
{
m_picImg.Load(strFileName,Resource);
.................
}
Mohamed Bakr
|
|
|
|
 |
|
 |
I got this error in VC8. I just fixed it.
The problem was in how I created that bad dialog. There seem to be 2 ways to "ADD A DIALOG" to the resources (only 1 works properly). I went back, re-created the dialog the other way, and it worked fine.
Right click on resources folder, and you get two options:
Add Resource -> Dialog ... = BAD, code didn't find the darn dialog, naming was fine
Insert Dialog = GOOD, exact same code detected this dialog fine
Try re-creating the dialog itself.
Take It Easy
|
|
|
|
 |
|
 |
Thanks a lot for this amazing answer. I was literally at my wits end trying to trace why my completely stable working program, suddenly started crashing all over the place.
I had basically tried to make a copy of a dialog, and I had inserted it in the Add Resource -> Dialog = BAD (and how!) way. Even though the code compiled fine, I was getting this run-time crash when I was trying to do
CDialog * pDlg = new CDialog();
if(pDlg)
pDlg->Create(IDD_MYDLG,this);
Earlier this code was running just fine. Suddenly a few days ago it started crashing.
Thanks a lot for this brilliantly simple answer!
Bharat.
|
|
|
|
 |
|
 |
Also, this "unsupported operation" happens when you try to access a button, box, whatever that does not exist. So if your code has:
void MySlickDialogClass::OnInitDlg()
{
CDialog::OnInitDlg():
m_ctrlButtonColorRed.EnableWindow(TRUE);
m_ctrlRadioColorWhite.SetCheck(BST_CHECKED);
return TRUE;
}
This code will cause an "unsupported operation" IF the buttons didn't register properly. The best way to diagnose the bug is to comment out the lines that access the controls, then run the code:
// m_ctrlButtonColorRed.EnableWindow(TRUE);
// m_ctrlRadioColorWhite.SetCheck(BST_CHECKED);
And finally, if you're programming for AutoCAD ObjectARX (like me), then you can get the "unsupported operation" error if you don't understand the CModuleResourceOverride class, which lets your program switch between between your program's resources (dialogs), and AutoCADs builtin resources.
Take It Easy
|
|
|
|
 |
|
 |
i...
you are excellent!!
Thank you for using the CKbcButton.
|
|
|
|
 |