Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

What component to use for drawing graphics in Visual Studio 2005

Hi,
I am new to Visual Studio and I need to make an application with graphics (mostly lines and arcs). My question is what component you use for drawing graphics (like in Borland Builder is TPaintBox component). To be more specific, which component you use to take the device content from in Visual Studio.
Thank you,
Denny_B
/*edited*/ The application will be dialog based.
«1

Comments

  • suhardi85suhardi85 Posts: 4Member
    Picturebox

    : Hi,
    : I am new to Visual Studio and I need to make an application with
    : graphics (mostly lines and arcs). My question is what component you
    : use for drawing graphics (like in Borland Builder is TPaintBox
    : component). To be more specific, which component you use to take the
    : device content from in Visual Studio.
    : Thank you,
    : Denny_B
    : /*edited*/ The application will be dialog based.

  • SephirothSephiroth Fayetteville, NC, USAPosts: 1,035Member
    : Picturebox
    :
    : : Hi,
    : : I am new to Visual Studio and I need to make an application with
    : : graphics (mostly lines and arcs). My question is what component you
    : : use for drawing graphics (like in Borland Builder is TPaintBox
    : : component). To be more specific, which component you use to take the
    : : device content from in Visual Studio.
    : : Thank you,
    : : Denny_B
    : : /*edited*/ The application will be dialog based.
    :
    :
    Is this a .NET project?
    -[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/green][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h[/red][/b][/italic]
  • Denny_BDenny_B Posts: 70Member
    : : Picturebox
    : :
    : : : Hi,
    : : : I am new to Visual Studio and I need to make an application with
    : : : graphics (mostly lines and arcs). My question is what component you
    : : : use for drawing graphics (like in Borland Builder is TPaintBox
    : : : component). To be more specific, which component you use to take the
    : : : device content from in Visual Studio.
    : : : Thank you,
    : : : Denny_B
    : : : /*edited*/ The application will be dialog based.
    : :
    : :
    : Is this a .NET project?
    : -[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/gre
    : en][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h
    : [/red][/b][/italic]

    No, the project is not .NET. It is a stand alone simple .exe project.
    Is the Picturebox mentioned above Picture Control?
    Thanks for your time and effort to help.
    Denny_B

  • suhardi85suhardi85 Posts: 4Member
    : No, the project is not .NET. It is a stand alone simple .exe project.
    : Is the Picturebox mentioned above Picture Control?
    : Thanks for your time and effort to help.
    : Denny_B
    :
    :

    u want a simple program for drawing??
    i'm making one program like paint, maybe i can give u when i've done.. ^^
    i'm thought u just asking for the component for drawing image.
    hehehe.....
  • Denny_BDenny_B Posts: 70Member
    : : No, the project is not .NET. It is a stand alone simple .exe project.
    : : Is the Picturebox mentioned above Picture Control?
    : : Thanks for your time and effort to help.
    : : Denny_B
    : :
    : :
    :
    : u want a simple program for drawing??
    : i'm making one program like paint, maybe i can give u when i've
    : done.. ^^
    : i'm thought u just asking for the component for drawing image.
    : hehehe.....
    :

    Oh thanks,
    I have the application writen already in Builder C++, but I am not really happy with some limitations of Builder C++ in graphics (using Canvas object for drawing), so I thought I would migrate to Visual C++, but it's hard for me to understand how everything works in Visual C++, user interface is killing me. I can't do simple things, which takes me seconds in Builder C++, I am locked in it.
    The original question was what component should I use for drawing lines and arcs in Visual C++.
    I have to decide which way to go,
    Denny_B
  • Daz_86Daz_86 Posts: 3Member
    Are you after a GUI to draw with, or do you mean to draw programatically? If you need to draw programatically you can use the system.drawing namespace in .NET to perform drawing, draw arcs and lines etc.. you have to handle the OnPaint Event of a form or control in order to gain access to the "graphics" object which is sent in the event args of the event.. you can then use the graphics object programatically in the drawing!


  • Denny_BDenny_B Posts: 70Member
    Thanks Daz, this is what I meant. You mentioned form or control. Which control is the best for drawing? I want to make a simple 2D editor, so the user can draw lines and arcs.
    Regards,
    Denny
  • Daz_86Daz_86 Posts: 3Member
    If you create a new "User Control" in your project, you can then add that control to any forms in your application, so its probably better to create a new user control to act as the "canvas" - i.e the actual thing that will be drawn on. You can then add the canvas / control to a windows form, and postion it on the form as needed, so its kept seperate from the form and that might be easier to work with from a UI perspective, rather than drawing directly on the form itself, but its entirely your choice of design.

    As i mentioned before, you would then probably need to add some code to that user control to handle the OnPaint() event, and thats where you will have access to the Graphics obect, and thats the opportune moment to do any drawing thats required using the system.drawing namespace classes with the graphics object of the control.. Hope that helps.. ;)
  • Daz_86Daz_86 Posts: 3Member
    - oh and sorry to answer your question a bit better, there isnt really a standard control that you could use from the toolbox in .NET that would give you ie a "canvas" that a user could draw on. I suspect that you would need to start with a User Control as i mentioned in my pevious post, and then if you wanted the user to be able to draw on it, you could have to add code to it so that you could handle the relevant mouse events to work out when the user started and stopped drawing and then draw the relevent graphics.. you'd have to capture the x,y mouse coordinates to aid you in tht i guess..
    Alternatively you could hunt around for a .NET control that someone else may have done that allready handles this kind of "canvas" functionality.. but thats cheating.
  • Denny_BDenny_B Posts: 70Member
    Thanks Daz for your answers. This explains what I need as there is no standard control for drawing in Visual C++. I have the code to draw the stuff (lines and arcs) but it's in Borland Builder. I was thinking to write the program in Visual C++, but the learning curve if slow (as is my brain).
    Thanks for your help, I apreciate it,
    Denny_B
«1
Sign In or Register to comment.