Results 1 to 3 of 3

Thread: Creating editable text on a form.

  1. #1
    bobrocks is offline VB.NET Forum Newbie
    .NET Framework
    .NET 3.5 (VS 2008)
    Join Date
    Jun 2009
    Posts
    1
    Reputation
    0

    Creating editable text on a form.

    Hello all,

    I am using VS2008, I need to update a vb6 application that I wrote a while back and make it more user friendly. [EDIT] I am not using any of the vb6 code, this is a complete rewrite.[/EDIT] The application basically creates ZPL based on user inputs, it sends the ZPL to the printer via the parallel port and we have our label. I know there are pre-written pieces of software that do this but I have a few other things going on that are not an option for a pre-written label application.

    The task at hand at this point is creating a form which will display a mock-up of the label and allow the user to create text, rotate it, move it, re-size it etc. I will also have to add in image support a little further down the line but I figured i would keep it simple to start out. This is my first major project in .net (the company has been hesitant to spend the money until now and I haven't had the time to do much on my own.)

    I think the best place for me to start would be with a simple form with a button that allows me to create text and edit it only. I am unsure of the best way to pull this off, should I be using a label, a text box with the design styles turned off or something altogether different that I may not know about?

    To summarize:

    a) What type of object should I be using?
    b) How would I go about creating it?
    c) How should I go about making it movable/editable at runtime?

    As an aside, I am aware that the ThermalLabel SDK would probably be beneficial in this application but the company is not willing to spend anymore on this project. (Trust me, I know what you are thinking.)

    Thanks in advance for any help!

    -Bob

  2. #2
    jmcilhinney's Avatar
    jmcilhinney is offline VB.NET Forum Moderator
    .NET Framework
    .NET 4.0
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Posts
    11,363
    Reputation
    1544
    I think you're going to need to use GDI+ for this. GDI+ allows you to draw basically whatever you want, however you want, wherever you want. You can draw text, lines, shapes, colours and images in any position and orientation directly onto the form or some other control. The problem is that there are no visual objects involved, so there's no editable text or draggable boxes or the like. It's easy enough to do something like provide a TextBox elsewhere and then you update the drawing as the user edits the text, but allowing the user edit in-place or drag drawn objects around, while possible, is not very easy. It's one of those situations where the simpler you want to make things for the user, the more complex the code becomes.

    You may also find that creating this kind of interface is easier in WPF than in Windows Forms.

  3. #3
    InertiaM is offline VB.NET Forum Idol
    .NET Framework
    .NET 2.0
    Join Date
    Nov 2007
    Location
    Kent, UK
    Posts
    661
    Reputation
    226
    As jmcilhinney said, I would personally forget trying to do the in-place editing.

    I would probably design the form with SplitContainers, and then adjust the upper right based on the type of element (text, barcode, rectangle etc etc). The bottom right would be drawn with GDI+, and you could colour the active element differently (eg highlight in red etc).

    I've thrown together an example for you
    Attached Images Attached Images
    Always parameterize your queries - read more here

    "When people discover the center of the universe, a lot of them will be disappointed to find they are not it."

Tags for this Thread

Bookmarks

Posting Permissions

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