|
Hi,
I'm trying to create an application similar to Mr. DiLascias' Virgil
application http://www.microsoft.com/msj/defaultframe.asp?page=/msj/0397/c++/c++0397.htm&nav=/msj/0397/newnav.htm My application has one large difference, I've derived my view from a Dundas class called CScrollWnd which allows zooming of the image. The Dundas class loads the original bitmap and draws it out to the screen. When the user zooms the image, they use a CWindowDC to change the orientation of the image (zoom in/out). This is where I'm having a lot of trouble, when the original image is zoomed, I need to somehow change the orientation of the masked image. Since the Dundas class is already changing the orientation for me, I was wondering if I could just make the same changes to my masked image that the class is doing to the original image and then just update the masked image that's in memory. Is there a way to change a CBitmap the way that a CWindowDC is changed?
I hope I'm explaining this correctly, if not please don't hesitate to ask and I will try to explain it better. I'm new to dealing with this kind of programming and would appreciate any help you can provide.
Here is some sample code that I'm using in my application to try and find out where on the image they are pointing but as you can see, the mask image is loaded but it is always loaded at it's actual size and not what the actual zoomed image is set to.
void CMyImageViewer::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CDC dc;
dc.CreateCompatibleDC(NULL);
CSize sizeDIBMask = m_dibMask.GetSize();
CRect rectMask(0, 0, sizeDIBMask.cx, sizeDIBMask.cy);
CRect rectPaintMask = rectMask;
NormalToScaled(&rectPaintMask);
UINT diffMask = rectMask.bottom - rectMask.top;
rectMask.bottom = sizeDIBMask.cy - rectMask.top;
rectMask.top = rectMask.bottom - diffMask;
CRkFicheView *wnd = (CRkFicheView*)m_splitterWnd.GetPane(0, 1);
CRkImageViewer *pImageViewer = wnd->GetImageViewer();
CDib *pMask = pImageViewer->GetMaskDib();
CBitmap *pOldBm = dc.SelectObject((CDib*)&m_dibMask);
COLORREF color = dc.GetPixel(point);
dc.SelectObject(pOldBm);
TRACE("RGB(%d,%d) = (%d,%d,%d) \n", point.x,
point.y, GetRValue(color), GetGValue(color), GetBValue(color));
if(color != RGB(255, 255, 255)) //white = nothing
{
AfxMessageBox("Color other than white found.");
}
COXScrollWnd::OnMouseMove(nFlags, point);
}
Thanks,
Craig
|
|
|
|
|
If you don't need a scaled version of the mask bitmap for other purposes, what about reversing the problem?
That is, if you know which transformation is applied to the bitmap, you apply the inverse tranformation to the point and obtain a valid point in the mask bitmap.
Paolo
------
"airplane is cool, but space shuttle is even better" (J. Kaczorowski)
|
|
|
|
|
Paolo,
Thanks so much for the great idea, I didn't even consider this, I guess I've been to focused on trying to solve the other zooming problem.
I was wondering if you could give a little more clarity to your suggestion. For example, in using your idea, would I have to keep track of all transformations (i.e. if they zoom in multiple times and then scroll around?) Also, the Dundas class uses things like Get/SetViewportEx, how would I go about transforming a point to try and line them up?
Thanks again for your suggestion and any other information you can provide,
Craig
|
|
|
|
|
I'm not 100% sure, but looking at CScrollWnd source you should be able to reverse the tranformation.
I suppose that if you get the window's DC and use GetViewportExt, GetViewportOrg you can get the current zoom factor and view offset.
But it could be easier... if the DC you get has still the same mapping mode as when it's used to draw the bitmap, then you can simply use LPtoDP() function.
All you have to do is trying
Paolo
------
"airplane is cool, but space shuttle is even better" (J. Kaczorowski)
|
|
|
|
|
Paolo,
Thanks again for your help, I will begin trying to see what I can find out.
Thanks again,
Craig
|
|
|
|
|
I want to do something similar to what MSN Messenger does(adds the online contacts to the Contacts list and provides special icons depending on what their status is)...
How do I do this?
There has got to be a "simple" answer for this, I just can't figure it out
Thanks in advance!
--=--
Jason Whelan
|
|
|
|
|
Hi,
I want to find all records that CODE field is 120, in Crystal Report 8.0
So, i made a new report and i choosed all fields that i need ...
Then in my project, i wrote:
m_Crystal.SetSQLQuery("SELECT * FROM PERSON WHERE [CODE] = 120");
But this code won't work !!!
What is my wrong ?
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
click
crystal report... file>report option>perform query asynchronously
and save report now you call rpt file with activity by sql query
ali_nemati@hotmail.com
ali nemati
|
|
|
|
|
Here's an easy one that's been bugging me:
I've got some edit controls in a dialog, and I checked the multiline box, and I'm hoping that when the user types past the end of a line, it will wrap around, much as it is doing while I type at this precise moment;) Anyway, even if there are some dwStyle flags I could use, how can I set those since Create is never called for dialog controls?
thanks,
Jake
|
|
|
|
|
You can change control styles in OnInitDialog() - the controls are all created at that point, just not visible yet.
--Mike--
http://home.inreach.com/mdunn/
"Make sure that if you are using a blow torch that you don't set anything on fire."
-- Chris Maunder
|
|
|
|
|
Right, but how do I change the control styles? CEditCtrl didn't seem to have a SetStyle function, but if it did I would try to add the ES_WANTRETURN style? A little more specific please?
thanks,
Jake
|
|
|
|
|
Set "Multiline", but remove "Auto HScroll".
If you want to change style bits at runtime, add a CEdit variable associated with the edit control to your dialog class, and use ModifyStyle() function.
Paolo
------
"airplane is cool, but space shuttle is even better" (J. Kaczorowski)
|
|
|
|
|
Does anyone know if there is a way to highlight an entire row (i.e. across several columns) in a CListCtrl (using the Report view, of course) when the user clicks on an item? For example, with a CListCtrl containing 4 columns and 8 rows (items), by default, only the items in the first column are highlighted when the user clicks them - but I would like to be able to highlight the entire row (all of the sub-items, across all of the columns) when a row is selected.
Is this even possible with a CListCtr, or am I heading in the wrong direction?
Thanks!
km
|
|
|
|
|
wndYourList.SetExtendedStyle ( LVS_EX_FULLROWSELECT );
--Mike--
http://home.inreach.com/mdunn/
"Make sure that if you are using a blow torch that you don't set anything on fire."
-- Chris Maunder
|
|
|
|
|
I tried
mouse_event(MOUSEEVENTF_RIGHTDOWN,mouse_x,mouse_y, 0,NULL);
mouse_event(MOUSEEVENTF_RIGHTUP, mouse_x, mouse_y, 0, NULL);
mouse_even(MOUSEEVENTF_RIGHTDOWN,mouse_x,mouse_y, 0,NULL);
But, don't work well. Thank you for your idea.
x
|
|
|
|
|
Well, don't forget the missing UP event at the end.
But the problem is that you have to put some delay between the two clicks.
Try with Sleep(GetDoubleClickTime());
Paolo
------
"airplane is cool, but space shuttle is even better" (J. Kaczorowski)
|
|
|
|
|
hello,
I have a bitmap file in a directory and I want to transfer this file to another system using sockets. So i thought i can read file using Win32 file i/o ( ReadFile ) operations and send the buffer using socket. The receiving end receives this and uses WriteFile to write into a file( created with .bmp ). But this works only for text files and not for binary files.
Can any one suggest the right way to do it. Thanks.
Ganesh.M.Ramaswamy
|
|
|
|
|
How can I make a font combo box like the one in MS Office 2000.
|
|
|
|
|
I want to use a couple of child windows in my SDI application (with caption, min and max boxes, etc...(eg. WS_OVERLAPPEDWINDOW). They are children of CMyView. When I create them in response to CMyView's WM_CREATE, the children are not shown. But when I regster a class for my children, the are shown. Why is like that?
But the real problem is that those windows don't have a focus (even when a caption bar is clicked they still have inactive caption!!). Pressing a key generates WM_KEYDOWN for CMyView not for the child window.
Another problem: If I create a button in the child window and click it, the button has focus all the time, even when other child window are clicked, or main window, or menu. I cannot find any example of how to create child windows in a main window. I have over 40 books on VC++ but none of those explain this.
Thank you any suggestions
(The same problem occurs when children are created in SDI without Doc/View support).
Jerzy
|
|
|
|
|
I'm probably missing something, but it seems like you should be creating an MDI application, not an SDI, if you want to open multiple child views. I'd imagine that the reason none of your books describe multiple windows in SDI is that, by definition, this isn't done.
Jake
|
|
|
|
|
Thank you for your answer, but with MDI I will have the same problem (I mean if I create those windows in a view). Those multiple children are not views for documents. They are windows where I get some input from the user.
Let me explain what I'm doing. I'm writing a sequencer as SDI app. User will be recording a song using a midi instrument or computer keyboard. Then he can edit recorded events in some windows like: Track window, Event window, Volume window, et...
I cannot use my view as a container for all those windows.
Probably the only way would be to use MDI and create diffrent views for the same document (MDI can be used to create multiple documents at the same time or multiple views for the same document). But could I use SDI and create multiple views for the single document?
Thanks,
Jerzy
|
|
|
|
|
You could try using a CSplitterWnd...
Jon Sagara
"Left-handed nunchakus!"
|
|
|
|
|
How about docking windows? Your users probably wont need all of the windows showing a once, so you could easily hide them.
If you do go with your original window idea, I'd say do it with in a MDI style, it will be less confusing for your users.
Ben Burnett
---------
On the topic of code with no error handling -- It's not poor coding, it's "optimistic"
|
|
|
|
|
Docking windows are OK but they won't have a focus. MDI solution would require creating differnt templates for each view. Then when you create a new document framework would think a I have more than one document type and popup a dialog box with the list of types. 'Output Window' would show "Warning, Dialog creation failed". Beside this I want to have simple SDI application.
I've seen hundreds of SDI application where user could open from menu some windows. In some applications those windows are children of desktop in other they are children of the main window.
Jerzy
|
|
|
|
|
>>>
MDI solution would require creating different templates for each view. Then when you create a new document framework would think a I have more than one document type and popup a dialog box with the list of types.
<<<
There is no need to create multiple templates for your purpose. You can actually use a document that is common to all the views, all you need to do is have a 'main' view (the one that gets used in the document template) and add extra views to the document from within it. This way you get full control in the main view, and have proper focus handling for all the windows.
I can send you a small demo, if you’re interested.
>>>
Beside this I want to have simple SDI application.
<<<
Fair enough.
>>>
I've seen hundreds of SDI application where user could open from menu some windows. In some applications those windows are children of desktop in other they are children of the main window.
<<<
Yea I've seen some, aren’t they all mostly 'docking' windows that have had there docking ability disabled?
Ben Burnett
---------
On the topic of code with no error handling -- It's not poor coding, it's "optimistic"
|
|
|
|
|