|
How can I change the caption bar icon? With the default, it doesn't show up. I'd like to be able to upload my own .ico (if possible) but I didn't see a way to do that. The button still works, but I have to guess as to where it is. (Note that I'm not talking about the "NotifyIcon")
|
|
|
|
|
i tried on windows 7 and the button doent show up. if i click on the position which supposed to be the button it minimized to tray but the button dosnt show up. pls help :S
|
|
|
|
|
|
was anyone able to get the traybutton in the titlebar working on win7?
|
|
|
|
|
I want to add my custom button which gets added to all the windows whichever opens. May be windows explorer or any other application.
|
|
|
|
|
.. for those who have no compiler available, currently, maybe?
.. for those who simply cannot compile the project because of several reasons, maybe?
WTF!!
|
|
|
|
|
Hello, I'm trying to open the application in Visual Studio 2005 but it cannot seem to convert the project file into visual studio 2005. Can you upload a vs2005 version of the project? Thanks a lot.
By the way, this is the error I received from Visual Studio 2005:
Error converting project file. Element <visualstudioproject> cannot contain attributes
|
|
|
|
|
Hi,
I am using above class to paint button on title bar.when form loads it displays button properly.
But when i set from to new size it is drawing two buttons.I am not able to clean the button that was drawn before resizing the form,after set to new size i see two button one at old location and other new size next to form close button.
Can you please help me out.
Thanks
Yeshwant
|
|
|
|
|
when it call clicked event, remove button from caption and redraw it when mouse move over caption
how can i fix it?
|
|
|
|
|
it never clicked in windows xp
what is SM_CXSIZE? and it might be for it
|
|
|
|
|
the minimize-to-tray code is good .. but all I want to know is how to draw that button on a hand made bar ... you know it's easy to create both the minimize and maximize buttons but the minimize to tray is some how difficult ... Please can you explain it to me ..
And God Be With You ...
JustDeveloper
|
|
|
|
|
...If you explain first what you are actually trying to do yes
What do you mean with a 'hand made bar'?
|
|
|
|
|
Thanks , works perfectly for my small app.
|
|
|
|
|
Hi All
Any one please suggest me some books related to this type of programming.
|
|
|
|
|
Check out Apress. They've got many books.
ROFLOLMFAO
|
|
|
|
|
I don't used the code but here comes an example how to paint an themed Caption Button using .NET Framework 2:
using System.Windows.Forms.VisualStyles;
private void pictureBox1_Paint(object sender, PaintEventArgs e)
{
Rectangle btnRect = new Rectangle(10, 10, 20, 20);
DrawCaptionButton(e.Graphics, btnRect, CaptionStates.Active);
}
private void DrawCaptionButton(Graphics g, Rectangle bounds, CaptionStates state)
{
if (!VisualStyleRenderer.IsSupported) return;
//VisualStyleElement element = VisualStyleElement.Window.MinButton.Normal;
VisualStyleElement element = VisualStyleElement.CreateElement("WINDOW", 15, (int)state);
VisualStyleRenderer render = new VisualStyleRenderer(element);
render.DrawBackground(g, bounds, bounds);
Rectangle clip = new Rectangle(bounds.Left, bounds.Top, bounds.Width, bounds.Height);
clip.Inflate(-3, -3);
bounds.Height += bounds.Bottom - bounds.Top;
render.DrawBackground(g, bounds, clip);
}
public enum CaptionStates : int
{
Active = 1,
Inactive = 2,
Disabled = 3
}
-- modified at 16:15 Tuesday 28th February, 2006
|
|
|
|
|
Cool, but how do you get it on the forms caption bar?
|
|
|
|
|
I don't know - never used the topic button.
|
|
|
|
|
To enable themed button with XP style, change this:
<br />
public void DrawButton(Graphics g, bool pressed) {<br />
if (VisualStyleRenderer.IsSupported)<br />
{<br />
Rectangle btnRect = new Rectangle(wnd_size.Width - (4 * 20) - 4, 12, 14, 14);<br />
<br />
int status = (pressed) ? 2 : 1;<br />
VisualStyleElement element = VisualStyleElement.CreateElement("WINDOW", 15, status);<br />
VisualStyleRenderer render = new VisualStyleRenderer(element);<br />
render.DrawBackground(g, btnRect, btnRect);<br />
}<br />
else<br />
{<br />
int btn_width = GetSystemMetrics(SM_CXSIZE);<br />
int btn_height = GetSystemMetrics(SM_CYSIZE);<br />
[...]<br />
|
|
|
|
|
I just want to add a simple modification:
public bool MouseinBtn(Point click)<br />
{<br />
int btn_width = GetSystemMetrics(SM_CXSIZE);<br />
int btn_height = GetSystemMetrics(SM_CYSIZE);<br />
Size btn_size = new Size(btn_width, btn_height);<br />
<br />
int numExistingButtons = ((parent.MaximizeBox || parent.MinimizeBox) ? 3 : 1);<br />
if (parent.HelpButton) ++numExistingButtons;<br />
Point pos = new Point(wnd_size.Width - numExistingButtons * btn_width - 12 - (btn_width - 18) - 6, 5);<br />
<br />
return click.X >= pos.X && click.X <= pos.X + btn_size.Width &&<br />
click.Y >= pos.Y && click.Y <= pos.Y + btn_size.Height;<br />
}<br />
.<br />
.<br />
.<br />
public void DrawButton(Graphics g, bool pressed)<br />
{<br />
int btn_width = GetSystemMetrics(SM_CXSIZE);<br />
int btn_height = GetSystemMetrics(SM_CYSIZE);<br />
<br />
int numExistingButtons = ((parent.MaximizeBox || parent.MinimizeBox) ? 3 : 1);<br />
if (parent.HelpButton) ++numExistingButtons;<br />
Point pos = new Point(wnd_size.Width - numExistingButtons * btn_width - 12 - (btn_width - 18) - 6, 5);<br />
<br />
if (VisualStyleRenderer.IsSupported)<br />
{<br />
btn_width -= 4;<br />
btn_height -= 4;<br />
Rectangle btnRect = new Rectangle(pos, new Size(btn_width, btn_height));<br />
int status = 1;<br />
if(pressed)<br />
status = 2;<br />
<br />
VisualStyleElement element = VisualStyleElement.CreateElement("WINDOW", 15, status);<br />
VisualStyleRenderer render = new VisualStyleRenderer(element);<br />
render.DrawBackground(g, btnRect, btnRect);<br />
}<br />
else<br />
{ <br />
btn_width -= 2;<br />
btn_height -= 4;<br />
<br />
Rectangle btnRect = new Rectangle(pos, new Size(btn_width, btn_height));<br />
if (pressed)<br />
{<br />
ControlPaint.DrawButton(g, btnRect, ButtonState.Pushed);<br />
}<br />
else<br />
ControlPaint.DrawButton(g, btnRect, ButtonState.Normal);<br />
<br />
g.FillRectangle(new SolidBrush(SystemColors.ControlText), pos.X + (float)0.5625 * btn_width + Convert.ToInt32(pressed), pos.Y + (float)0.6428 * btn_height + Convert.ToInt32(pressed), btn_width * (float)0.1875, btn_height * (float)0.143);<br />
}<br />
}<br />
hope helpful
|
|
|
|
|
When i maximize MDIChild Form, It should draw that button on MDIParent Form and receive all the events of active child.
Thanks
Fayaz
|
|
|
|
|
try this:
<br />
.<br />
.<br />
.<br />
public MinTrayBtn(Form parent)<br />
{<br />
parent.HandleCreated += new EventHandler(this.OnHandleCreated);<br />
parent.HandleDestroyed += new EventHandler(this.OnHandleDestroyed);<br />
parent.TextChanged += new EventHandler(this.OnTextChanged);<br />
<big> parent.MdiChildActivate += new EventHandler(parent_MdiChildActivate);</big><br />
this.parent = parent;<br />
}<br />
.<br />
.<br />
.<br />
<big>private void parent_MdiChildActivate(object sender, EventArgs e)<br />
{<br />
DrawButton();<br />
}</big><br />
|
|
|
|
|
I found this article very help full. It is great. Still i want to add this button in MDIChild Form. It is working with MDIParent Form and single Form applicatio. I am able to draw it on MDIChild Form but events are not triggered. i don't know which m.msg value will catch MDIChild window click event. Please help in this.
Thanks
Fayaz
|
|
|
|
|
I'm glad that you can use it
Actually I havent done anything with MDIChilds yet but I guess it should be working when you replace all the WM_NC* Messages with their corresponding non-NC Messages.
Hope that helps,
Tyron
|
|
|
|
|
I wonder how those guys at XNeat managed to make their product works with different xp skins !??!
|
|
|
|