Create controls via prop pages

Create Label Controls Via User Control Property Page

Page 1 of 1

2 Replies - 1930 Views - Last Post: 14 February 2008 - 07:43 AM Rate Topic: -----

#1 devonknows  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 30-November 06

Create controls via prop pages

Post icon  Posted 11 February 2008 - 01:29 PM

Hi, This is something ive been looking for, for a long while now, and thats how to add controls via tha property pages, for example when you click on 'Insert Button' on the Toolbar control in Visual basic 6, or the 'Insert Panel' on the Status bar, what i want to do is add a label when the user clicks 'Insert Label' on my custom property page for my Custom User Control.

Now ive got a sub written in were i can load the information and create the labels at runtime, but this is inpractical for me, because i ahve to load all the information through the Form_Load Event, which takes time to process the information, plus i have to Run the project in order to see what it looks like.

Is there any help help you can give me on this


Kind Regards, Devon

EDIT *:
P.S I have written a code that allows me to add the items at runtime but, it is not exactly user friendly nor does it give them the option, plus if i want a load of labels withing different controls, its going to take up alot of room on the Form_Load(). Ill show you the code, maybe it can be adapted in some way shape of form. Thanks (Labels Get Stacked Above Each Other Worked with certain amount of space between them) And duplicated the lblCall(0) label and imgCall(0) image.

This Is The Form_Load() code i use to add a label
With wtbInsert
		.AddItem "Insert DVD", "frmInsertDVD", ilIcons.ListImages.Item(1).Picture
End With


And This is the Sub...
Public Sub AddItem(strLabelTitle As String, strFormName As String, _
					Optional Picture As IPictureDisp)
	
	'//Store The Information
	With LinkList
		.FormTitle.Add strFormName
		.LabelTitle.Add strTitle
	End With
	
	Dim cnt As Integer
	cnt = LinkList.FormTitle.Count

	'//Work Out Height of User Control
	If cnt = 1 Then
		Height = topImage.Height + 510
	Else
		Height = topImage.Height + lblCall(0).Top + CInt(cnt * 330) + 60
	End If

	'//Load New Versions Of The Image
	Load imgCall(cnt)
	Load lblCall(cnt)

	With imgCall(cnt)
		If cnt = 1 Then
			.Top = 120
		Else
			.Top = CInt(CInt(330 * CInt(cnt - 1)) + 120)
		End If
		.Picture = Picture
		.Visible = True
		.Width = 240
		.Height = 240
		.Left = 240
	End With


	With lblCall(cnt)
		.Caption = Chr(32) & strLabelTitle
		.Visible = True
		.Left = 480
		'//Work Out Top Value
		If cnt = 1 Then
			.Top = 120
		Else
			.Top = CInt(CInt(330 * CInt(cnt - 1)) + 120)
		End If
	End With

End Sub



Hope this helps you.
Kind Regards Again.
Devon

This post has been edited by devonknows: 11 February 2008 - 02:34 PM


Is This A Good Question/Topic? 0
  • +

Replies To: Create controls via prop pages

#2 devonknows  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 30-November 06

Re: Create controls via prop pages

Posted 13 February 2008 - 04:33 AM

Just bumping this up hoping someone can help me
Was This Post Helpful? 0
  • +
  • -

#3 LookNAO  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 66
  • Joined: 28-December 07

Re: Create controls via prop pages

Posted 14 February 2008 - 07:43 AM

Devon,

I am not really sure what you are asking...
What you are doing looks right.

If your making things dynamic, you will have to load them on form_load.
I don't understand it takes time to load...???

Yes, running it a thousand times... it's the nature of the beast...

If you have an email, maybe we can take this direct.

JC
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1