otherside Posted July 13, 2003 Posted July 13, 2003 Hello guys anyone know how can i set the background color to a control like labels to have some effect like fading on the one side ? and another question how can i set the background picture to strech and not repeat ? Quote
*Experts* Volte Posted July 13, 2003 *Experts* Posted July 13, 2003 There's no built in way to have the gradient on the back of the label, but you can easily paint the control yourself. Here's an example:Private Sub Label1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Label1.Paint Dim g As Graphics = e.Graphics Dim gradBrush As New Drawing2D.LinearGradientBrush( _ New Point(0, Label1.Height / 2), _ New Point(Label1.Width, Label1.Height / 2), _ Color.PowderBlue, _ Color.Green) g.FillRectangle(gradBrush, Label1.ClientRectangle) g.DrawString(Label1.Text, Label1.Font, _ New Pen(Label1.ForeColor).Brush, 1, 1) gradBrush.Dispose() End SubAs for stretching the font's image, you'll need to do something similar to the label. You just get the Form's paint event and use the DrawImage method of the form's graphics object to draw the image over the entire window (DrawImage will scale it for you). Quote
*Experts* Volte Posted July 13, 2003 *Experts* Posted July 13, 2003 On second thought, that DrawString line should be this:g.DrawString(Label1.Text, Label1.Font, _ New Pen(Label1.ForeColor).Brush, New RectangleF(1, 1, Label1.Width, Label1.Height)) otherwise you won't get text wrapping. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.