|
Don't bother drawing it yourself. Make use of the CRectTracker class to do it for you.
Create the object in the OnLButtonDown and Destory it in the OnLButtonUp. Change the values in the OnMouseMove.
The only problems I have had with CRectTracker is that you should use a new/delete on it, as the second time you use the same object you get screen corruption. Also, if your control completely redraws between OnMouseMoves's etc, then you have to re-create the CRectTracker object:
Roger Allen
Sonork 100.10016
If I'm not breathing, I'm either dead or holding my breath.
A fool jabbers, while a wise man listens. But is he so wise to listen to the fool?
|
|
|
|
|
Perhaps I didn't explain myself clearly enough. I wrote that message really early in the morning, so I was tired.
I don't want to use OnMouseUp and OnMouseDown i'm trying to implement a mouse tracker only when the mouse moves. Button clicking has no purpose with this implementation.
Any ideas...? This is where the problem comes in, I can't figure out when to do what...?
Thanx again!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
I had to do this once, and there's probably a better way, but here's how I remember doing it off the top of my head(Pardon my pseudocode):
OnMouseDown-
Get the start CPoint, call it pt1
Set a flag to indicate drawing of the rect
moveto(pt1.x, pt1.y)
OnMouseMove-
Check flag to see if drawing a selection rect.
Get the current CPoint, called pt2
DrawRect(pt1, pt2)
{
lineto(pt2.x, pt1.y)
lineto(pt2.x, pt2.y)
lineto(pt1.x, pt2.y)
lineto(pt1.x, pt1.y)
}
Erase any previous rect with XOR.
This requires having saved the previous position of the mouse.
Redraw the rect once the way you want it to appear.
Save the current point as the previous point to so you can erase the old rect on the next mouse move.
OnMouseUp
Check extents of rect and select anything inside.
Set flag to indicate end of drawing selection rect.
Josh Knox
that-guy.net
"Before you criticize someone, walk a mile in their shoes. That way, when you criticize them, you're a mile away, and you have their shoes." - author unknown
|
|
|
|
|
Hi,
What are the ways for creating PDF Files from XML documents.
I will use C++.
Which libraries can i use?
Is there any free libraries(even free for commercial use)?
And what about using Formatting Objects?
Any advice ,information, approach, light wolud be helpfull.
with greetings from germany
Özgür
"No one can be perfectly free till all are free; no one can be perfectly happy till all are happy."
|
|
|
|
|
Try the adobe site.
Here's a search result that will probably point you in the right direction.
http://search.adobe.com/cgi-bin/query?mss=simple&pg=q&what=web&fmt=.&where=www_search_main&superq=pdf+xml+convert&index=AdobeCom&q=pdf+xml+convert
Hope this helps,
Bill
|
|
|
|
|
I have a class inherited from CToolBarCtrl.How Can I redraw the gripper.
Because CToolBarCtrl doesn't have the member Function DrawGripper(), I can't get any idea.I wonder if somebody can give any advice.But, if I should rewrite my class ,it will drive me mad .
|
|
|
|
|
Owner or customdrawn would probably be what you'll want to read up on.
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Hi all,
How can chnage HIJRI GHAMARI date to HIJRI SHAMSI ?
HELP ME !!!
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
|
Hi again, i'm sorry ... i wrote my question very bad.
In fact Arabic countries like Saudia Arabic and ... have difference date with Persian countries like Iran. ok ?
But microsoft designed the Hijri date for both of those.
That is more better for Saudi Arabic, and in fact it is not for Iran, Hijri Ghamari is for Saudia Arabic and Hijri Shamsi is for Iran ...
I wanna convert Ghamari to Shamsi, ok ?
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
I think you have to claculate it in your program,windows does not provide it.
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
Hi,
Exactly ...
But how can calculate it ?
I need formula for it !
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
i'm thinking of making lots of libraries (for windows, and/or linux) and the problem i keep running into is naming conventions and standards. basically, i'm not sure whether or not to follow naming conventions for every single function and class i write and have perfectly formatted code and such for every library i make. looking at other libraries, they seem to follow various different naming conventions for variables, functions, class names, etc. and use a variety of different libraries like STL and MFC
what im trying to ask is, can anyone fill me in on the basics of standards and naming conventions, which would best satisfy the people who use my libraries?
p.s. i'd also like to know about how to make 1 DLL for the whole library (instead of 4 - debug, release, MT debug, MT release)
thanks
>>Roman<<
|
|
|
|
|
I don't think there is a universal standard for this. I don't really care what conventions you use inside the code. If I were buying it, I would mainly like to see consistency.
If the library is an improvement/replacement for an existing library, make the API as compatible as possible.
I don't think you can build a single .dll. Even if you manually constructed a file with 4 entry points for each function, there would be no way to resolve which entry point to use, since the call gives no indication of the mode it was built in.
P.S. What sort of library are you building? Is it for public consumption or internal use. Will it be fore sale?
Good luck,
Bill
|
|
|
|
|
This is probably going to make some of you laugh but here goes
I have a dialog base MFC app with a list control in report view. How can i copy the data in the list view class to another list view class in a child window? I have the child window pop up mapped to a button event. Would i have to create a loop to copy the data? or is there a faster way. Please help, Thanks!
|
|
|
|
|
|
If you use the item data field of each list control entry, you could quickly copy just the item data instead of all the column text. In general, this is a better design pattern (Model-View) than stuffing text in a list control. In other words, a list control should know how to render itself based on the data model.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Well, I am using the LV_ITEM datatype for the list. So I guess I should make it into a member variable and access it through scoping?? But wouldn't I still have to get the number of items and loop through inserting each one? I'm not quite understanding your suggestion ravi Can you please be a little more specific, like including a declaration example and how I should initialize my child diag class and/or duplicate list view class. Thanks for the replies!!
|
|
|
|
|
Ravi Bhavnani wrote:
If you use the item data field of each list control entry, you could quickly copy just the item data instead of all the column text
But this is assuming that he has only one column of data. What if he has 2 or more cols?
Nish
My most recent CP article :-
A newbie's elementary guide to spawning processes
www.busterboy.org
|
|
|
|
|
Nish [BusterBoy] wrote:
But this is assuming that he has only one column of data.
Actually, no. The item data is just a pointer to a blob of data that can be rendered in any manner in the list control. For example, the item data could point to a CMumble object that has multiple members, each rendered in a column. This is how Java's Table UI widget works. It's nice and clean because it separates the data model from the rendering.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
so how exactly should I declare this item data type?? I looked around MSDN and it seems like my LV_ITEM datatype is not quite the same as what you are talking about ravi. How should I declare that kind of datatype and some example of how to use it would be awesome! Thanks for all the comments!
|
|
|
|
|
You can associate application specific data with items in a list control by calling CListCtrl::SetItemData() . Typically, the item data (a DWORD ) is a pointer to an object whose information will be rendered by the list control for that row.
Aside:
The object represents the "model" and the list control (whose only job is to render items and be responsive to mouse and keyclicks) represents the "view" and "controller" in the MVC (model-view-controller) design pattern.
Your (owner drawn) list control will display the appropriate information in each column based on the item's data. When you want to copy chunks of one list control to another (or even within the same list control), all you need to do is to update the target list control's item data for the appropriate rows and invalidate the list control (to force a redraw). You don't need to copy the actual column data of the rows being copied.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
That's a really cool solution! I seemed to have missed that member function looking through MSDN . That should solve my problem, thanks for everyone's help!
|
|
|
|
|
|
Does anyone have any idea how to get an HICON to a SPECIFIC RESOLUTION icon... I want something similar to ::LoadIcon(...) but it won't let me specify the res that i want. The only thing i found that will even do this is ExtractIconEx but that only works on a file and it would be pretty stupid to extract icons from the running exe... This is very annoying.. anyone got any ideas?
Joseph Dempsey
jdempsey@cox.rr.com
Joseph.Dempsey@thermobio.com
"Software Engineering is a race between the programmers, trying to make bigger and better fool-proof software, and the universe trying to make bigger fools. So far the Universe in winning."
--anonymous
|
|
|
|