| | | 
StrataFrame User
       
Group: Forum Members Last Login: 10/31/2007 5:20:05 PM Posts: 374, Visits: 1,197 |
| I see this control uses Label and PictureBox to show "Title" and Image. The Title and Image show as transparent on Gradient background.
I also need to put label and Picture box on this control, but if they take the "BackColor" of the form and not the Gradient color of the control. How can I do it like the way Title and image shows?
Thanks!
..ßen |
| | | | 
StrataFrame User
       
Group: Forum Members Last Login: 10/31/2007 5:20:05 PM Posts: 374, Visits: 1,197 |
| Never mind! Figured it out 
You can do really cool things with Gradation...
..ßen |
| | | | 
StrataFrame User
       
Group: Forum Members Last Login: 10/31/2007 5:20:05 PM Posts: 374, Visits: 1,197 |
| I think I spoke too soon. I tried to use ThemedPanel, but causes me other issues.
For one, the base color throws everything off, even with opacity set 100.
I still would like to use the gradient header, but need to find out how to make label and picture transparent.
Thanks!
..ßen |
| | | | 
StrataFrame Developer

Group: StrataFrame Developers Last Login: Today @ 4:58:13 AM Posts: 4,379, Visits: 4,421 |
| I see this control uses Label and PictureBox to show "Title" and Image. The Title and Image show as transparent on Gradient background.
|
Actually it does not use an image or label. These are rendered onto the control in the OnPaint of the control. I still would like to use the gradient header, but need to find out how to make label and picture transparent. Whenever you set a label or any other controls background to "Transparent" it will take the are on which is resides in its parent as the background....however, the GradientFormHeader control is not a parent control which means that no child object actually resides within the control itself. So the labels parent is the form or container it resides within. You have a couple of options. First, just render your text on the gradient form header. Handle the Paint event of the GradientFormHeader and just add your logic to render on top of it. Second option would be to handle the Paint event of the label and capture the background of the rendered GradientFormHeader using the DrawToBitmap or the ScreenCapture classes...either way will work. And then create your own transparency....this is ultimately what happens natively anyway. 
The example above may be the approach you want to take. I just created a new class, inherited from GradientFormHeader, overwrote the OnPaint method and added my logic. You could create property that you set that adds this text to your header. Below is the OnPaint code for the above example: Public Class CustomHeader Inherits MicroFour.StrataFrame.UI.Windows.Forms.GradientFormHeader Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs) MyBase.OnPaint(e) e.Graphics.DrawString("My Custom Text", Me.Font, Drawing.Brushes.Red, 200, 10) End Sub End Class |
| | | | 
StrataFrame Developer

Group: StrataFrame Developers Last Login: Today @ 4:58:13 AM Posts: 4,379, Visits: 4,421 |
| | Oh, your other question: For one, the base color throws everything off, even with opacity set 100.
The valid values are 0-255, and this is the opacity for the gradient colors to show thorugh to the base color....not the transparency of the control itself. |
| | | | 
StrataFrame User
       
Group: Forum Members Last Login: 10/31/2007 5:20:05 PM Posts: 374, Visits: 1,197 |
| Good morning Trent; Thanks for detailed answer.
I understood your points very clearly, but due to the nature of my usage (I need to put lots of stuff on the form), it makes it hard to align everything via code rather using the designer. Here is a layout for my form using gradient background to start putting controls on them.
The valid values are 0-255, and this is the opacity for the gradient colors to show thorugh to the base color....not the transparency of the control itself.
The info on 255 solved my problem if I go with ThemedPanel.
Trent, if I don't have a way to host an image, is there a way to upload an image to the forum to show on the screen? I tried the "Insert Image", but it asks for URL, so I just attached it for you to look at my direction.
Thanks again!
..ßen
|
| | | | 
StrataFrame User
       
Group: Forum Members Last Login: 10/31/2007 5:20:05 PM Posts: 374, Visits: 1,197 |
| The valid values are 0-255, and this is the opacity for the gradient colors to show thorugh to the base color.
That's an interesting data. Can this be considered more like an 'alpha' channel? By combining the base into gradient, you can create new colors....
..ßen |
| | | | 
StrataFrame Developer

Group: StrataFrame Developers Last Login: Today @ 4:58:13 AM Posts: 4,379, Visits: 4,421 |
| Can this be considered more like an 'alpha' channel? That is what it is....the alpha. By combining the base into gradient, you can create new colors That was its purpose. It allows the themed colors to be toned down/up based on your needs if you use the ColorsONly ThemeSupport option. |
| | | | 
StrataFrame Developer

Group: StrataFrame Developers Last Login: Today @ 4:58:13 AM Posts: 4,379, Visits: 4,421 |
| I tried the "Insert Image", but it asks for URL, so I just attached it for you to look at my direction.
Use Internet Explorer to get a more detailed set of options to upload the image. FireFox shows a different screen for some reason. |
| | | |
|