From: Andy on 20 May 2010 22:22 I have an app which needs adding to. We need a UC built, and its purpose is to allow the user to position objects in relation to each other. A bit like a map or plan... The user builds the various objects in another part of the app. Line and Circle elements are drawn onto picture boxes, and their parameters are stored as objects suitable for plugging directly into VB's Line and Circle methods. (So, [x1, y1, x2, y2] for a straight line, [x, y, radius, theta1, theta2] for a curved line). So, each object built like this has a height and width, and collections of objects representing all the straight lines and curved lines required. An object can then be rendered as required by digging out the parameters for each line segment. I need to render all of the different objects built as above on a single 'canvas' (Picture Box, I expect), and allow individual objects to be moved by dragging them to a new location (and of course, storing their new X and Y offsets, so that the same arrangement can be reproduced). Each object can take quite a while to render, and I want to avoid having to clear the whole canvas and redrawing everything as the mouse is moved to each new position. It would be handy to have a 'layer' for each object, having a transparent background so that each object is drawn only once, and then can be repositioned simply by moving its layer to a new X and Y offset, other objects remaining visible underneath, should they overlap. That's problem 1. Well, I also have to think about rotating each object (individually). I guess that means providing drag handles, and getting the user to click on a handle to rotate it. But it makes the idea of layers a bit more tricky - I can change X and Y for a layer, but how do I turn it? (Problem 2.) I imagine that these are techniques which CAD and games programmers have been dealing with for a long time - but I doubt if they use VB. Any ideas, folks? Thanks!
From: Schmidt on 21 May 2010 02:58 "Andy" <andrewjellis(a)hotmailnospam.com> schrieb im Newsbeitrag news:C02C312A-E4B8-46EA-A990-0ED2D0F0A3B4(a)microsoft.com... [Alphablending and rendering of different Object-Groups on different layers with different transforms...] LOL, just posted an announcement with regards to a new 2D-drawing-engine for VB which I'm sure will help you definitely, to achieve everything you wrote in a pretty coding-efficient way. Please check-out the Demos, which already cover a lot of the topics you just mentioned (if not all). Olaf
From: Dee Earley on 21 May 2010 05:14 On 21/05/2010 03:22, Andy wrote: > I have an app which needs adding to. We need a UC built, and its purpose is > to allow the user to position objects in relation to each other. A bit like > a map or plan... > > The user builds the various objects in another part of the app. Line and > Circle elements are drawn onto picture boxes, and their parameters are stored > as objects suitable for plugging directly into VB's Line and Circle methods. > (So, [x1, y1, x2, y2] for a straight line, [x, y, radius, theta1, theta2] for > a curved line). So, each object built like this has a height and width, and > collections of objects representing all the straight lines and curved lines > required. An object can then be rendered as required by digging out the > parameters for each line segment. > > I need to render all of the different objects built as above on a single > 'canvas' (Picture Box, I expect), and allow individual objects to be moved by > dragging them to a new location (and of course, storing their new X and Y > offsets, so that the same arrangement can be reproduced). Each object can > take quite a while to render, and I want to avoid having to clear the whole > canvas and redrawing everything as the mouse is moved to each new position. > It would be handy to have a 'layer' for each object, having a transparent > background so that each object is drawn only once, and then can be > repositioned simply by moving its layer to a new X and Y offset, other > objects remaining visible underneath, should they overlap. That's problem 1. > > Well, I also have to think about rotating each object (individually). I > guess that means providing drag handles, and getting the user to click on a > handle to rotate it. But it makes the idea of layers a bit more tricky - I > can change X and Y for a layer, but how do I turn it? (Problem 2.) > > I imagine that these are techniques which CAD and games programmers have > been dealing with for a long time - but I doubt if they use VB. Any ideas, > folks? Redrawing will be quicker/lighter than multiple windows (All it does is redraw it for you :) As long as it is backbuffered (Don't draw each object direct to the canvas), you won't have a flicker. http://hashvb.earlsoft.co.uk/Using_GDI_to_draw_to_a_backbuffer You can then either use controls as handles or draw them and change the mouse cursor as needed. Of course, using DirectX or a proper 2D vector graphics library may be easier. -- Dee Earley (dee.earley(a)icode.co.uk) i-Catcher Development Team iCode Systems (Replies direct to my email address will be ignored. Please reply to the group.)
From: Andy on 21 May 2010 13:06 Sounds good. How do I reach this material? "Schmidt" wrote: > > "Andy" <andrewjellis(a)hotmailnospam.com> schrieb im Newsbeitrag > news:C02C312A-E4B8-46EA-A990-0ED2D0F0A3B4(a)microsoft.com... > > [Alphablending and rendering of different Object-Groups > on different layers with different transforms...] > > LOL, just posted an announcement with regards to > a new 2D-drawing-engine for VB which I'm sure > will help you definitely, to achieve everything you > wrote in a pretty coding-efficient way. > > Please check-out the Demos, which already cover > a lot of the topics you just mentioned (if not all). > > Olaf > > > . >
From: Schmidt on 21 May 2010 13:45 "Andy" <andrewjellis(a)hotmailnospam.com> schrieb im Newsbeitrag news:530BFAC8-B2F5-4C50-BCAC-A1D396682F15(a)microsoft.com... > Sounds good. How do I reach this material? Please look for the "cairo-wrapper... " subjectline - only a few thread-entries away from this one here. Olaf
|
Next
|
Last
Pages: 1 2 Prev: Error 6 line of code? Next: Is it possible to read directly bytes from within my application? |