t***@hotmail.com
2005-02-07 14:46:27 UTC
Hi,
Firstly apologies for the cross posting, but I'm kind of desperate
here.
I'm trying to build a deskband using .net that will sit on the taskbar
as another toolbar.
I have used as a basis for my code, the code from the CodeProject.
http://www.codeproject.com/csharp/dotnetbandobjects.asp?df=100&forumid=3788&exp=0&fr=251
However, i can't get the background of the deskband to be transparent.
So when it's integrated into the taskbar special some of the XP themes
(with gradient shading) it looks awful.
Here's the code we are using:
namespace SampleBars
{
[Guid("AE07101B-46D4-4a98-AF68-0333EA26E113")]
[BandObject("Hello World Bar", BandObjectStyle.Horizontal |
BandObjectStyle.ExplorerToolbar | BandObjectStyle.TaskbarToolBar,
HelpText = "Shows bar that says hello.")]
public class HelloWorldBar : BandObject
{
private System.ComponentModel.Container components = null;
public HelloWorldBar()
{
InitializeComponent();
}
protected override void Dispose( bool disposing )
{
if( disposing )
{
if( components != null )
components.Dispose();
}
base.Dispose( disposing );
}
#region Component Designer generated code
private void InitializeComponent()
{
this.SuspendLayout();
this.MaxSize = new System.Drawing.Size(500, 32);
this.MinSize = new System.Drawing.Size(150, 32);
this.Name = "HelloWorldBar";
this.Size = new System.Drawing.Size(384, 32);
this.Title = "DB Bar";
this.ResumeLayout(false);
}
#endregion
private void button1_Click(object sender, System.EventArgs e)
{
MessageBox.Show("About to search for " + this.textbox1.Text);
}
}
I have tried this firstly:
public HelloWorldBar()
{
InitializeComponent();
this.SetStyle (System.Windows.Forms.ControlStyles.UserPaint,
true);
this.SetStyle
(System.Windows.Forms.ControlStyles.SupportsTransparentBackColor,
true);
this.BackColor = System.Drawing.Color.Transparent;
}
This has no effect.
I've also tried overiding CreateParams and setting the exStyle to |=
0x00000000020, overriding paintBackground with an empty method and this
just hides whole bar when you add it to the taskbar.
Looking at microsofts win32 msdn section on deskbands it looks like you
can just set background mode to be transparent in the paint method.
But i don't know how i can do this in C#.
Can anyone help at all?
Thanks
Simon Tomlinson
Firstly apologies for the cross posting, but I'm kind of desperate
here.
I'm trying to build a deskband using .net that will sit on the taskbar
as another toolbar.
I have used as a basis for my code, the code from the CodeProject.
http://www.codeproject.com/csharp/dotnetbandobjects.asp?df=100&forumid=3788&exp=0&fr=251
However, i can't get the background of the deskband to be transparent.
So when it's integrated into the taskbar special some of the XP themes
(with gradient shading) it looks awful.
Here's the code we are using:
namespace SampleBars
{
[Guid("AE07101B-46D4-4a98-AF68-0333EA26E113")]
[BandObject("Hello World Bar", BandObjectStyle.Horizontal |
BandObjectStyle.ExplorerToolbar | BandObjectStyle.TaskbarToolBar,
HelpText = "Shows bar that says hello.")]
public class HelloWorldBar : BandObject
{
private System.ComponentModel.Container components = null;
public HelloWorldBar()
{
InitializeComponent();
}
protected override void Dispose( bool disposing )
{
if( disposing )
{
if( components != null )
components.Dispose();
}
base.Dispose( disposing );
}
#region Component Designer generated code
private void InitializeComponent()
{
this.SuspendLayout();
this.MaxSize = new System.Drawing.Size(500, 32);
this.MinSize = new System.Drawing.Size(150, 32);
this.Name = "HelloWorldBar";
this.Size = new System.Drawing.Size(384, 32);
this.Title = "DB Bar";
this.ResumeLayout(false);
}
#endregion
private void button1_Click(object sender, System.EventArgs e)
{
MessageBox.Show("About to search for " + this.textbox1.Text);
}
}
I have tried this firstly:
public HelloWorldBar()
{
InitializeComponent();
this.SetStyle (System.Windows.Forms.ControlStyles.UserPaint,
true);
this.SetStyle
(System.Windows.Forms.ControlStyles.SupportsTransparentBackColor,
true);
this.BackColor = System.Drawing.Color.Transparent;
}
This has no effect.
I've also tried overiding CreateParams and setting the exStyle to |=
0x00000000020, overriding paintBackground with an empty method and this
just hides whole bar when you add it to the taskbar.
Looking at microsofts win32 msdn section on deskbands it looks like you
can just set background mode to be transparent in the paint method.
But i don't know how i can do this in C#.
Can anyone help at all?
Thanks
Simon Tomlinson