|
Hi,
I'm trying to turn a bitmap on and off (if it were a CWnd, I would use CWnd::ShowWindow(SH_HIDE) ) How can I do this?
Basically, here is what I will have:
I will have "layers" of bitmaps in one rectangular area. I am a little familiar with device contexts and will try to associate each layer with it's own device context.
When I want to Show/Hide a layer, I will operate on that specific device context.
Each layer will have a unique color used -- there is only one color used in drawing on that layer.
Are there any suggestions on how I can programmatically turn on/off a specific layer?
Thank you very much!
Johnny
|
|
|
|
|
|
If you have no more than 8 layers, just use an 8 bit deep
bitmap-- treat it as a paletted image. Generate the palette
on the fly depending on the colors of the layers, their
transparency, order, etc. Then blit to the display using the
generated palette. If you have more than 8 layers, then
you can do the same but your original bitmap will not be
compatible with gdi as is-- use it to construct a final
image and blit that to the display.
|
|
|
|
|
This is in the lines of what I was looking for. I'm adapting the Oscilloscope project in CP's
"http://www.codeproject.com/miscctrl/oscope.asp" by Mark C. Malburg
and he uses bit blit-ing.
I will be putting 5 (maybe 8 max) plots on the same grid. If the user wants to turn off a plot(s) then that is when I want to do my business.
Any more suggestions/help? Thanks all!
Johnny
|
|
|
|
|
Make sure when drawing into the layered bitmap,
to use the R2_MERGEPEN raster op so that when
drawing with a pen designed for one layer you
aren't obliterating the others.
|
|
|
|
|
|
Hello all,
I want to test the state of mouse buttons in inside MouseMove handler .
I suppose i must work with Wparam or Lparam but how ?
thank you in adavance
|
|
|
|
|
afx_msg void OnMouseMove( UINT nFlags, CPoint point );
is the prototype of the MouseMove handler in CWnd (MFC)
In this:
nFlags
Indicates whether various virtual keys are down. This parameter can be any combination of the following values:
MK_CONTROL Set if the CTRL key is down.
MK_LBUTTON Set if the left mouse button is down.
MK_MBUTTON Set if the middle mouse button is down.
MK_RBUTTON Set if the right mouse button is down.
MK_SHIFT Set if the SHIFT key is down.
if (nFlags & MK_LBUTTON)
{
// Left mouse button is down
}
if (nFlags & MK_MBUTTON)
{
// Middle mouse button is down
}
My article on a reference-counted smart pointer that supports polymorphic objects and raw pointers
modified 29-Aug-18 21:01pm.
|
|
|
|
|
O yes ! thx you !
it works great !
|
|
|
|
|
if (wParam & MK_LBUTTON) //left button down
if (wParam & MK_RBUTTON) //right button down
Joel Lucsy
|
|
|
|
|
Thx ! your solution is grat for PreTranslateMessage !
Thx again
|
|
|
|
|
Arf i have a problem ;(
Your solution works great when the view is derived from CView, but when is derived from CListCtrl it doesn't work !
You know why ?
Thx
|
|
|
|
|
I'm new to this. I want to be able to send a command from the client application to the server application. For example to call the one of the servers dialog box or menu item. Which calls do I need to do achieve this.
Thanks
|
|
|
|
|
Ok,
I don't know the official word for doing this, but in windows, if you have a box with text and the text spans further than what the box can display (i.e. on the taskbar at the bottom of the screen), if you hold the mouse over the box, a yellow box pops up displaying the full text. How would I implement this into a dialog control that i have? I have an input form with several static text boxes, which sometimes get overloaded because I fill them with more text than what the user can normally see.
Thanks,
Mike Mathers
|
|
|
|
|
Its called a tooltip. There are several classes available her on CP.
Note that for a static text control to have a tooltip, it must have a unique ID and have the Notify style set in its resources.
Roger Allen
Sonork 100.10016
Were you different as a kid? Did you ever say "Ooohhh, shiny red" even once? - Paul Watson 11-February-2003
|
|
|
|
|
Thank you for the quick response. I was looking more to do this myself if possible, I've been reading up on CToolTipCtrl, and I've set the Notify Styles on all the static controls that need this. But what is the next step, do I include a CToolTipCtrl object in my dialog class? I'm a little stumped and MSDN is not helping.
|
|
|
|
|
I wouldn;t bother with the tooltip control. If your doing this on a dialog, follow these steps (which work on form views etc as well).
1. Call EnableToolTips(TRUE) in the OnInit dialog.
2. Add the function prototype
afx_msg BOOL OnToolTipNotify(UINT id, NMHDR *pNMHDR, LRESULT * pResult);
3. Add this MESSAGE_MAP entry
ON_NOTIFY_EX(TTN_NEEDTEXT, 0, OnToolTipNotify)
4. Add your funtion
BOOL CYourDialog::OnToolTipNotify(UINT , NMHDR *pNMHDR, LRESULT * )
{
TOOLTIPTEXT *pTTT = (TOOLTIPTEXT *)pNMHDR;
static char tooltiptext[256] = "";
if (pTTT->uFlags & TTF_IDISHWND)
{
UINT nID = ::GetDlgCtrlID((HWND)pNMHDR->idFrom);
pTTT->lpszText = NULL;
switch (nID)
{
case IDC_TITLE :
pTTT->lpszText = "Tray setup title";
break;
}
if (pTTT->lpszText != NULL)
{
return(TRUE);
}
}
return(FALSE);
}
Then just write your tooltips text for each control.
Roger Allen
Sonork 100.10016
Were you different as a kid? Did you ever say "Ooohhh, shiny red" even once? - Paul Watson 11-February-2003
|
|
|
|
|
I'm writing an editor, and I want to have current Line and Column displayed.
Line is working fine, but column doesn't always work right.
if I try to get the CharIndex of the beginning of the line this way,
long int nStartChar = SendMessage(EM_LINEINDEX,-1,0);
I eventually hit a problem after 88x lines, where (nCurrChar - nStartChar) is 65xxx
if I try to get the CharIndex of the beginning of the line this way,
long int nStartChar = LOWORD(pEdit->CharFromPos(ptLineBegin));
where ptLineBegin is based on GetCaretPos() and x forced to 0, then the column is based on the left of the window, and not the actual beginning of the line.
Can anyone give me some help, please? Thanks!
BW
"We get general information and specific information, but none of the specific information talks about time, place or methods or means..."
- Tom Ridge - US Secretary of Homeland Security
|
|
|
|
|
Turns out it wasn't the start of line I had issues with, it was getting a reliable Curr CharIndex.
I got it this way.
<br />
DWORD dwStart, dwEnd;<br />
pEdit->SendMessage(EM_GETSEL,(WPARAM)(&dwStart), (LPARAM)(&dwEnd));<br />
<br />
return dwStart;<br />
BW
"We get general information and specific information, but none of the specific information talks about time, place or methods or means..."
- Tom Ridge - US Secretary of Homeland Security
|
|
|
|
|
Hello
I am looking for function to stop and continue the message processing of processes.
Is there a function like StopMessageProcessing(...) to stop
a process processing its messages? This does not mean to kill its messages in its message queue, it means just to stop the processing for a certain time I want to define.
-Dominik
|
|
|
|
|
Check SuspendThread and ResumeThread
an article
http://www.codeproject.com/threads/pausep.asp
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
You might be able to use SuspendThread and then ResumeThread, but I'm not sure if you can do this cross-process. Note that you might have to suspend all the threads of the process, not just the base one.
The only other alternative is to somehow pass a particular message to the app that you have a hook into. When the message is received you would do a sleep or something that doesn't return control till you need it to.
Joel Lucsy
|
|
|
|
|
Hi!
I have inserted an activex control in my Win32 API application, and when i try to compile it, my application doesn't have any errors and it's not visible....
What's wrong?....
|
|
|
|
|
Hi !
Are you sure your ActiveX is well registered and installed (not only added to the C++ compiler)?
I had the same problem when I ran my application on a computer wher the ActiveX was not installed.
Hope it helps!
|
|
|
|
|
Is there anything equivalent to DoEvents of VB in VC++ 6???
Mahesh
|
|
|
|