Custom controls

  • 12 years ago

    Hi all,

    I have two issues. First: I created two custom  controls one is a custom picture box which draws image with imageattributes (GetTransparentColor returns image.GetPixel(0, 0)), and a second is custom form which has the onPaintBackground overriden:

                Protected Overrides Sub OnPaintBackground(ByVal e As System.Windows.Forms.PaintEventArgs)
                        'MyBase.OnPaintBackground(e)
                End Sub

     

    the problem is when I put a custom picturebox which should show the background of the custom form which should be transparent, but the picturebox shows the default backcolor of the customform (grey) which is not drawn otherwise!

    anyone has any idea hot  to overcome that??

     

    the second issue I am having...

    is it normal that picturebox click event (which only increments a value)  is much slower than ordinary button click event?

     

    Thanks for help

    Best regards

    Grega 

     

    PS: I forgot to mention I am doing this in VB .NET CF for windows ce 5.0  

  • 12 years ago

    I am not sure about click event - I work in vb 2008 e.e. And from vs2003 I have never problems with pb.click event - and I also used it to create scrollbar, so there was lot of code inside click event.

    I also tried to find out transparent color - no it is not possible - also I tried to write all 255^3 pixels to 0,0 and read them, if I get different, but it seems only pixels previous to MakeTransparent call are transparent, so this bruteforce also doesnt work. only way is maybe throught unsafe lockbit, or through external application.

    Anyway, it seems that if you create bitmap where red is transparent, and put red pixel, you get red pixel, not transparent, so your "transparent color" property is not usefull in VB.

  • 12 years ago

     Hey thanks for reply,

    About the click event its not that much of a problem its just that if I use my picturebox I can only click it aprox. once per second but if I use the ordinary button it reacts much faster...

     
    I am not sure I understant what you wanted to tell me with transparent color - not posible... it is not really transparent its just that when drawing you dont draw the pixels with certain color in my case (255,0,255)

     
    Otherwise the transparency on both custom controls  works fine. (instead of  transparent color in image there is the background) the think that doesn't work is one control over the other.

     

    BR

    Grega
     

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Debugging is anticipated with distaste, performed with reluctance, and bragged about forever.” - Dan Kaminsky