How to prevent WinForm location from changing
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: How to prevent WinForm location from changing

  1. #1
    Join Date
    Jun 2006
    Posts
    644

    How to prevent WinForm location from changing

    Hi all,
    I am having a winform where in I am using some panels and other controls that are outside as well as inside of the panels. In the Form class, I have created certain visibility change events and added event handlers to these events. I also change the location of a few controls in the Form on selection of radio buttons to change the controls checked/visible/populated and so on. However, while I fire a selection change event for the radio button, the location of form changes as well and in some cases, it changes to the location of the control that was clicked or the point of mouse click or some times the form even goes out of bounds of screen partially. Can anyone know the reason for this? Any suggestions are much appreciated.
    Thanks,
    Bhushan

  2. #2
    Join Date
    Jan 2006
    Location
    Chicago, IL
    Posts
    14,982

    Re: How to prevent WinForm location from changing

    Probably a mistake in the code. If you want to help, you'll have to provide some of the code in question. Use CODE TAGS
    Code:
      String myCode()
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Jun 2006
    Posts
    644

    Re: How to prevent WinForm location from changing

    Hi,
    There are certain radio buttons and panels whose location is being changed on selection of radio buttons. I have looked into the code and that is all there is to it. Now, does this cause an invalidate for the control and is followed by Form.Invalidate()? And even if it is so, then why should the location of the main form change? Could it be that the controls were going out of bounds and hence the form's default location was changed. I am sorry that I cannot post the code as it is huge, but try to resolve this and then post the specific portion of the code.
    Thanks,
    Bhushan.

  4. #4
    Join Date
    Jan 2006
    Location
    Chicago, IL
    Posts
    14,982

    Re: How to prevent WinForm location from changing

    Then, I'd recreate a small sample, and attempt to reproduce your results. Add some controls to a form, and see what happens. If it happens then, you could post your small app's code for us to look at. Otherwise, we can't help you.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

Posting Permissions

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


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center