Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 216
  • Last Modified:

Change Location on Runtime

Hi. I want to change the location of the label (move on the statusbarstrip to left or right) which is on the statusbarstrip during resizing of the mdiform. Thanks
0
gokhanoz
Asked:
gokhanoz
  • 5
  • 3
1 Solution
 
Bob LearnedCommented:
1) Are you talking about a Label on the StatusBarStrip itself?

2) Setting a control's location to a point:
Me.Label1.Location = New Point(50, 50)

3) You could set the anchor, like Bottom, Right to keep the label stuck to the bottom-right side of the screen

Bob
0
 
gokhanozAuthor Commented:
OK but anchor is not present in the property list. And the location is not seems to be a member of it.
0
 
Bob LearnedCommented:
So you are talking about a Label control on the StatusBarStrip.  How do you want to change the location of the label?

Bob
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
gokhanozAuthor Commented:
Statusbarstrip is on the MDIparent form, and  label control is on that statusbarstrip. I want to use anchor property to stuck the control to the rigth side of the screen. But it seems that anchor is not presenet on the property list.  So I prefer to move that control to that right or the left depending the new shape of the mdiparent. Thats what I want to do. Thanks.
0
 
Bob LearnedCommented:
While the Anchor is not a browsable property, you can set it in code (at run-time):

Me.Label1.Anchor = AnchorStyles.Bottom Or AnchorStyles.Right

Bob
0
 
gokhanozAuthor Commented:
Bob, I am sorry but its not working. I am testing like that, I added a button, in the click event I wrote that code, and tested on run-time. label is keeping its original position..
0
 
Bob LearnedCommented:
How many other controls are on the StatusStrip control?

Bob
0
 
Bob LearnedCommented:
I set up a simple test form with 2 labels, adding a spacer label to the left:

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.AdjustSpacing()
    End Sub

    Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
        Me.AdjustSpacing()
    End Sub

    Private Sub AdjustSpacing()
        Me.Label2.Width = Me.StatusStrip1.Width - Me.Label1.Width - 20
    End Sub

End Class

The width of the left label, pushes the display label to the right to a position where it is anchored to the right side of the StatusStrip.

Bob
0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

  • 5
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now