基本信息
源码名称:C# 制作的OFFICE2007皮肤的源码- 自定义皮肤代码
源码大小:0.37M
文件格式:.rar
开发语言:C#
更新时间:2015-04-29
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 2 元×
微信扫码支付:2 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
C# 制作的OFFICE2007皮肤的源码
using System; using System.Drawing; using System.Windows.Forms; using System.Windows.Forms.VisualStyles; using SkinFramework.Win32; namespace SkinFramework { /// <summary> /// This class provides some methods which provide drawing specific data. /// </summary> public static class FormExtenders { /// <summary> /// Gets a value indicating if the maximize box needs to be drawn on the specified form. /// </summary> /// <param name="form">The form to check.</param> /// <returns></returns> public static bool IsDrawMaximizeBox(Form form) { return form.MaximizeBox && form.FormBorderStyle != FormBorderStyle.SizableToolWindow && form.FormBorderStyle != FormBorderStyle.FixedToolWindow; } /// <summary> /// Gets a value indicating if the minimize box needs to be drawn on the specified form. /// </summary> /// <param name="form">The form to check .</param> /// <returns></returns> public static bool IsDrawMinimizeBox(Form form) { return form.MinimizeBox && form.FormBorderStyle != FormBorderStyle.SizableToolWindow && form.FormBorderStyle != FormBorderStyle.FixedToolWindow; } /// <summary> /// Calculates the border size for the given form. /// </summary> /// <param name="form">The form.</param> /// <returns></returns> public static Size GetBorderSize(Form form) { Size border = new Size(0, 0); // Check for Caption Int32 style = Win32Api.GetWindowLong(form.Handle, GWLIndex.GWL_STYLE); bool caption = (style & (int)(WindowStyles.WS_CAPTION)) != 0; int factor = SystemInformation.BorderMultiplierFactor - 1; OperatingSystem system = Environment.OSVersion; bool isVista = system.Version.Major >= 6 && VisualStyleInformation.IsEnabledByUser; switch (form.FormBorderStyle) { case FormBorderStyle.FixedToolWindow: case FormBorderStyle.FixedSingle: case FormBorderStyle.FixedDialog: border = SystemInformation.FixedFrameBorderSize; break; case FormBorderStyle.SizableToolWindow: case FormBorderStyle.Sizable: if (isVista) border = SystemInformation.FrameBorderSize; else border = SystemInformation.FixedFrameBorderSize (caption ? SystemInformation.BorderSize new Size(factor, factor) : new Size(factor, factor)); break; case FormBorderStyle.Fixed3D: border = SystemInformation.FixedFrameBorderSize SystemInformation.Border3DSize; break; } return border; } /// <summary> /// Gets the size for <see cref="CaptionButton"/> the given form. /// </summary> /// <param name="form">The form.</param> /// <returns></returns> public static Size GetCaptionButtonSize(Form form) { Size buttonSize = form.FormBorderStyle != FormBorderStyle.SizableToolWindow && form.FormBorderStyle != FormBorderStyle.FixedToolWindow ? SystemInformation.CaptionButtonSize : SystemInformation.ToolWindowCaptionButtonSize; // looks better with this height buttonSize.Height--; return buttonSize; } /// <summary> /// Gets the height of the caption. /// </summary> /// <param name="form">The form.</param> /// <returns></returns> public static int GetCaptionHeight(Form form) { return form.FormBorderStyle != FormBorderStyle.SizableToolWindow && form.FormBorderStyle != FormBorderStyle.FixedToolWindow ? SystemInformation.CaptionHeight 2 : SystemInformation.ToolWindowCaptionHeight 1; } /// <summary> /// Gets a value indicating whether the given form has a system menu. /// </summary> /// <param name="form">The form.</param> /// <returns></returns> public static bool HasMenu(Form form) { return form.FormBorderStyle == FormBorderStyle.Sizable || form.FormBorderStyle == FormBorderStyle.Fixed3D || form.FormBorderStyle == FormBorderStyle.FixedSingle; } /// <summary> /// Gets the screen rect of the given form /// </summary> /// <param name="form">The form.</param> /// <returns></returns> public static Rectangle GetScreenRect(Form form) { return (form.Parent != null) ? form.Parent.RectangleToScreen(form.Bounds) : form.Bounds; } } }