Results 1 to 6 of 6

Thread: Is there a faster way to draw lines and arcs than DrawLing and DrawArc?

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2018
    Posts
    1

    Is there a faster way to draw lines and arcs than DrawLing and DrawArc?

    Best Backpacking Tents

    1. LIGHTWEIGHT: Keeping your climbing tent lightweight is basic. It is one of the best things in your pack and accordingly, one of the best opportunities to save weight. A light load will restrict the impact on your knees and your back. You moreover need to capitalize on your move without the mind-boggling moaning and groaning. The articulation "ultralight" is to some degree novel to first-time wayfarers and might seem like the exceptional end of the range.
    best backpacking tent 2 person gitlab
    Ultralight is transforming into the new standard for ALL pilgrims nonetheless. You don't have to relinquish comfort, space and quality for a preservationist and ultralight climbing tent any more. The little particular brands have formed into industry pioneers and the past business pioneers have desperately acclimated to shave their mechanical assembly weight. As a general rule...

    2. ENOUGH SPACE: You will be outside moving around as a general rule so don't weight exorbitantly about getting a sumptuous tent imperial living arrangement. In any case, you needn't bother with the dreaded pine box bivvy-like tent. Sitting tight for the duration of the day for a whirlwind to go in a little case can be sad. You require a tent adequately generous to effectively set down in with two or three creeps over your head and underneath your feet. You moreover require a rooftop stature with no not as much as a few feet over your face to scrutinize or (semi) sit up inside.

    3. Straightforward ENTRY AND EXIT: Some tents are shaped like a tee-pee pyramid, others more like half-round igloos, and some like rectangular precious stones. Generally a matter of individual tendency.

    My gigantic thing is post region. I find side board passages are ordinarily less requesting to come all through than front board gateways. About tent layouts have the pole remaining straight up in the midst of the tent. I especially picked NOT to fuse any protected houses like that on this summary. Essentially recollect where the assistance plot for your tent is found.
    https://github.com/geraldegivens/bes...e-Right-One%3F
    4. Immaterial GUYLINES AND POLES: Tents arranged with a couple of shafts all things considered grow more space. In any case, more shafts suggests more things to setup, more things to direct and more things with the likelihood to break.

    I vote less posts and less guylines - sort out a direct arrangement. Essential designs are more straightforward to setup, and in addition are generally more solid. The more lopsided and less streamlined your tent is, the more implausible it is to manage a significant storm or brisk breezes.
    best backpacking tent 4 person
    5. Shower FLOOR: Your tent will have two sorts of surfaces: a canvas like surface used to spurn water and a work like surface used to close out bugs and engage ventilation. A shower floor infers the covering like surface lines the floor and no not as much as two or three crawls over the ground before it meets the work dividers. This downsized covering like 'shower' can be helpful to shield overpowering storms from pouring in. Fortunately, shower floors have ended up being standard in the best climbing tents.
    Last edited by geralde.givens; Jun 18th, 2018 at 02:15 PM.

  2. #2
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    39,043

    Re: Is there a faster way to draw lines and arcs than DrawLing and DrawArc?

    If it flashes white, then the drawing speed isn't the problem. What is happening is that the background is being cleared to white, then redrawn. Seting DoubleBuffering to True should help considerably.
    My usual boring signature: Nothing

  3. #3
    PowerPoster i00's Avatar
    Join Date
    Mar 2002
    Location
    1/2 way accross the galaxy.. and then some
    Posts
    2,388

    Re: Is there a faster way to draw lines and arcs than DrawLing and DrawArc?

    Also ensure that you are using Paint ... rather then .CreateGraphics ...

    IMHO CreateGraphics should NOT exist ... as it is evil.

    Kris

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,348

    Re: Is there a faster way to draw lines and arcs than DrawLing and DrawArc?

    Those methods are the right ones to use but you are using them wrong. Show us what you're doing and we can likely tell you what's wrong with it. As suggested, you should be doing all your drawing in the Paint event handler of the control you want to draw on. If possible, that control should be a PictureBox, which is already optimised for GDI+. You store the data that represents your drawing in fields and you use those fields in the Paint event handler. The code in that event handler does all the drawing every time. That's not the slow part. The slow part is painting pixels on the screen, so that's the part you want to minimise. The way to do that is to call Invalidate whenever you make a change that could affect the drawing and specify the smallest possible area to repaint. That will paint only the pixels within that area and thus make the repaint as quick as possible.
    Last edited by jmcilhinney; Apr 19th, 2018 at 06:39 AM. Reason: Fixed typos

  5. #5
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,348

    Re: Is there a faster way to draw lines and arcs than DrawLing and DrawArc?

    Quote Originally Posted by i00 View Post
    IMHO CreateGraphics should NOT exist ... as it is evil.
    Presumably the OnPaint method calls CreateGraphics so it's needed from that perspective, but could probably be Private to the Control class. Maybe there are times that it is appropriate to call it directly but, I have to admit, I've never seen one.

  6. #6
    Sinecure devotee
    Join Date
    Aug 2013
    Location
    Southern Tier NY
    Posts
    6,582

    Re: Is there a faster way to draw lines and arcs than DrawLing and DrawArc?

    An example of rotating "pointers on a dial", i.e. a clock was posted here.
    If you click on the radio buttons a second form is shown where you can drag to rotate each hand independently. You'll see that it should rotate quickly and smoothly without any flashing.

    The drawing is updated by changing the hand angle values, and then invalidating the picturebox which causes the Paint event to fire, which uses the values to draw the hands at the specified current angles.
    The code made be more complicated than what you need, but the point is that drawing in the Paint event is normally where you want to update the display of a control, as already mentioned by others.

    Another, more complex perhaps, example of an instrument that has rotation and other movement in it can be found here.
    It was a start of an example of an ADI instrument (an avionics instrument) that I originally wrote in C# for someone new to doing WinForm graphics. I then converted that example to VB. Since it was written to "teach" some of the basic capabilities of drawing using graphic transforms, it has built into it a "Step mode", where you can step through the drawing process one step at a time, and a description of what that step is doing and what code is being executed is shown. The drawing progress is exited at that step, so the rest of the drawing isn't done so you see the results up to that step, but the whole drawing. This allows you to still manipulate the values (roll, pitch, etc). and see the effects on the drawing up to the given step.

    In post #6 of that thread, is also another example I did for someone that had multiple rotating things being drawn, but that isn't related to drawing a dial or gauge, but is somewhat entertaining even if it is rather pointless.

    p.s. You really should have posted an example of the code you were using to draw so we could have evaluated what you were doing from the start. There are many ways to draw, and many of them could be incorrect, and many of them could be improved upon, so asking if there is a better way to do the drawing is technically unanswerable without having the original method used to compare against.
    The practical answer is most likely yes, since there is almost always a better way to do anything.

    p.p.s And to be clear, although I'm rotating images that doesn't imply that drawing an arc and lines would not be an acceptable method of doing what you're doing. Drawing the lines would likely be faster in your case and the issue is just the (assumed) fact that you are not drawing in a double buffered fashion. Drawing doubled buffered is the default mode of drawing if you do your drawing in the Paint event of a picturebox. If you want to draw directly to the form, then set the DoubleBuffered property to True and draw in its Paint event, although since the form usually has a lot of things to do itself, in the past, I've found it faster to draw in a picturebox on a form than on the form itself. But, to be fair, that was back when I was using VS2005. I've just kept that bias and generally don't draw directly on the form as a rule.
    Last edited by passel; Apr 19th, 2018 at 06:27 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width