|
i have posted a query few days back but i have't got proper responce. my query is
How can be a transparent panel control can be created. As I tried in many ways but it is applicable to window but not to the required control (panel), as well as I also have observed that Transparency will be applicable to windows forms but not to user control. Is it so, if yes why.
Shashidhar.
|
|
|
|
|
It's hard for me to understand your English and determine what you are asking.
If I understand your question I would say you should set the "BackColor" of the "Panel" to "Transparent".
If this is not what you are looking for please rephrase your question and ask again.
Thanks,
Dameon Black
|
|
|
|
|
hehehe... you are being not very cun-vin-cing...
:->
-------------------
Therez No Place like ... 127.0.0.1
|
|
|
|
|
When I use this code in my own project The image displays but with a black background where the transparency is supposed to be.
Is this a problem with the alpha channel of my image or something else?
I am using a png file made with photoshop cs
Thanks
|
|
|
|
|
Hi, I'm not sure what exactly you are doing to cause this.
Firstly, does the example program work?
If it does work (and it should I just tested it again) then most likely it is something to do with the image.
Also, check to make sure you are overriding both Paint and PaintBackground.
Thanks,
Dameon Black
|
|
|
|
|
Hi, thanks for your help.
It's ok now, the transparency of the form was the problem.
I had changed it when working on the program before. Although I'd put the default back in the properties window, the fact that it was still mentioned in to the Windows form generated code caused the problem.
Thanks!,
Legandir
|
|
|
|
|
Had a black background too until I realised that the form had double buffering set in its options.
It should be off of course.
|
|
|
|
|
My splash screen was created in VS 2003 and converted to 2005. When I added in the code for transparency, I got the black background also. Comparing the design code line by line, it was exactly the same. I ended up recreating the splash screen in VS 2005 and it works perfectly.
Great code!!!
Thanks!
|
|
|
|
|
Hi,
i have got a question about the program. It really looks nice? What is it used for?
I really like the timeline control at the bottom. Did you write this? I am looking for something like that. Could you give me some help with writing my own timeline control?
Regards,
Per
|
|
|
|
|
The programs initial intention was to sell water park compoenents. The sales person would take a water park element and drop it into the scene to display to the buyer what is possible. As you can tell it's fully 3D using DirectX. I later added in the ability for the program to control the water park. It can setup water sequences and effects. Basically it'll do anything you see in a water park.
As for help on a timeline control I do have very little free time. Unless you're looking for contract work and I doubt you are. I can answer simple questions like this though.
Thanks,
Dameon Black
|
|
|
|
|
I should also mention about the Timeline control.
It is a custom control using GDI+.
So, it was created the hard way.
Thanks,
Dameon Black
|
|
|
|
|
Hi Dameon,
well i can understand that you are bussy. Maybee i can just ask you some small questions. Perhaps this forum isn't the best way to do that, i could also email you.
My biggest question is, do you display only the bars for the time segment that the user can see? Or do you draw the entire day at once?
Regards,
Per
|
|
|
|
|
Hi
I used your example to create my own splash screen. It worked great. Thank you.
However I wanted to add a fade effect to my splash screen and used the Opacity property and a timer to fade in the splash screen. But the image is not transparent when fading, the color used as transparent color in photoshop shows where it should be transparent.
Is this by design or is it something I have done wrong? Can it be accomplished any other way?
My code for fading in looks something like this:
Private Sub fadeIn() 'called from Private Sub Initialize()
tmeFade = New System.Windows.Forms.Timer
Me.Opacity = m_dblMinOp
m_dblFadeStep = (m_maxOp - m_minOp) / (m_intFadeTime / m_intFadeInterval)
m_bolFadingIn = True
Me.BringToFront()
Debug.WriteLine(m_dblFadeStep)
With tmeFade
.Interval = m_intFadeInterval
.Start()
End With
End Sub
Private Sub tmeFade_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles tmeFade.Tick
Dim dblOp As Double
Me.BringToFront()
If m_bolFadingIn Then
dblOp = Me.Opacity + m_dblFadeStep
If dblOp > 1 Then
dblOp = 1
End If
Me.Opacity = dblOp
Debug.WriteLine(Me.Opacity)
If (dblOp >= m_maxOp) Then
tmeFade.Stop()
End If
Else 'fading out
dblOp = Me.Opacity - m_dblFadeStep
If (dblOp <= 0) Then
tmeFade.Stop()
Me.Close()
Else
Me.Opacity = dblOp
End If
End If
End Sub
|
|
|
|
|
I'm going to take a guess on this one.
I would guess that changing the opacity would change the transparent colors making them no longer transparent. Instead of changing the opacity you may want to flip through a series of png images giving it the appearance of fading in and out. This is of course a lame way to do it but may be the only option.
Thanks,
Dameon Black
|
|
|
|
|
Im trying to achieve exactly the same results in devcpp, but i dont know how to open a png image as a bitmap - nor use it as a resource, or even how to over ride the onpaint method.
any hints would be much appreciated ...
|
|
|
|
|
Are you using managed C++, or C#? PNG and Bitmap are both image files and you don't open a PNG image as a Bitmap. You open a PNG as a PNG image.
As for overriding the OnPaint method I gave an example in .net. I suggest some books on programming .net for using resources and overriding methods. Although I did give a working example for .net.
Seriously, I need more info to correctly answer your question.
If you are doing this in "c" and not managed C++ or .net then I can't be of much help. I started working with C++ and skipped standard "c".
|
|
|
|
|
This looks great but I don't seem to be able to convert into c# - the form control doesn't seem to have a PaintBackground event? Also in C#, do you know how to remove the border from the form - I've set BorderStyle to None but there's still a thin 3D-effect trim around the edge of the form...?
Thanks for your time.
|
|
|
|
|
Hi, the code for C# is the same.
I'm not using an event handler for OnPaintBackground(...)
I'm using an override.
So, in C# it would be:
protected override void OnPaintBackground(PaintEventArgs e)
{
// Do stuff here!
}
If you type in "protected override " it will show in a drop down the list of overrides you can use.
I have included a VS2005 C# example application.
Also, I believe to remove the border you need to pass the forms handle to a Win32 API SetWindowLong(...)
Someone has an example here:
http://www.codeproject.com/cs/miscctrl/CsAddingBorders.asp
-- modified at 10:48 Thursday 12th January, 2006
|
|
|
|
|
I think there is a problem with that method. If you minimize the main window. The transparent areas didn't refresh. Old background window parts still seen. Is this a problem or the code works that way??
|
|
|
|
|
I use this method as a splash screen only. So, I don't let the user minimize the main window. Or even get to the main window without closing the splash screen.
The code gets a lot more complex if you want to do anything more fancy.
:P
|
|
|
|
|
How would you go about doing this? This happens when your using a splash screen like Photshop. Splash screen visible, then main window becomes visible with incorrect background painting from previous Paint.
This would really add to the ability you have given us.
Thanks,
Chris
|
|
|
|
|
Hallo,
have you resolved the problem? I have the same problem...
b.r.
Cristiano
|
|
|
|
|
Anybody solved it?
-------------------
Therez No Place like ... 127.0.0.1
|
|
|
|
|
What program allowed you to create the graphic and specify a transparent background?
Thanks
|
|
|
|
|
It's been a while since I did this but I think it was done using Adobe Photoshop.
The image is not using a standard transparent color. It uses an Alpha channel so that some of it is only a little transparent.
:P
|
|
|
|