CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Aug 2013
    Posts
    15

    user size control of an object

    hey all

    just wondering what tool I need to use to allow user size control of an object (a gauge).

    I just want them to be able to click on the gauge to enter size adjustment mode...

    can't figure out which tool to use

    thanks for any help

  2. #2
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,283

    Re: user size control of an object

    Slider?

  3. #3
    Join Date
    Aug 2013
    Posts
    15

    Re: user size control of an object

    hey i'm kinda looking for a code snppet or soemthing to use to allow the user to change size of a control at runtime...

    I see examples for VB, but VS coding is different isn't it?

  4. #4
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: user size control of an object

    Quote Originally Posted by s900t8v View Post
    hey i'm kinda looking for a code snppet or soemthing to use to allow the user to change size of a control at runtime...

    I see examples for VB, but VS coding is different isn't it?
    You mean C# coding? VS is Visual Studio which isn't a language.

    You can figure this out yourself. Start a new project. Add a Control of your choosing and a button to the form. Add a button handler and when clicked, resize the control. Keep the topleft corner of the control the same and just change the width and/or height. Look in msdn for the control properties to change.

    Once you get that working, add a slider to your form, and a change handler to the slider. Now move the code you wrote before in the button handler into the slider handler (using the value passed into the the slider handler to set the width/height).

    What you don't want to do is to try to do/learn this in your mega project. Figure it out in a small project, debug it and get it working before transferring the idea to your large project.

  5. #5
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: user size control of an object

    All that being is said you can dock the controls such that when a user resizes the form, the controls resize as well. That's kind of more common that resizing with a slider.

  6. #6
    Join Date
    Aug 2013
    Posts
    15

    Re: user size control of an object

    oh yeah good idea Thanks

    here is what I have done so far







    basically you can swap layouts, swap between night and day mode (havent done day mode gauge color change stuff yet) and then choose the data input to the gauge, all the data inputs work and the gauge style changes to suit the value range for the respective data input, changing from analogue to digital still uses the same gauge system so it was less coding...

    I could put all the stuff in a table layout panel then dock the panel to the tab, then when the tab is resized the layout panel and all the gauges are too (this is what is done on other tabs) but pppl complain that on tablets/ devices with small screens they have problems.

    the last feature I want to implement is drag size control for users at runtime, and the option to turn the visiblility of individual gauges on/off (easy will do this with checkboxes I think)

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

Featured