Picturebox Question  
Author Message
newbieneedshelp





PostPosted: Visual Basic General, Picturebox Question Top

I currently have a picturebox that I am using as a "ball" to bounce around my form. The problem is that image is circle and the picturebox is square so the corners of picturebox are causing issues. How do make a round picturebox or what would be other solutions to the problem

Thanks


Visual Basic6  
 
 
ahmadifx





PostPosted: Visual Basic General, Picturebox Question Top

Hi Lucas,

Well I dont understand your problm clearly. Does your program generate barcode from given data or something.. Well you could opt for storing the file path instead of the binary in the database ....



 
 
ahmedilyas





PostPosted: Visual Basic General, Picturebox Question Top

you may need to create your own circle/ellipse using the System.Drawing namespace.

 

something like.... 

// create a pen
  dim blackPen as new Pen(Color.Black, 1)


  // create a rectangle in which the circle will be drawn
  dim rect as new Rectangle(20, 60, 150, 150)

   Graphics g as new Graphics
  g.DrawEllipse(blackPen, rect)

 

does this help



 
 
Lucas Conde





PostPosted: Visual Basic General, Picturebox Question Top

The bar code is a string, so I store the string in the database instead of the binary. The problem is when I try to bind it I need to convert it to an image because the PictureBox expects an Image.

So, can I would have to convert it before binding.

I'm binding using this line of code.

PictureBox.DataBindings.Add("Image", myTable, "barcode");


 
 
spotty





PostPosted: Visual Basic General, Picturebox Question Top

I was thinking that you should be able to create a Gif file with the outer area set to a color which is transparent and then set the background color to transparent.

PictureBox1.BackColor = Color.Transparent
PictureBox1.SizeMode = PictureBoxSizeMode.AutoSize

If that doesnt work for you then you can check out something like this project which appears to support transparency.

http://www.codeproject.com/vb/net/rimage.asp


 
 
Lucas Conde





PostPosted: Visual Basic General, Picturebox Question Top

Well I gave up storing the string and now I'm storing the image in the DataBase, but I encountered another problem that I can't solve.

I implemented the CurrencyManager using this link http://msdn2.microsoft.com/en-us/library/system.windows.forms.currencymanager.aspx

When I try to bind it it give me an error, because it expects a Image and i'm returning an Binary to it. So it only works when I don't bind the PictureBox, the question is, when I add a new record all fields are updated normally in the CurrencyManager, only the PictureBox don't get updated because it's not binded. Is there a way to send the information of the Binary field to the CurrencyManager programmatically.

Thanks.


 
 
Lucas Conde





PostPosted: Visual Basic General, Picturebox Question Top

I solved my problem, I went back to String value and made a method that shows the barcode when I'm paging the record set.

Thanks.