|
I hope that your
if (m_radio = 0)
is a typo, and you've not forgotten that in C/C++ the test for equality is == ...
Steve S
|
|
|
|
|
As Steve has already indicated, it looks as though you have mistakingly used the assignment operator in place of the equality operator. If you will get in the habit of putting constants on the left side of either operator, the compiler would have gladly complained about these statements.
For example:
if (0 = m_radio)
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
How to show AVI file in a CDialog?
(what better way?)
thanks
|
|
|
|
|
use MFC class CAnimationCtrl
"When death smiles at you, only thing you can do is smile back at it" - Russel Crowe (Gladiator)
|
|
|
|
|
|
How do a grey a CListBox based on some option ,
say option A the ListBox should be enabled with Window color as bg
for option B, the listbox should be disabled with btn face color and all list items also greyed..like a greyed edit box
PS its CListBox not a CListCtrl
|
|
|
|
|
I don't know if I exactly understood what you want to do, but if you want to enable or disable the control you can use the EnableWindow() function, e.g.:
void EnableMyListBox()
{
myListBox.EnableWindow(TRUE);
}
void DisableMyListBox()
{
myListBox.EnableWindow(FALSE);
} When you disable the listbox it will be grayed out.
Hope it'll help!
Regards, mYkel
|
|
|
|
|
True, but I want the background to be greyed as well. If I do a fillrect with a brush (COLOR_BTNFACE), EnableWindow(FALSE) still causes it to have a white background even though the listbox is disabled.
|
|
|
|
|
See CWnd::OnCtlColor() documentation. I don't have experiences with it but, it could solve your problem.
Robert-Antonio
"CRAY is the only computer, which runs an endless loop in just 4 hours"
|
|
|
|
|
As another poster said you can use the OnCtlColor() method for this. Assuming you have a button for changing between the grayed and not grayed state like this:
void CListBoxGrayingTestDlg::OnButtonGray()
{
if(m_bGrayed)
{
m_bGrayed = FALSE;
m_MyListBox.EnableWindow(TRUE);
}
else
{
m_bGrayed = TRUE;
m_MyListBox.EnableWindow(FALSE);
}
} Adding a message handler for WM_CTLCOLOR you can now do something like this:
HBRUSH CListBoxGrayingTestDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
pDC->SetBkMode(TRANSPARENT);
if (pWnd->GetDlgCtrlID() == IDC_MYLISTBOX)
{
if(m_bGrayed)
return (HBRUSH)GetStockObject(GRAY_BRUSH);
else
return (HBRUSH)GetStockObject(WHITE_BRUSH);
}
return hbr;
} Now the background will be grayed, when the control is disabled...
Regards, mYkel
|
|
|
|
|
I don't understand the consequences between dialog on top and fullscreen application...
however, you should set the WS_EX_TOPMOST style in CDialog::CreateEx() .
Robert-Antonio
"CRAY is the only computer, which runs an endless loop in just 4 hours"
|
|
|
|
|
Thanks,
I just found i could select Overlapped from within the Properties page of the Dialog.
It probably does the same as your solution.
Best regards
Neok
|
|
|
|
|
Hi,
Iam in trouble rotating the bitmap.
Iam doing it as follows:
HBITMAP handle;
//Functin from which I get a handle
//to the Bitmap.
handle = GetBitmapHandle();
CDC dcMemory;
dcMemory.CreateCompatibleDC(pDC);
CBitmap *bitmap=CBitmap::FromHandle(handle);
BITMAP bm;
bitmap->GetBitmap(&bm);
//Rotating the Bitmap by 90.
XFORM xFormBarcode;
SetGraphicsMode(pDC->GetSafeHdc(),GM_ADVANCED);
xFormBarcode.eM11 = (FLOAT)cos(90*DEGREES2RADIANS);
xFormBarcode.eM12 = (FLOAT)sin(90*DEGREES2RADIANS);
xFormBarcode.eM21 = (FLOAT)-sin(90*DEGREES2RADIANS);
xFormBarcode.eM22 = (FLOAT) cos(90*DEGREES2RADIANS);
xFormBarcode.eDx = 0;
xFormBarcode.eDy = 0;
int xCord =0;
int yCord =0;
int x =abs((xCord*(FLOAT)cos(90*DEGREES2RADIANS)) + (yCord * (FLOAT)-sin(90*DEGREES2RADIANS)));
int y = (xCord*(FLOAT)sin(90*DEGREES2RADIANS)) + (yCord * (FLOAT)cos(90*DEGREES2RADIANS));
SetWorldTransform(pDC->GetSafeHdc(),&xFormBarcode);
CBitmap* pOldBitmap = dcMemory.SelectObject(bitmap);
double bmWidth = bm.bmWidth;
double bmHeight = bm.bmHeight;
pDC->BitBlt(100,100,bm.bmWidth,bm.bmHeight, &dcMemory, 0,0,SRCCOPY);
dcMemory.SelectObject(pOldBitmap);
I can't see the rotated effect.How Could I rotate it..
Any help is appreciated...
Thanks...
|
|
|
|
|
Quite a simple program you have done, which open the bitmap, but which do nothing on it.... Because you miss the loop on every pixels of the Bitmap.
To make it rotate, you should had some computation of the the net position of each pixel and copy from the original bitmap to a destination bitmap. The best way is to make the loop on each pixel of the destination bitmap.
But be carefull that you have to initialize a destination bitmap (may be temporar) which has the enough size increased by rotation factor.
You can have a look on a good routine in cximage (very good library) wher you will find in one of the cpp file the exmeple of rotating (use search "Rotate" to find it).
Hoping that it will hlp you....
NKH
|
|
|
|
|
|
If i declare a CEvent object as a member of my class -
a) Is it created such that it is manual reset / automatic
b) If automatic how do i tell the CEvent object that it shud be manul reset
Dimple
|
|
|
|
|
CEvent( BOOL bInitiallyOwn = FALSE, BOOL bManualReset = FALSE, LPCTSTR lpszName = NULL, LPSECURITY_ATTRIBUTES lpsaAttribute = NULL );
this is the construtor of the CEvent , all are optional constructor, you need to set it the way you want it,
2nd parameter will be of some interest to you.
regards,
Prakash.
"When death smiles at you, only thing you can do is smile back at it" - Russel Crowe (Gladiator)
|
|
|
|
|
Agreed that the constructor helps me specify the same but how do i use the constructor in creating my object. Ok lets put it this way
class A {
CEvent e;
}
now how do i create e with the constructor.
I hope u r getting my problem
|
|
|
|
|
(Well i found answer to my first question it is automatic)
Agreed that the constructor helps me specify the same but how do i use the constructor in creating my object. Ok lets put it this way
class A {
CEvent e;
}
now how do i create e with the constructor.
I hope u r getting my problem
|
|
|
|
|
class A{
{
CEvent e(TRUE,TRUE,NULL,NULL);
}
this creats a event that is initialy owned, manual reset, unnamed event, null security.
Hope i cleared ur problem.
"When death smiles at you, only thing you can do is smile back at it" - Russel Crowe (Gladiator)
|
|
|
|
|
It gives syntax error on compilation
|
|
|
|
|
Class A
{
CEvent e;
A() : e(NULL,NULL,NULL)
{
}
};
/Magnus
- I don't necessarily agree with everything I say
|
|
|
|
|
hmm thats a inline definition...
i dont wanna create my class object in that fashion & neither does that compile.
My class A has its own constructor
|
|
|
|
|
That is the syntax for calling membervaribles ctors, put it
in your class A's ctor.
/Magnus
- I don't necessarily agree with everything I say
|
|
|
|
|
This is the scenario
class A {
A(int,ClassB *b);
CEvent e;
}
In the implementation file ->
A::A(int,ClassB *b) {
What do i put here?
}
|
|
|
|