Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I don't know where to start this one

Status
Not open for further replies.

Aldragor

Programmer
Sep 27, 2002
4
CA
I want to set a property when dropping my ocx in a form. More specificaty, I want to set a property depending on witch of Height or Width is the bigger the first time my object is created on the user form using my component. Example: my component draw a line and depending of the box size, when creating the line, the line will be vertical or horizontal.

If you have any clues or hints, it will be appeciated.
 
The following determines which side is bigger every time the control is re-sized. This simple example just changes a labels caption depending on the height and width, but you could do anything you want inside the IF clauses. If you really want to do this only the first time the control is placed on the form, I think you will have to setup (and save) values to a property to tell you that the control has been placed. (Maybe a private boolean property that is set to true after the control is placed?)


Private Sub UserControl_Resize()

If UserControl.Height > UserControl.Width Then
Label1.Caption = "Taller"
Else
Label1.Caption = "Wider"
End If

End Sub
 
It's appreciated I will check this option.

Thanx
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top