|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Attaching controls in runtime...adding a PictureBox to the form. I create the picturebox but it doesn't display on my form. I have tried Controls.Add(pic) but that doesn't work either. Any Help would be much appreciated :). here is my code so far Knight Function CreateSurface(ByVal frm As Form) As PictureBox Dim pic As New PictureBox Dim loc As Point loc.X = frm.Location.X loc.Y = frm.Location.Y pic.Name = "surface" pic.Location = loc pic.Left = frm.Left pic.Top = frm.Top pic.Width = frm.Width pic.Height = frm.Width pic.BackColor = Color.Black pic.Visible = True pic.Show() CreateSurface = pic End Function this seems to work for me
Dim pic As PictureBox pic = New PictureBox Me.SuspendLayout() pic.BackColor = System.Drawing.Color.FromKnownColor(KnownColor.Black) pic.Size = New System.Drawing.Size(50, 50) pic.BorderStyle = BorderStyle.Fixed3D pic.Location = New System.Drawing.Point(60, 60) Me.Controls.Add(pic) Me.ResumeLayout() Show quoteHide quote "Knight" <warhawk0***@sbcglobal.net> wrote in message news:1137435607.003085.64130@g43g2000cwa.googlegroups.com... >I recently converted to VB Net from VB 6 and having troubles with > adding a PictureBox to the form. I create the picturebox but it > doesn't display on my form. I have tried Controls.Add(pic) > but that doesn't work either. Any Help would be much appreciated :). > > here is my code so far > > Knight > > Function CreateSurface(ByVal frm As Form) As PictureBox > Dim pic As New PictureBox > Dim loc As Point > > loc.X = frm.Location.X > loc.Y = frm.Location.Y > > pic.Name = "surface" > pic.Location = loc > pic.Left = frm.Left > pic.Top = frm.Top > pic.Width = frm.Width > pic.Height = frm.Width > pic.BackColor = Color.Black > pic.Visible = True > > > pic.Show() > CreateSurface = pic > End Function > "Knight" <warhawk0***@sbcglobal.net> schrieb: Mhm... This should not make such a big difference.> Thank you very much, I was missing Suspend/Resume -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/>
ListView SortKey
Dynamic variable/object name reference. how to do in VB.NET? Guidance on remoting Image dimensions? How to convert a selectedIndex to SelectedValue for ComboBox Multiple Catches in Try/Catch ms.public.dotnet.vb.general - an "ex group" Append to XML? Enter key vs Return key Comm Ports |
|||||||||||||||||||||||