 |
|
|
I'm using vs 2005 C++ MFC application i want to load a bitmap,GIFF,JPG(any image) from a file and want to implement a tracker to the bit map. For resizing Can anybody explain how to do this
Thanks Thilani
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
hi, I am new to MFC. so can you please give me the source code of this project thanks in advance
luv and luk raja sekhar bandaru
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
 |
|
|
Hi I did not design this program for the deletion of the objects. this program is only for the demonstration of trackers. if i get a chance i'll improve it in future.
Thanks Khurram
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
when the application running and i draw a rectangle,i find that about 50M memory is occupied.how to deal with this problem?
Live and learn
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Yes that is true when u start drawing the rectangle it takes memory and you must have seen the code to know why it happened. in C# trackers cannot be drawn directly so if i use the traditional approach of drawing (by drawing one rect then clearing it and again drawing that rectangle with different values) then the effect of drawing of rect will be full of flickering and believe me it is really bad that is why i used the double buffering method. here u can apply some optimization techniques. for example
1. On every mouse change event one bitmap is made and drwing is done on it and previous bitmap is deleted. u can increase the interval of this event, for example write a code which is executed only when mouse change is significant. right now it draws when one pixle change is detected u can increase the no of pixel to 2 or more on which the event should occur.
2. currently bitmap size is equal to the size of the form. create bitmap equal to the size of the drawing rect and draw this bitmap where the user is drawing the new rectanlge. it will definetly decrease the bitmap size.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Thanks you so much for such wonderful source code, I m looking for this such a long time. Keep it up the good work. 
Kate
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
I was searching for this script for a long time. Thanks for the post. But i saw this code only after developing my own control which fixes most of the bugs found in this script. I'll be posting that code here after some more finishing touches.
|
| Sign In·View Thread·PermaLink | 1.00/5 (1 vote) |
|
|
|
 |
|
|
There is a method in C# which will draw a tracker it can be called as follows
ControlPaint.DrawReversibleFrame(Rectangle, BackColor, FrameStyle);
ControlPaint is in the System.Windows.Forms namespace.
Basically call it the first time to draw it, then call it a second time to erase it.
|
| Sign In·View Thread·PermaLink | 1.50/5 (2 votes) |
|
|
|
 |
|
|
 |
|
|
 |
|
|
A couple other ideas for enhancement:
(1) multiple selection of rectangles (eg. using the CTRL/SHIFT keys and/or rubberbanding)
(2) moving multiply-selected items
Good luck! Dan
|
| Sign In·View Thread·PermaLink | 5.00/5 (1 vote) |
|
|
|
 |
|
|
Hello, This looks good but there seem to be a couple minor bug fixes and additions that would make it better...
(1) The corner resizers are non-operable (only the side resizers seem to work).
(2) When two or more rectangles overlap and the user selects a point in the overlapped area, the last created rectangle is selected (which is correct since it by default has the highest Z-Order). But it would be useful to allow the ability to change the Z-order of the rectangles (maybe using a popup menu).
(3) Along this same line of thought as point #2, it may be useful to have the programmatic option so that a selected item defies the Z-Order (so that if you click a point within a selected rectangle that also falls within a rectangle of a higher Z-Order, that the selected rectangle takes precedence and remains selected). I think this is a better option than forcing the selected object to the top of the Z-Order because that could cause layering problems in non-transparent objects.
Dan
|
| Sign In·View Thread·PermaLink | 5.00/5 (2 votes) |
|
|
|
 |
|
|
Thanx for viewing the article and suggestions
1. the project is made for demo purpose. u can very easily modify the program to make box resizable from any corner or edge. u have to enter code in a switch statement in MouseMove code.
2. also Z-Order issue can easily be solved. making a wrapper class which will have Head and Tail nodes, and sorting the linked list according to user's choice.
Thank you and i am greatfull for yout comments and suggestions.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
You need to change some things for the corners.. First the enumerations.... enum RESIZE_BORDER// keep track of which border of the box is to be resized. { RB_NONE = 0, RB_TOP = 1, RB_RIGHT = 2, RB_BOTTOM = 3, RB_LEFT = 4, RB_TOPLEFT = 5, RB_TOPRIGHT = 6, RB_BOTTOMLEFT = 7, RB_BOTTOMRIGHT = 8 }
Second setting the expand the Form1_MouseDown to include the new cursors this.Cursor == Cursors.SizeNESW or this.Cursor == Cursors.SizeNWSE
case MOUSE_MODE.MM_OBJ_SELECTED: { if(m_enMM == MOUSE_MODE.MM_OBJ_SELECTED && (this.Cursor == Cursors.SizeNS || this.Cursor == Cursors.SizeWE || this.Cursor == Cursors.SizeNESW || this.Cursor == Cursors.SizeNWSE )) { return; // do nothing, it requires resizing of the selected object. }
Modify Cursor CursorCheck(Rectangle rc, Point pt, ref int enResult) to include the corner selection points...
Add to the end.... else if(m_TopLeft.Contains(pt)) { enResult = 5; return Cursors.SizeNWSE; } else if(m_TopRight.Contains(pt)) { enResult = 6; return Cursors.SizeNESW; } else if(m_BottomLeft.Contains(pt) ) { enResult = 7; return Cursors.SizeNESW; } else if(m_BottomRight.Contains(pt)) { enResult = 8; return Cursors.SizeNWSE; } else return Cursors.Default; Then modify Form1_MouseMove to include the corners....
switch(this.m_enRBorder) { case RESIZE_BORDER.RB_TOP: SelectedNode.rc.Height = SelectedNode.rc.Y + SelectedNode.rc.Height - e.Y; SelectedNode.rc.Y = e.Y; break; case RESIZE_BORDER.RB_TOPLEFT: SelectedNode.rc.Height = SelectedNode.rc.Y + SelectedNode.rc.Height - e.Y; SelectedNode.rc.Y = e.Y; SelectedNode.rc.Width = SelectedNode.rc.X + SelectedNode.rc.Width - e.X; SelectedNode.rc.X = e.X; break; case RESIZE_BORDER.RB_TOPRIGHT: SelectedNode.rc.Height = SelectedNode.rc.Y + SelectedNode.rc.Height - e.Y; SelectedNode.rc.Y = e.Y; SelectedNode.rc.Width = e.X - SelectedNode.rc.X; break; case RESIZE_BORDER.RB_RIGHT: SelectedNode.rc.Width = e.X - SelectedNode.rc.X; break; case RESIZE_BORDER.RB_BOTTOM: SelectedNode.rc.Height = e.Y - SelectedNode.rc.Y; break; case RESIZE_BORDER.RB_BOTTOMLEFT: SelectedNode.rc.Height = e.Y - SelectedNode.rc.Y; SelectedNode.rc.Width = SelectedNode.rc.X + SelectedNode.rc.Width - e.X; SelectedNode.rc.X = e.X; break; case RESIZE_BORDER.RB_BOTTOMRIGHT: SelectedNode.rc.Height = e.Y - SelectedNode.rc.Y; SelectedNode.rc.Width = e.X - SelectedNode.rc.X; break; case RESIZE_BORDER.RB_LEFT: SelectedNode.rc.Width = SelectedNode.rc.X + SelectedNode.rc.Width - e.X; SelectedNode.rc.X = e.X; break; }
should work then
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Flickering is one of those things that ranks right up there as a developer's worst nightmare. If this is one technique that helps in that department, I'm all for it.
Any chance you can come up with a C++ sample?

William
Fortes in fide et opere!
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
A almost real good example of am OOD draw sample can be found in the MFC Samples look for DrawCli, it's quite easy to implement you own Object drawing framework, I'm current completing a project which always the user to place cells on a canvas, quite similar to Visio. 
Once you get basic cells on the canvas, the tricky bits are Pan and Zoom and I'd love to see this implemented in .net without resorting to importing a raft of reference to USER32.DLL and GDI32.DLL - just a thought?
To iterate is human, to recurse is devine.
|
| Sign In·View Thread·PermaLink | 4.00/5 (1 vote) |
|
|
|
 |