Results 1 to 4 of 4

Thread: [2005] GDI+ question, Image VS Graphics object

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2006
    Location
    Surabaya, Indonesia
    Posts
    163

    [2005] GDI+ question, Image VS Graphics object

    If I want to draw an object that have to update frequently, should I use an image and update it's location, or I draw it with GDI+ ? Which one you would recommend and why?

    Let me give you an example.

    Suppose I want to make an analog clock. However, I don't want to just use lines. To make it more complex and nicer, I want to use a rectangle for it arms. A perfect example for this case is Clock from windows sidebar on Vista.

    I will divine into 2 parts, background and it's arm. The main reason for this problem, is performance. Imagine that you have a form which display multiple analog clock displaying time in several countries.

    So, here's the question:
    1. For background: Should I use a fixed background (with an image), or drawing with GDI+ ?
    2. For it arms. Should I use an image and update it's location periodically, or draw them completely with GDI+ ?

    For those questions, please tell me your opinion about what shoud I use and why.

    Regards

    Michael

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    Re: [2005] GDI+ question, Image VS Graphics object

    You should use a PictureBox for the face and GDI+ to draw the hands. Performance is not an issue with the face and using a PictureBox is easier. Using GDI+ for the hands is both simpler and better performing.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3
    PowerPoster sparrow1's Avatar
    Join Date
    May 2005
    Location
    Globetrotter
    Posts
    2,820

    Re: [2005] GDI+ question, Image VS Graphics object

    Quote Originally Posted by michaelrawi
    If I want to draw an object that have to update frequently, should I use an image and update it's location, or I draw it with GDI+ ? Which one you would recommend and why?

    Let me give you an example.

    Suppose I want to make an analog clock. However, I don't want to just use lines. To make it more complex and nicer, I want to use a rectangle for it arms. A perfect example for this case is Clock from windows sidebar on Vista.

    I will divine into 2 parts, background and it's arm. The main reason for this problem, is performance. Imagine that you have a form which display multiple analog clock displaying time in several countries.

    So, here's the question:
    1. For background: Should I use a fixed background (with an image), or drawing with GDI+ ?
    2. For it arms. Should I use an image and update it's location periodically, or draw them completely with GDI+ ?

    For those questions, please tell me your opinion about what shoud I use and why.

    Regards

    Michael
    Hi,

    Here's an example how to draw an Analog Clock.

    http://www.codeproject.com/vb/net/analogclock.asp

    Wkr,

    sparrow1
    Wkr,
    sparrow1

    If I helped you, don't forget to Rate my post. Thank you

    I'm using Visual Studio.Net 2003 and
    2005
    How to learn VB.Net Create setup with VB 2005 Drawing for beginners VB.Net Tutorials GDI+ Tutorials
    Video's for beginners

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Sep 2006
    Location
    Surabaya, Indonesia
    Posts
    163

    Re: [2005] GDI+ question, Image VS Graphics object

    Thanks for the replies.

    Well, actually I didn't want to create an analog clock. I just want to know about the concept using fully GDI+ code or combine GDI+ with fixed image. I want to know which is better.

    @sparrow1: thanks for the code. I'll look on to it.

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