transparent label i CF 3.5

  • Thread starter Thread starter Chris
  • Start date Start date
C

Chris

I want to put a label control above 2 different pictureboxes ( both with
gradient images). Is it possible to create a transparent label? The
background of the label should show images in pictureboxes, or even form color
 
This is not possible with the standard Label control. However you can
achieve this effect by drawing both the image and the text directly onto
your form by handling the Paint event.

Peter

--
Peter Foot
Microsoft Device Application Development MVP
peterfoot.net | appamundi.com | inthehand.com
APPA Mundi Ltd - Software Solutions for a Mobile World
In The Hand Ltd - .NET Components for Mobility
 
Ok, I have created a control that inherits from Control class. I can handle
OnPaint and OnPantBackground methods. ca also draw string with text. The
problem is how to draw a background (I mean appearance of controls my label
is above on)
 
You can't make your control transparent to show other controls beneath. You
need to draw your images and text within a single OnPaint either in directly
in your form or a single custom control. Use the DrawImage to draw the
bitmap first then DrawString to place the text above it.

Peter

--
Peter Foot
Microsoft Device Application Development MVP
peterfoot.net | appamundi.com | inthehand.com
APPA Mundi Ltd - Software Solutions for a Mobile World
In The Hand Ltd - .NET Components for Mobility
 
I understand but how to solve that problem: put a label on picturebox. How to
make the label transparent? I do not want to draw string directly on the
picturebox.
I know I have to draw image as background of the label - but the problem is
how to get that image? If I put the label on other control I would like to
get image of the control beneath the label and then draw it as label
background. But again - how to get that image?
 
Try something like the following:

Graphics grfx = Graphics.FromImage(pictureBox1.Image);
grfx.DrawString("Some transparent text", this.Font, new
SolidBrush(Color.Black), 20, 20 );

Where pictureBox1 is your picture box control.
 
My apologies for double posting that link. I didn't see that Achim Bohmann
already posted it yesterday,
 
Back
Top