|
Hi Hamid,
I have seen this article and this does not serve my purpose.
Regards,
Paresh.
|
|
|
|
|
I think you need to paint alpha blended explicitly, AlphaBlend[^] and make sure you handled OnEraseBkgnd so that Static control doesnot painted its own background
have a look at Using the AlphaBlend function[^]
|
|
|
|
|
Thanks Rajkumar,
AlphaBlend works for bitmaps.
I have to use icons.
Regards
Paresh
|
|
|
|
|
before that, I would like to know what is the result when you tried with your code.
|
|
|
|
|
class CMyDialog : public CDialog<br />
{<br />
........<br />
CStatic m_StaticIcon;<br />
........<br />
}<br />
<br />
HBRUSH CMyDialog:OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) <br />
{<br />
HBRUSH hbr = CDialog:OnCtlColor(pDC, pWnd, nCtlColor);<br />
<br />
switch(nCtlColor)<br />
{<br />
case CTLCOLOR_STATIC:<br />
if (pWnd->m_hWnd == m_StaticIcon.m_hWnd)<br />
{<br />
pDC->SetBkMode(TRANSPARENT);<br />
return (HBRUSH)(GetStockObject(NULL_BRUSH));<br />
}<br />
break;<br />
}<br />
return hbr;<br />
}<br />
<br />
<br />
BOOL CMyDialog:OnInitDialog() <br />
{<br />
.........<br />
m_StaticIcon.Create(_T(""), WS_CHILD | WS_VISIBLE | SS_ICON, <br />
CRect(0, 0, 0, 0), this);<br />
<br />
HICON hIcon = ::LoadIcon(AfxGetResourceHandle(), MAKEINTRESOURCE(ICON_ID));<br />
m_StaticIcon.SetIcon(hIcon);<br />
.........<br />
}
In CMyDialog:OnPaint(), I have painted a region of CDialog with GradientFill(...), and on this area I want a static icon, which needs to be transparent. So that I can see the background of CStatic icon as gradient. But this icon has been painted with background of rest of dialog and not the region, which I have painted with GradientFill.
I hope I have mentioned the problem correctly.
Regards,
Paresh.
|
|
|
|
|
I would suggest very simple approach as you want to display only the icon, use DrawIcon, inplace of doing a lot of stuff over CStatic.
1) add the icon as member variable.
class CMyDialog : public CDialog
{
........
HICON m_hStaticIcon;
........
}
2) load the icon
BOOL CMyDialog:OnInitDialog()
{
.........
m_hStaticIcon = ::LoadIcon(AfxGetResourceHandle(), MAKEINTRESOURCE(ICON_ID));
.........
}
Paresh Chitte wrote: In CMyDialog:OnPaint(), I have painted a region of CDialog with GradientFill(...), and on this area I want a static icon,
3) Now you draw the icon over the painted region.
void CMyDialog::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this);
.....
.....
}
else
{
CDialog::OnPaint();
CClientDC dc(this);
dc.DrawIcon(100, 100, m_hStaticIcon);
}
}
|
|
|
|
|
Hi Rajkumar,
The solution you have provided is perfectly working for me.
Thank you very much for your kind help.
Regards,
Paresh.
|
|
|
|
|
Hi,
The below code is not working:
ExitWindowsEx(EWX_REBOOT|EWX_FORCE,0);
In which condition it may fail?
|
|
|
|
|
|
Return value is 0. And I have checked this.
|
|
|
|
|
|
Using getLastError, I got the error 1314 (The required previlige is not held by the client). What it means?
|
|
|
|
|
pther wrote: What it means?
see my previous reply
|
|
|
|
|
|
Hello Friends,
Can anyone say how to find the number of ports and the name of ports such as COM1, COM2 etc in our PC using a VC++ program. I searched it everywhere, but i couldnt find a proper source code.
Can u please help in this..
usharani
|
|
|
|
|
|
It is Very confusing because we dont have complete source code there .
Can u help me in this
usharani
|
|
|
|
|
don't you have the implementation of BeginEnumeratePorts, EnumeratePortsNext, EndEnumeratePorts posted in the page itself.
|
|
|
|
|
Hi Raj thanks very much it was helpful a lot..................
usharani
|
|
|
|
|
Hi experts,
I m a VC++ developer and i used Windows API CreateFile() for serial communication. but it decrease the speed of sending n receiving bytes from port.
can u please answer me how to speed up communication?
I also set the TimeOuts to '0' so that it doesnt take any timeout waitng..
Please reply..
Its really matter to me..
|
|
|
|
|
Member 3220373 wrote: but it decrease the speed of sending n receiving bytes from port.
What do you mean ? Decrease compated to what ?
|
|
|
|
|
the time taken by my program in VC++ is very greater than same implemented
program in TurboC++
My observation;;
if i used a file to write on device connected on my COM4 have size 172kb
then TurboC++ pgm takes only 54sec but VC++ pgm takes 211 sec
almost 3.5 times.
so i want some special function or tric to increase the speed of this transmisssion..
reply...plzzzzzzz
|
|
|
|
|
Member 3220373 wrote: can u please answer me how to speed up communication?
Use USB. (just kidding).
Please elaborate.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
|
Thnks for reply...
I already used DCB structure in my program..
but have same effect...
the probm is If i load a file of 172kb using TurboC++ prgm
then it takes appx 55 sec...
but
when I load file using VC++ prgm that uses CreateFile() API
it takes appx 211 sec... i.e. appox 3.5 times.of TC
so plz... reply....any option to decrease load delay..
n speed up my transmission...
PLz ..... ur reply always matter to me..
|
|
|
|