|
I was talking about placing a bitmap (picture control) in the dialog and then different Bitmap buttons over it (by changing the showing order).
is there any way to place the bitmap in teh dialog? what is a pattern (in this context)?
thank you in advance...
|
|
|
|
|
I would avoid the picture control method of putting the bitmap on the dialog background.
Do this instead:
//Declare some variables:
CBrush m_brush;
CBitmapButton m_btnOK;
CBitmapButton m_btnCancel;
//Add code:
OnInitDialog:
{
...
RECT rc;
GetClientRect(&rc);
HBITMAP hBmp=NULL;
hBmp=(HBITMAP)::LoadImage(NULL,"YourPath.bmp",IMAGE_BITMAP,rc.right,rc.bottom,LR_LOADFROMFILE);
CBitmap *pBmp=CBitmap::FromHandle(hBmp);
m_brush.CreatePatternBrush(pBmp);
::DeleteObject(hBmp);
// Load Graphics onto OwnerDrawn buttons.
// These are CBitmapButton objects
m_btnOK.AutoLoad(IDOK,this);
m_btnCancel.AutoLoad(IDCANCEL,this);
}
OnPaint()
{
//Paint the background with the image brush
CRect rcClient;
GetClientRect(&rcClient);
dc.FillRect(&rcClient,&m_brush);
}
OnCtlColor(..)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
switch(nCtlColor)
{
case CTLCOLOR_STATIC:
pDC->SetTextColor(RGB(TBD));
case CTLCOLOR_BTN:
pDC->SetBkMode(TRANSPARENT);
case CTLCOLOR_DLG:
hbr=m_brush;
}
return hbr;
}
Art
|
|
|
|
|
WONDERFUL: easy and much better.
Only one question:
this is a pattern (now I understand what you were talking about) is there any way to load the bitmap without making a pattern? only load it one time?
Thank you in advance.
|
|
|
|
|
Joan,
(..only load it one time?)
You are loading it only one time. LoadImage(..) is called only once. I don't understand the question.
Art
|
|
|
|
|
Nothing, I meant that if the dialog gets resized the background image gets repeated until the background is fullfilled...
I'd like to get the image not resized and aligned only to top left...
is it possible to get the image sized as the original? even if the dialog gets resized?
thank you in advance...
|
|
|
|
|
Sorry, I thought you wanted it as a background on your dialog.
What you need to do is change the code in OnPaint. This is where the size of the image is being computed when the dialog is resized. Instead of GetClentRect(..) just specify the fixed size of the rectange you want to fill in the FillRect(..)
OnPaint(..)
//Paint the background with the image brush
//CRect rcClient; //Modify this to be the rectangle you want
//GetClientRect(&rcClient); //Block this
dc.FillRect(&rcClient,&m_brush);
Art
|
|
|
|
|
|
Hi ,
this is a question about providing exclusive access to a control .
Consider my case where I am using a active x control to log certain details. My application works on a REQUEST - RESPONSE mechanism where I request a certain piece of data externally (serial or network ) , wait a certain duration and conitinue processing the next REQUEST. There is another callback function that actually reports the data I am requesting and needs to log the RESPONSE To the same active x control .
I am running into problems when both of these threads are running . i.e Main request loop and the call back thread . They tried to access the same resource via a variable(say the current row of a grid !!!!!) and that is when results go messy .
I know that I can use CCriticalSection to protect a block of code , but how do i provide exclusive access to a resource when they are not part of the same code ? like a control which is spread across different functions? Please help
|
|
|
|
|
If the resource is managed by a C++ class you can put a critical section in the class and lock it whenever any code needs exclusive access to the resource. Of course you also need to ensure you can't get into a deadlock situation.
Neville Franks, Author of ED for Windows. www.getsoft.com
Make money with our new Affilate program
|
|
|
|
|
Hi,
Can anyone answer the following question or at least tell me where I can find the answer ?
When you install VB, Visual studio, Ms word etc... and you have a PC with multiple registries (say one for stand-alone use/login and one for network use/login) the software manages to register itself in all the registries and you can use it whichever way you log in. With my own software it will register OK but the settings I enter into the registry are only visible in the registry active at the time of registration. When you log in differently and another registry is used the program cannot access the values in the original one.
The solution seems simple: register the software in all possible registries as the Microsoft products seem to do. The question is: how do you do that ?
Any answers most welcome and appreciated.
Filip
|
|
|
|
|
one thing you can consider is to add your registry entries to HKEY_LOCAL_MACHINE, instead of HKEY_CURRENT_USER. the first is readable to most processes, regardless of user login. the second is unique for each user.
-c
Image tools: ThumbNailer, Bobber, TIFFAssembler
|
|
|
|
|
Are you confusing HKLM (Local Machine) and HKCU (Current User)?
You need administrative rights to write into HKLM but it is visible to all users.
Art
|
|
|
|
|
Thank you for the help. A case of "glaringly obvious once pointed out". It ought to make all the difference.
Filip
|
|
|
|
|
I'm using doxygen for the first time and I'm trying to configure the configuration file with the doxywizard. When I run the generation I've got "unknown command or file name" dos window and that's all.
How can I figure out what's wrong with my configuration file this way ?
I'm using the latest 1.3.
Yarp
http://www.senosoft.com/
|
|
|
|
|
|
Thanks a lot Andreas, I did a search in the articles before asking but I don't know why I missed this.
My main problem comes with the wizard, I think the files included in the zip file will greatly help me solve this.
Thank again
Yarp
http://www.senosoft.com/
|
|
|
|
|
hi,i'm newer developer on visualc++ and i want to know how can i add a bitmap(more than 256 color) for a button,
Please help,
Thanks
Bye
liuqid
|
|
|
|
|
|
I'd like to use a "output iterator" as a function parameter, but somehow I fail to do that. Any hints where to read about this?
Off to in ~74 days
|
|
|
|
|
Post an example of your code.
Kuphryn
|
|
|
|
|
|
Andreas Saurwein wrote:
Sometimes the SGI STL documentation is really useful
No, it's the VC STL documentation that sucks!
It's not the fall that kills you: it's the sudden stop - Down by Law, Jim Jamursch (1986)
|
|
|
|
|
Daniel Turini wrote:
it's the VC STL documentation that sucks!
I second that
Cheers,Joao Vaz
And if your dream is to care for your family, to put food on the table, to provide them with an education and a good home, then maybe suffering through an endless, pointless, boring job will seem to have purpose. And you will realize how even a rock can change the world, simply by remaining obstinately stationary.-Shog9
Remember just because a good thing comes to an end, doesn't mean that the next one can't be better.-Chris Meech
|
|
|
|
|
Hi.
Is it possible for me to use CSplitterWnd class in My ActiveX object or Dialog box .Can i use any oter method to achive a Normal SplitterWindow like view in my activeX control; or Dialog box. So that i hav a Left view & Right View
the left view may contain few controls and the rightView too, and i must manage all these controls position when i move the splitter.
Please do a reply as early as possible
regds..
Jibesh.V.P
Jibesh.V.P.
India
|
|
|
|
|