If you know what ShellStyles.dll contains, then build a list of values. For example:
using
System;
using
System.Collections.Generic;
using
System.Text;
using
System.Runtime.InteropServices;
namespace
Provectasoft_MC2007
{
public static class MemoryUtility
{
[
DllImport("kernel32.dll")]
public static extern void GlobalMemoryStatus(out MemoryStatus stat);
public struct MemoryStatus
{
public uint Length; //Length of struct
public uint MemoryLoad; //Value from 0-100 represents memory usage
public uint TotalPhysical;
public uint AvailablePhysical;
public uint TotalPageFile;
public uint AvailablePageFile;
public uint TotalVirtual;
public uint AvailableVirtual;
}
}
}
This retreives the current system memory information.
Yeah I understand that part I just meant that I want that style from the dll to be on my form. Like that dll that I have, I got from my computer its the dll that controls the color of the taskbar and style of the computer's UI. I wanted that to be integrated into my form so that my form will always be blue no matter what the users style is on his/her computer.
Dll Import
ManjuVijay
Usually I would create a wrapper class like
class Win32Calls
{
[DllImport("ShellStyles.dll")]
public static extern void Example();
}
Then use the class in your form
Haim Cohen
You can also try KryptonComponents forms:
http://componentfactory.com/downloads.html
Download it from your e-mail.
Replace Form with KryptonForm after you add a reference to your solution.
Sideout
Nkenta
Ok now I got it... thank you! Now I need to know how to use that dll in my form
[
DllImport("ShellStyles.dll")] private static extern void Example();Shawn Rheal
Dr.Virusi
If you know what ShellStyles.dll contains, then build a list of values. For example:
using
System;using
System.Collections.Generic;using
System.Text;using
System.Runtime.InteropServices;namespace
Provectasoft_MC2007{
public static class MemoryUtility{
[
DllImport("kernel32.dll")] public static extern void GlobalMemoryStatus(out MemoryStatus stat); public struct MemoryStatus{
public uint Length; //Length of struct public uint MemoryLoad; //Value from 0-100 represents memory usage public uint TotalPhysical; public uint AvailablePhysical; public uint TotalPageFile; public uint AvailablePageFile; public uint TotalVirtual; public uint AvailableVirtual;}
}
}
This retreives the current system memory information.
Then, to use it in your form:
MemoryUtility.MemoryStatus memory;
MemoryUtility.GlobalMemoryStatus(
out memory);label1.Text = string.Format("{0} MB of physical memory", (memory.TotalPhysical / (1024.0 * 1024)));
Does this help
Bartosz
Sergio Ortiz
[DllImport(string filename)]
Is this what you need
Usually there is a method after the last bracket ( ] ) .
You can also add a reference to your project in the solution explorer by right clicking References.
SomeGuyOnAComputer
Well, if you want to keep your entire form style in blue, try creating your own ToolStripRenderer class.
If you just retreive the values from ShellStyles.dll, it will just be the same as the Olive style, if that's what the user has enabled.
It won't just display blue, it's a global link library that reflects the system settings.
Try this:
public class CustomRenderer : ToolStripRenderer
{
protected override void OnRenderToolStripBackground(ToolStripRenderEventArgs e)
{
LinearGradientBrush brush = new LinearGradientBrush(e.AffectedBounds, Color.DarkGray, Color.Black, 90);
e.Graphics.FillRectangle(brush, e.AffectedBounds);
brush.Dispose();
}
protected override void OnRenderButtonBackground(ToolStripItemRenderEventArgs e)
{
if (e.Item.Selected || e.Item.Pressed)
{
LinearGradientBrush brush = new LinearGradientBrush(e.Item.Bounds, Color.DarkBlue, Color.DarkGreen, 90);
e.Graphics.FillRectangle(brush, 0, 0, e.Item.Width, e.Item.Height);
}
}
protected override void OnRenderItemText(ToolStripItemTextRenderEventArgs e)
{
e.Text.Color = Color.White;
base.OnRenderItemText(e);
}
//Then plug in the renderer. Make sure the above code is in a new class called CustomRenderer.cs
ToolStripManager.Renderer = new CustomRenderer();
Does this help
mflexer
Sure, my e-mail is
evan_mulawski@comcast.net
hazz
adam99
crazy_boss