valleyman86

I am trying to re-create the taskbar exactly as it is now. I don't need the start menu, quick launch, or tray (yet) but just the part that displays application buttons. I was using visualstylesrenderer but it does not contain styles for the buttons in their normal state. It does contain them for flashing state. I ended up getting the image directly from the resource file and this seemed to work until you stretch the image to fit the buttons size. It then becomes blurry and ugly. Is there a better way to do this and if not how would I go about stretching the taskbandbuttom bmp so that it looks right.

Is there a method for creating a taskband already that does all this for me or not


Re: Windows Forms General Re-Creating the TaskBar and Visual Styles Implementation

Rong-Chun Zhang - MSFT

Hi valleyman86,

You can hide any part of taskbar. See my sample bleow:

Code Snippet

namespace Win32P

{

public partial class Form2 : Form

{

public Form2()

{

InitializeComponent();

}

const int SW_HIDE = 0;

const int SW_SHOW = 5;

[DllImport("user32.dll")]

public static extern int FindWindow(string lpClassName, string lpWindowName);

[DllImport("user32")]

private static extern int FindWindowEx(int hWnd1, int hWnd2, string lpsz1, string lpsz2);

[DllImport("user32")]

private static extern int ShowWindow(int hwnd, int nCmdShow);

private void Form2_Load(object sender, EventArgs e)

{

this.button1.Text = "HideStartButton";

this.button2.Text = "HideTaskBarIcons";

this.button3.Text = "HideQuickLaunch";

}

private void button1_Click(object sender, EventArgs e)

{

int TaskBarHwnd;

TaskBarHwnd = FindWindow("Shell_traywnd", "");

int hLong = FindWindowEx(TaskBarHwnd, 0, "Button", null);

if (button1.Text == "HideStartButton")

{

ShowWindow(hLong, SW_HIDE);

button1.Text = "ShowStartButton";

}

else

{

ShowWindow(hLong, SW_SHOW);

button1.Text = "HideStartButton";

}

}

private void button2_Click(object sender, EventArgs e)

{

int TaskBarHwnd;

TaskBarHwnd = FindWindow("Shell_traywnd", "");

int hLong = FindWindowEx(TaskBarHwnd, 0, "TrayNotifyWnd", null);

if (button2.Text == "HideTaskBarIcons")

{

ShowWindow(hLong, SW_HIDE);

button2.Text = "ShowTaskBarIcons";

}

else

{

ShowWindow(hLong, SW_SHOW);

button2.Text = "HideTaskBarIcons";

}

}

private void button3_Click(object sender, EventArgs e)

{

int TaskBarHwnd;

TaskBarHwnd = FindWindow("Shell_traywnd", "");

int hLong = FindWindowEx(TaskBarHwnd, 0, "ReBarWindow32", null);

hLong = FindWindowEx(hLong, 0, "ToolbarWindow32", null);

if (button3.Text == "HideQuickLaunch")

{

ShowWindow(hLong, SW_HIDE);

button3.Text = "ShowQuickLaunch";

}

else

{

ShowWindow(hLong, SW_SHOW);

button3.Text = "HideQuickLaunch";

}

}

}

}

Hope this helps.

Regards






Re: Windows Forms General Re-Creating the TaskBar and Visual Styles Implementation

valleyman86

I'm sorry. I think you mis-understood what I was asking. My appologies. The project I am doing is not modifying the original taskbar in any way. I am trying to duplicate the taskband (application button) part of it to a separate place. I am adding this new taskbar to my second monitor. Ive actually come along ways. It now works with themes (except default theme Sad ), has button, fills those buttons with icons and text exactly how the current one does and the buttons are clickable. I was just wondering if there is an easier way than manually drawing this