diff --git a/Source/Krypton Toolkit Suite Extended/Application Updater/Classes/Settings Manager/XMLFileApplicationUpdaterSettingsManager.cs b/Source/Krypton Toolkit Suite Extended/Application Updater/Classes/Settings Manager/XMLFileApplicationUpdaterSettingsManager.cs
index 72578fec..2f8eab60 100644
--- a/Source/Krypton Toolkit Suite Extended/Application Updater/Classes/Settings Manager/XMLFileApplicationUpdaterSettingsManager.cs
+++ b/Source/Krypton Toolkit Suite Extended/Application Updater/Classes/Settings Manager/XMLFileApplicationUpdaterSettingsManager.cs
@@ -502,6 +502,60 @@ public string GetVirusTotalScanURL()
return _xmlFileApplicationUpdaterSettings.VirusTotalScanURL;
}
+ ///
+ /// Sets the KnowledgebaseArticleNumber to the value of value.
+ ///
+ /// The desired value of KnowledgebaseArticleNumber.
+ public void SetKnowledgebaseArticleNumber(string value)
+ {
+ _xmlFileApplicationUpdaterSettings.KnowledgebaseArticleNumber = value;
+ }
+
+ ///
+ /// Returns the value of the KnowledgebaseArticleNumber.
+ ///
+ /// The value of the KnowledgebaseArticleNumber.
+ public string GetKnowledgebaseArticleNumber()
+ {
+ return _xmlFileApplicationUpdaterSettings.KnowledgebaseArticleNumber;
+ }
+
+ ///
+ /// Sets the KnowledgebaseArticleNumberURL to the value of value.
+ ///
+ /// The desired value of KnowledgebaseArticleNumberURL.
+ public void SetKnowledgebaseArticleNumberURL(string value)
+ {
+ _xmlFileApplicationUpdaterSettings.KnowledgebaseArticleNumberURL = value;
+ }
+
+ ///
+ /// Returns the value of the KnowledgebaseArticleNumberURL.
+ ///
+ /// The value of the KnowledgebaseArticleNumberURL.
+ public string GetKnowledgebaseArticleNumberURL()
+ {
+ return _xmlFileApplicationUpdaterSettings.KnowledgebaseArticleNumberURL;
+ }
+
+ ///
+ /// Sets the UpdatePackageDescription to the value of value.
+ ///
+ /// The desired value of UpdatePackageDescription.
+ public void SetUpdatePackageDescription(string value)
+ {
+ _xmlFileApplicationUpdaterSettings.UpdatePackageDescription = value;
+ }
+
+ ///
+ /// Returns the value of the UpdatePackageDescription.
+ ///
+ /// The value of the UpdatePackageDescription.
+ public string GetUpdatePackageDescription()
+ {
+ return _xmlFileApplicationUpdaterSettings.UpdatePackageDescription;
+ }
+
///
/// Sets the UpdatePackageReleaseDate to the value of value.
///
@@ -561,6 +615,24 @@ public long GetUpdatePackageFileSize()
{
return _xmlFileApplicationUpdaterSettings.UpdatePackageFileSize;
}
+
+ ///
+ /// Sets the InstallCountdown to the value of value.
+ ///
+ /// The desired value of InstallCountdown.
+ public void SetInstallCountdown(int value)
+ {
+ _xmlFileApplicationUpdaterSettings.InstallCountdown = value;
+ }
+
+ ///
+ /// Returns the value of the InstallCountdown.
+ ///
+ /// The value of the InstallCountdown.
+ public int GetInstallCountdown()
+ {
+ return _xmlFileApplicationUpdaterSettings.InstallCountdown;
+ }
#endregion
#region Methods
@@ -585,6 +657,8 @@ public void ResetToDefaults()
SetUpdatePackageName(string.Empty);
+ SetUpdatePackageDescription(string.Empty);
+
SetUpdatePackageServerURLDownloadLocation(string.Empty);
SetChangelogServerURLDownloadLocation(string.Empty);
@@ -611,12 +685,18 @@ public void ResetToDefaults()
SetVirusTotalScanURL(string.Empty);
+ SetKnowledgebaseArticleNumber(string.Empty);
+
+ SetKnowledgebaseArticleNumberURL(string.Empty);
+
SetUpdatePackageReleaseDate(DateTime.Now);
SetUpdatePackageBuildDate(DateTime.Now);
SetUpdatePackageFileSize(0);
+ SetInstallCountdown(60);
+
SaveXMLFileApplicationUpdaterSettings(GetAlwaysUsePrompt());
if (KryptonMessageBox.Show($"Done! Do you want to restart the application now?", "Action Complete", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
diff --git a/Source/Krypton Toolkit Suite Extended/Application Updater/Classes/XMLFileParser.cs b/Source/Krypton Toolkit Suite Extended/Application Updater/Classes/XMLFileParser.cs
index 590a9014..2267a0b9 100644
--- a/Source/Krypton Toolkit Suite Extended/Application Updater/Classes/XMLFileParser.cs
+++ b/Source/Krypton Toolkit Suite Extended/Application Updater/Classes/XMLFileParser.cs
@@ -1,4 +1,5 @@
using GlobalUtilities.Classes;
+using KryptonApplicationUpdater.Classes.SettingsManager;
using KryptonApplicationUpdater.Interfaces;
using System;
using System.Drawing;
@@ -10,7 +11,7 @@ namespace KryptonApplicationUpdater.Classes
public class XMLFileParser : IXMLData, IUpdatable
{
#region Variables
- private string _xmlFilePath, _applicationIdentifier, _applicationName, _serverVersion, _updatePackageType, _updatePackageSeverity, _updatePackageName, _updatePackageServerURLDownloadLocation, _changelogServerURLDownloadLocation, _specialisedUpdateIconURL, _md5Checksum, _sha1Checksum, _sha256Checksum, _sha384Checksum, _sha512Checksum, _ripemd160Checksum, _updatePackageBuildString, _optionalArguments, _checksumFileURL, _virusTotalScanURL;
+ private string _xmlFilePath, _applicationIdentifier, _applicationName, _serverVersion, _updatePackageType, _updatePackageSeverity, _updatePackageName, _updatePackageDescription, _updatePackageServerURLDownloadLocation, _changelogServerURLDownloadLocation, _specialisedUpdateIconURL, _md5Checksum, _sha1Checksum, _sha256Checksum, _sha384Checksum, _sha512Checksum, _ripemd160Checksum, _updatePackageBuildString, _optionalArguments, _checksumFileURL, _virusTotalScanURL, _knowledgebaseArticleNumber, _knowledgebaseArticleNumberURL;
private bool _betaFlag, _startUpdateInstallationUponDownloadCompletion;
@@ -21,6 +22,10 @@ public class XMLFileParser : IXMLData, IUpdatable
private int _installCountdown;
private TranslationMethods translationMethods = new TranslationMethods();
+
+ private InternalApplicationUpdaterSettingsManager internalApplicationUpdaterSettingsManager = new InternalApplicationUpdaterSettingsManager();
+
+ private XMLFileApplicationUpdaterSettingsManager xmlFileApplicationUpdaterSettingsManager = new XMLFileApplicationUpdaterSettingsManager();
#endregion
#region Constructors
@@ -42,9 +47,12 @@ public XMLFileParser()
/// Type of the update package.
/// The update package severity.
/// Name of the update package.
+ /// The update package description.
/// The update package server URL download location.
/// The changelog server URL download location.
/// The specialised update icon URL.
+ /// The knowledgebase article number.
+ /// The knowledgebase article number URL.
/// The MD5 checksum.
/// The sha1 checksum.
/// The sha256 checksum.
@@ -61,9 +69,9 @@ public XMLFileParser()
/// The update package build date.
/// Size of the update package file.
/// The install countdown.
- public XMLFileParser(string xmlFilePath, string applicationIdentifier, string applicationName, string serverVersion, string updatePackageType, string updatePackageSeverity, string updatePackageName, string updatePackageServerURLDownloadLocation, string changelogServerURLDownloadLocation, string specialisedUpdateIconURL, string md5Checksum, string sha1Checksum, string sha256Checksum, string sha384Checksum, string sha512Checksum, string ripemd160Checksum, string updatePackageBuildString, string optionalArguments, string checksumFileURL, string virusTotalScanURL, bool betaFlag, bool startUpdateInstallationUponDownloadCompletion, DateTime updatePackageReleaseDate, DateTime updatePackageBuildDate, long updatePackageFileSize, int installCountdown)
+ public XMLFileParser(string xmlFilePath, string applicationIdentifier, string applicationName, string serverVersion, string updatePackageType, string updatePackageSeverity, string updatePackageName, string updatePackageDescription, string updatePackageServerURLDownloadLocation, string changelogServerURLDownloadLocation, string specialisedUpdateIconURL, string knowledgebaseArticleNumber, string knowledgebaseArticleNumberURL, string md5Checksum, string sha1Checksum, string sha256Checksum, string sha384Checksum, string sha512Checksum, string ripemd160Checksum, string updatePackageBuildString, string optionalArguments, string checksumFileURL, string virusTotalScanURL, bool betaFlag, bool startUpdateInstallationUponDownloadCompletion, DateTime updatePackageReleaseDate, DateTime updatePackageBuildDate, long updatePackageFileSize, int installCountdown)
{
- WriteData(xmlFilePath, applicationIdentifier, applicationName, serverVersion, updatePackageType, updatePackageSeverity, updatePackageName, updatePackageServerURLDownloadLocation, changelogServerURLDownloadLocation, specialisedUpdateIconURL, md5Checksum, sha1Checksum, sha256Checksum, sha384Checksum, sha512Checksum, ripemd160Checksum, updatePackageBuildString, optionalArguments, checksumFileURL, virusTotalScanURL, betaFlag, startUpdateInstallationUponDownloadCompletion, updatePackageReleaseDate, updatePackageBuildDate, updatePackageFileSize, installCountdown);
+ WriteData(xmlFilePath, applicationIdentifier, applicationName, serverVersion, updatePackageType, updatePackageSeverity, updatePackageName, updatePackageDescription, updatePackageServerURLDownloadLocation, changelogServerURLDownloadLocation, specialisedUpdateIconURL, knowledgebaseArticleNumber, knowledgebaseArticleNumberURL, md5Checksum, sha1Checksum, sha256Checksum, sha384Checksum, sha512Checksum, ripemd160Checksum, updatePackageBuildString, optionalArguments, checksumFileURL, virusTotalScanURL, betaFlag, startUpdateInstallationUponDownloadCompletion, updatePackageReleaseDate, updatePackageBuildDate, updatePackageFileSize, installCountdown);
}
#endregion
@@ -92,6 +100,9 @@ public XMLFileParser(string xmlFilePath, string applicationIdentifier, string ap
public string ChecksumFileURL { get { return _checksumFileURL; } set { _checksumFileURL = value; } }
public int InstallCountdown { get { return _installCountdown; } set { _installCountdown = value; } }
public string VirusTotalScanURL { get { return _virusTotalScanURL; } set { _virusTotalScanURL = value; } }
+ public string KnowledgebaseArticleNumber { get { return _knowledgebaseArticleNumber; } set { _knowledgebaseArticleNumber = value; } }
+ public string KnowledgebaseArticleNumberURL { get { return _knowledgebaseArticleNumberURL; } set { _knowledgebaseArticleNumberURL = value; } }
+ public string UpdatePackageDescription { get { return _updatePackageDescription; } set { _updatePackageDescription = value; } }
#endregion
#region IUpdatable Implementation
@@ -119,7 +130,7 @@ public XMLFileParser(string xmlFilePath, string applicationIdentifier, string ap
public XMLFileParser ParseXMLFile(Uri xmlFilePath, string applicationIdentification, bool createConfigurationFile = false, string configurationFilePath = null)
{
#region Internal Variables
- string _applicationIdentifier = "", _applicationName = "", _serverVersion = "", _updatePackageType = "", _updatePackageSeverity = "", _updatePackageName = "", _updatePackageServerURLDownloadLocation = "", _changelogServerURLDownloadLocation = "", _specialisedUpdateIconURL = "", _md5Checksum = "", _sha1Checksum = "", _sha256Checksum = "", _sha384Checksum = "", _sha512Checksum = "", _ripemd160Checksum = "", _updatePackageBuildString = "", _optionalArguments = "", _checksumFileURL = "", _virusTotalScanURL = "";
+ string _applicationIdentifier = "", _applicationName = "", _serverVersion = "", _updatePackageType = "", _updatePackageSeverity = "", _updatePackageName = "", _updatePackageDescription = "", _updatePackageServerURLDownloadLocation = "", _changelogServerURLDownloadLocation = "", _specialisedUpdateIconURL = "", _md5Checksum = "", _sha1Checksum = "", _sha256Checksum = "", _sha384Checksum = "", _sha512Checksum = "", _ripemd160Checksum = "", _updatePackageBuildString = "", _optionalArguments = "", _checksumFileURL = "", _virusTotalScanURL = "", _knowledgebaseArticleNumber = "", _knowledgebaseArticleNumberURL = "";
bool _betaFlag, _startUpdateInstallationUponDownloadCompletion;
@@ -175,12 +186,18 @@ public XMLFileParser ParseXMLFile(Uri xmlFilePath, string applicationIdentificat
_updatePackageName = node["updatePackageName"].InnerText;
+ _updatePackageDescription = node["updatePackageDescription"].InnerText;
+
_updatePackageServerURLDownloadLocation = node["updatePackageServerURLDownloadLocation"].InnerText;
_changelogServerURLDownloadLocation = node["changelogServerURLDownloadLocation"].InnerText;
_specialisedUpdateIconURL = node["specialisedUpdateIconURL"].InnerText;
+ _knowledgebaseArticleNumber = node["knowledgebaseArticleNumber"].InnerText;
+
+ _knowledgebaseArticleNumberURL = node["knowledgebaseArticleNumberURL"].InnerText;
+
_md5Checksum = node["md5CheckSum"].InnerText;
_sha1Checksum = node["sha1CheckSum"].InnerText;
@@ -202,7 +219,7 @@ public XMLFileParser ParseXMLFile(Uri xmlFilePath, string applicationIdentificat
_virusTotalScanURL = node["virusTotalScanURL"].InnerText;
#endregion
- return new XMLFileParser(xmlFilePath.ToString(), _applicationIdentifier, _applicationName, _serverVersion, _updatePackageType, _updatePackageSeverity, _updatePackageName, _updatePackageServerURLDownloadLocation, _changelogServerURLDownloadLocation, _specialisedUpdateIconURL, _md5Checksum, _sha1Checksum, _sha256Checksum, _sha384Checksum, _sha512Checksum, _ripemd160Checksum, _updatePackageBuildString, _optionalArguments, _checksumFileURL, _virusTotalScanURL, _betaFlag, _startUpdateInstallationUponDownloadCompletion, _updatePackageReleaseDate, _updatePackageBuildDate, _updatePackageFileSize, _installCountdown);
+ return new XMLFileParser(xmlFilePath.ToString(), _applicationIdentifier, _applicationName, _serverVersion, _updatePackageType, _updatePackageSeverity, _updatePackageName, _updatePackageDescription, _updatePackageServerURLDownloadLocation, _changelogServerURLDownloadLocation, _specialisedUpdateIconURL, _knowledgebaseArticleNumber, _knowledgebaseArticleNumberURL, _md5Checksum, _sha1Checksum, _sha256Checksum, _sha384Checksum, _sha512Checksum, _ripemd160Checksum, _updatePackageBuildString, _optionalArguments, _checksumFileURL, _virusTotalScanURL, _betaFlag, _startUpdateInstallationUponDownloadCompletion, _updatePackageReleaseDate, _updatePackageBuildDate, _updatePackageFileSize, _installCountdown);
}
catch (Exception)
{
@@ -219,11 +236,14 @@ public XMLFileParser ParseXMLFile(Uri xmlFilePath, string applicationIdentificat
/// Name of the application.
/// The server version.
/// Type of the update package.
- /// The update package severity.
/// Name of the update package.
+ /// The update package severity.
+ /// The update package description.
/// The update package server URL download location.
/// The changelog server URL download location.
/// The specialised update icon URL.
+ /// The knowledgebase article number.
+ /// The knowledgebase article number URL.
/// The MD5 checksum.
/// The sha1 checksum.
/// The sha256 checksum.
@@ -240,7 +260,7 @@ public XMLFileParser ParseXMLFile(Uri xmlFilePath, string applicationIdentificat
/// The update package build date.
/// Size of the update package file.
/// The install countdown.
- public void WriteData(string xmlFilePath, string applicationIdentifier, string applicationName, string serverVersion, string updatePackageType, string updatePackageSeverity, string updatePackageName, string updatePackageServerURLDownloadLocation, string changelogServerURLDownloadLocation, string specialisedUpdateIconURL, string md5Checksum, string sha1Checksum, string sha256Checksum, string sha384Checksum, string sha512Checksum, string ripemd160Checksum, string updatePackageBuildString, string optionalArguments, string checksumFileURL, string virusTotalScanURL, bool betaFlag, bool startUpdateInstallationUponDownloadCompletion, DateTime updatePackageReleaseDate, DateTime updatePackageBuildDate, long updatePackageFileSize, int installCountdown)
+ public void WriteData(string xmlFilePath, string applicationIdentifier, string applicationName, string serverVersion, string updatePackageType, string updatePackageName, string updatePackageSeverity, string updatePackageDescription, string updatePackageServerURLDownloadLocation, string changelogServerURLDownloadLocation, string specialisedUpdateIconURL, string knowledgebaseArticleNumber, string knowledgebaseArticleNumberURL, string md5Checksum, string sha1Checksum, string sha256Checksum, string sha384Checksum, string sha512Checksum, string ripemd160Checksum, string updatePackageBuildString, string optionalArguments, string checksumFileURL, string virusTotalScanURL, bool betaFlag, bool startUpdateInstallationUponDownloadCompletion, DateTime updatePackageReleaseDate, DateTime updatePackageBuildDate, long updatePackageFileSize, int installCountdown)
{
ServerXMLFileURL = xmlFilePath;
@@ -256,12 +276,18 @@ public void WriteData(string xmlFilePath, string applicationIdentifier, string a
UpdatePackageName = updatePackageName;
+ UpdatePackageDescription = updatePackageDescription;
+
UpdatePackageServerURLDownloadLocation = updatePackageServerURLDownloadLocation;
ChangelogServerURLDownloadLocation = changelogServerURLDownloadLocation;
SpecialisedUpdateIconURL = specialisedUpdateIconURL;
+ KnowledgebaseArticleNumber = knowledgebaseArticleNumber;
+
+ KnowledgebaseArticleNumberURL = knowledgebaseArticleNumberURL;
+
MD5Checksum = md5Checksum;
SHA1Checksum = sha1Checksum;
@@ -292,7 +318,7 @@ public void WriteData(string xmlFilePath, string applicationIdentifier, string a
UpdatePackageFileSize = updatePackageFileSize;
- SaveDataToSettings(ServerXMLFileURL, ApplicationIdentifier, ApplicationName, ServerVersion, UpdatePackageType, UpdatePackageSeverity, UpdatePackageName, UpdatePackageServerURLDownloadLocation, ChangelogServerURLDownloadLocation, SpecialisedUpdateIconURL, MD5Checksum, SHA1Checksum, SHA256Checksum, SHA384Checksum, SHA512Checksum, RIPEMD160Checksum, UpdatePackageBuildString, OptionalArguments, ChecksumFileURL, VirusTotalScanURL, BetaFlag, StartUpdateInstallationUponDownloadCompletion, UpdatePackageReleaseDate, UpdatePackageBuildDate, UpdatePackageFileSize, InstallCountdown);
+ SaveDataToSettings(ServerXMLFileURL, ApplicationIdentifier, ApplicationName, ServerVersion, UpdatePackageType, UpdatePackageSeverity, UpdatePackageName, UpdatePackageDescription, UpdatePackageServerURLDownloadLocation, ChangelogServerURLDownloadLocation, SpecialisedUpdateIconURL, KnowledgebaseArticleNumber, KnowledgebaseArticleNumberURL, MD5Checksum, SHA1Checksum, SHA256Checksum, SHA384Checksum, SHA512Checksum, RIPEMD160Checksum, UpdatePackageBuildString, OptionalArguments, ChecksumFileURL, VirusTotalScanURL, BetaFlag, StartUpdateInstallationUponDownloadCompletion, UpdatePackageReleaseDate, UpdatePackageBuildDate, UpdatePackageFileSize, InstallCountdown);
}
///
@@ -305,9 +331,12 @@ public void WriteData(string xmlFilePath, string applicationIdentifier, string a
/// Type of the update package.
/// The update package severity.
/// Name of the update package.
+ /// The update package description.
/// The update package server URL download location.
/// The changelog server URL download location.
/// The specialised update icon URL.
+ /// The knowledgebase article number.
+ /// The knowledgebase article number URL.
/// The MD5 checksum.
/// The sha1 checksum.
/// The sha256 checksum.
@@ -324,9 +353,69 @@ public void WriteData(string xmlFilePath, string applicationIdentifier, string a
/// The update package build date.
/// Size of the update package file.
/// The install countdown.
- private void SaveDataToSettings(string xmlFilePath, string applicationIdentifier, string applicationName, string serverVersion, string updatePackageType, string updatePackageSeverity, string updatePackageName, string updatePackageServerURLDownloadLocation, string changelogServerURLDownloadLocation, string specialisedUpdateIconURL, string md5Checksum, string sha1Checksum, string sha256Checksum, string sha384Checksum, string sha512Checksum, string ripemd160Checksum, string updatePackageBuildString, string optionalArguments, string checksumFileURL, string virusTotalScanURL, bool betaFlag, bool startUpdateInstallationUponDownloadCompletion, DateTime updatePackageReleaseDate, DateTime updatePackageBuildDate, long updatePackageFileSize, int installCountdown)
+ private void SaveDataToSettings(string xmlFilePath, string applicationIdentifier, string applicationName, string serverVersion, string updatePackageType, string updatePackageSeverity, string updatePackageName, string updatePackageDescription, string updatePackageServerURLDownloadLocation, string changelogServerURLDownloadLocation, string specialisedUpdateIconURL, string knowledgebaseArticleNumber, string knowledgebaseArticleNumberURL, string md5Checksum, string sha1Checksum, string sha256Checksum, string sha384Checksum, string sha512Checksum, string ripemd160Checksum, string updatePackageBuildString, string optionalArguments, string checksumFileURL, string virusTotalScanURL, bool betaFlag, bool startUpdateInstallationUponDownloadCompletion, DateTime updatePackageReleaseDate, DateTime updatePackageBuildDate, long updatePackageFileSize, int installCountdown)
{
+ internalApplicationUpdaterSettingsManager.SetXMLFileURL(xmlFilePath);
+
+ xmlFileApplicationUpdaterSettingsManager.SetApplicationIdentifier(applicationIdentifier);
+
+ internalApplicationUpdaterSettingsManager.SetApplicationName(applicationName);
+
+ xmlFileApplicationUpdaterSettingsManager.SetServerVersion(serverVersion);
+
+ xmlFileApplicationUpdaterSettingsManager.SetUpdatePackageType(updatePackageType);
+
+ xmlFileApplicationUpdaterSettingsManager.SetUpdatePackageSeverity(updatePackageSeverity);
+
+ xmlFileApplicationUpdaterSettingsManager.SetUpdatePackageName(updatePackageName);
+
+ xmlFileApplicationUpdaterSettingsManager.SetUpdatePackageDescription(updatePackageDescription);
+
+ xmlFileApplicationUpdaterSettingsManager.SetUpdatePackageServerURLDownloadLocation(updatePackageServerURLDownloadLocation);
+
+ xmlFileApplicationUpdaterSettingsManager.SetChangelogServerURLDownloadLocation(changelogServerURLDownloadLocation);
+
+ xmlFileApplicationUpdaterSettingsManager.SetSpecialisedUpdateIconURL(specialisedUpdateIconURL);
+
+ xmlFileApplicationUpdaterSettingsManager.SetKnowledgebaseArticleNumber(knowledgebaseArticleNumber);
+
+ xmlFileApplicationUpdaterSettingsManager.SetKnowledgebaseArticleNumberURL(knowledgebaseArticleNumberURL);
+
+ xmlFileApplicationUpdaterSettingsManager.SetMD5CheckSum(md5Checksum);
+
+ xmlFileApplicationUpdaterSettingsManager.SetSHA1CheckSum(sha1Checksum);
+
+ xmlFileApplicationUpdaterSettingsManager.SetSHA256CheckSum(sha256Checksum);
+
+ xmlFileApplicationUpdaterSettingsManager.SetSHA384CheckSum(sha384Checksum);
+
+ xmlFileApplicationUpdaterSettingsManager.SetSHA512CheckSum(sha512Checksum);
+
+ xmlFileApplicationUpdaterSettingsManager.SetRIPEMD160CheckSum(ripemd160Checksum);
+
+ xmlFileApplicationUpdaterSettingsManager.SetUpdatePackageBuildString(updatePackageBuildString);
+
+ xmlFileApplicationUpdaterSettingsManager.SetOptionalArguments(optionalArguments);
+
+ xmlFileApplicationUpdaterSettingsManager.SetCheckSumFileURL(checksumFileURL);
+
+ xmlFileApplicationUpdaterSettingsManager.SetVirusTotalScanURL(virusTotalScanURL);
+
+ xmlFileApplicationUpdaterSettingsManager.SetBetaFlag(betaFlag);
+
+ xmlFileApplicationUpdaterSettingsManager.SetStartUpdateInstallationUponDownloadCompletion(startUpdateInstallationUponDownloadCompletion);
+
+ xmlFileApplicationUpdaterSettingsManager.SetUpdatePackageBuildDate(updatePackageBuildDate);
+
+ xmlFileApplicationUpdaterSettingsManager.SetUpdatePackageReleaseDate(updatePackageReleaseDate);
+
+ xmlFileApplicationUpdaterSettingsManager.SetUpdatePackageFileSize(updatePackageFileSize);
+
+ xmlFileApplicationUpdaterSettingsManager.SetInstallCountdown(installCountdown);
+
+ internalApplicationUpdaterSettingsManager.SaveInternalApplicationUpdaterSettings();
+ xmlFileApplicationUpdaterSettingsManager.SaveXMLFileApplicationUpdaterSettings();
}
///
@@ -343,6 +432,8 @@ private void SaveDataToSettings(string xmlFilePath, string applicationIdentifier
/// The update package server URL download location.
/// The changelog server URL download location.
/// The specialised update icon URL.
+ /// The knowledgebase article number.
+ /// The knowledgebase article number URL.
/// The MD5 checksum.
/// The sha1 checksum.
/// The sha256 checksum.
@@ -359,7 +450,7 @@ private void SaveDataToSettings(string xmlFilePath, string applicationIdentifier
/// The update package build date.
/// Size of the update package file.
/// The install countdown.
- private void CreateConfigurationFile(string configurationFilePath, string xmlFilePath, string applicationIdentifier, string applicationName, string serverVersion, string updatePackageType, string updatePackageSeverity, string updatePackageName, string updatePackageServerURLDownloadLocation, string changelogServerURLDownloadLocation, string specialisedUpdateIconURL, string md5Checksum, string sha1Checksum, string sha256Checksum, string sha384Checksum, string sha512Checksum, string ripemd160Checksum, string updatePackageBuildString, string optionalArguments, string checksumFileURL, string virusTotalScanURL, bool betaFlag, bool startUpdateInstallationUponDownloadCompletion, DateTime updatePackageReleaseDate, DateTime updatePackageBuildDate, long updatePackageFileSize, int installCountdown)
+ private void CreateConfigurationFile(string configurationFilePath, string xmlFilePath, string applicationIdentifier, string applicationName, string serverVersion, string updatePackageType, string updatePackageSeverity, string updatePackageName, string updatePackageServerURLDownloadLocation, string changelogServerURLDownloadLocation, string specialisedUpdateIconURL, string knowledgebaseArticleNumber, string knowledgebaseArticleNumberURL, string md5Checksum, string sha1Checksum, string sha256Checksum, string sha384Checksum, string sha512Checksum, string ripemd160Checksum, string updatePackageBuildString, string optionalArguments, string checksumFileURL, string virusTotalScanURL, bool betaFlag, bool startUpdateInstallationUponDownloadCompletion, DateTime updatePackageReleaseDate, DateTime updatePackageBuildDate, long updatePackageFileSize, int installCountdown)
{
}
diff --git a/Source/Krypton Toolkit Suite Extended/Application Updater/Interfaces/IXMLData.cs b/Source/Krypton Toolkit Suite Extended/Application Updater/Interfaces/IXMLData.cs
index 022e2d52..7e40a5cf 100644
--- a/Source/Krypton Toolkit Suite Extended/Application Updater/Interfaces/IXMLData.cs
+++ b/Source/Krypton Toolkit Suite Extended/Application Updater/Interfaces/IXMLData.cs
@@ -197,5 +197,29 @@ public interface IXMLData
/// The virus total scan URL.
///
String VirusTotalScanURL { get; set; }
+
+ ///
+ /// Gets or sets the knowledgebase article number.
+ ///
+ ///
+ /// The knowledgebase article number.
+ ///
+ String KnowledgebaseArticleNumber { get; set; }
+
+ ///
+ /// Gets or sets the knowledgebase article number URL.
+ ///
+ ///
+ /// The knowledgebase article number URL.
+ ///
+ String KnowledgebaseArticleNumberURL { get; set; }
+
+ ///
+ /// Gets or sets the update package description.
+ ///
+ ///
+ /// The update package description.
+ ///
+ String UpdatePackageDescription { get; set; }
}
}
\ No newline at end of file
diff --git a/Source/Krypton Toolkit Suite Extended/Application Updater/Properties/AssemblyInfo.cs b/Source/Krypton Toolkit Suite Extended/Application Updater/Properties/AssemblyInfo.cs
index 6d32b05a..c050aac6 100644
--- a/Source/Krypton Toolkit Suite Extended/Application Updater/Properties/AssemblyInfo.cs
+++ b/Source/Krypton Toolkit Suite Extended/Application Updater/Properties/AssemblyInfo.cs
@@ -33,7 +33,7 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("4.70.326.0")]
-[assembly: AssemblyFileVersion("4.70.326.0")]
+[assembly: AssemblyVersion("4.70.330.0")]
+[assembly: AssemblyFileVersion("4.70.330.0")]
[assembly: NeutralResourcesLanguage("en-GB")]
diff --git a/Source/Krypton Toolkit Suite Extended/Application Updater/Sample/CheckSums.xml b/Source/Krypton Toolkit Suite Extended/Application Updater/Sample/CheckSums.xml
index 75971aaa..999e0419 100644
--- a/Source/Krypton Toolkit Suite Extended/Application Updater/Sample/CheckSums.xml
+++ b/Source/Krypton Toolkit Suite Extended/Application Updater/Sample/CheckSums.xml
@@ -1,5 +1,5 @@
-
-
+
+
My Cool Application Installer.exe
http://#SOME_DOMAIN/files/My Cool Application Installer.exe
diff --git a/Source/Krypton Toolkit Suite Extended/Application Updater/Sample/Update.xml b/Source/Krypton Toolkit Suite Extended/Application Updater/Sample/Update.xml
index 9350a4b9..5df6c712 100644
--- a/Source/Krypton Toolkit Suite Extended/Application Updater/Sample/Update.xml
+++ b/Source/Krypton Toolkit Suite Extended/Application Updater/Sample/Update.xml
@@ -1,5 +1,5 @@
-
-
+
+
My Cool Application
1.0.0.0
@@ -7,6 +7,7 @@
Hotfix
None
My Cool Application Installer.exe
+
http://#SOME_DOMAIN/files/My Cool Application Installer.exe
http://#SOME_DOMAIN/files/MyCoolApplicationChangelog.html
http://#SOME_DOMAIN/files/MyCoolApplicationUpdater.ico
@@ -18,6 +19,8 @@
/taskkill /pid 00000
http://#SOME_DOMAIN/files/CheckSums.xml
+ 000000
+ http://#SOME_DOMAIN/files/KBArticle#000000.html
60
30
Wednesday 14th March, 2018 12:00:00 AM
diff --git a/Source/Krypton Toolkit Suite Extended/Application Updater/Settings/XMLFileApplicationUpdaterSettings.Designer.cs b/Source/Krypton Toolkit Suite Extended/Application Updater/Settings/XMLFileApplicationUpdaterSettings.Designer.cs
index ce07a90d..e482c519 100644
--- a/Source/Krypton Toolkit Suite Extended/Application Updater/Settings/XMLFileApplicationUpdaterSettings.Designer.cs
+++ b/Source/Krypton Toolkit Suite Extended/Application Updater/Settings/XMLFileApplicationUpdaterSettings.Designer.cs
@@ -308,5 +308,41 @@ public string VirusTotalScanURL {
this["VirusTotalScanURL"] = value;
}
}
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("")]
+ public string KnowledgebaseArticleNumber {
+ get {
+ return ((string)(this["KnowledgebaseArticleNumber"]));
+ }
+ set {
+ this["KnowledgebaseArticleNumber"] = value;
+ }
+ }
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("")]
+ public string KnowledgebaseArticleNumberURL {
+ get {
+ return ((string)(this["KnowledgebaseArticleNumberURL"]));
+ }
+ set {
+ this["KnowledgebaseArticleNumberURL"] = value;
+ }
+ }
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("")]
+ public string UpdatePackageDescription {
+ get {
+ return ((string)(this["UpdatePackageDescription"]));
+ }
+ set {
+ this["UpdatePackageDescription"] = value;
+ }
+ }
}
}
diff --git a/Source/Krypton Toolkit Suite Extended/Application Updater/Settings/XMLFileApplicationUpdaterSettings.settings b/Source/Krypton Toolkit Suite Extended/Application Updater/Settings/XMLFileApplicationUpdaterSettings.settings
index 95020f29..c013a48f 100644
--- a/Source/Krypton Toolkit Suite Extended/Application Updater/Settings/XMLFileApplicationUpdaterSettings.settings
+++ b/Source/Krypton Toolkit Suite Extended/Application Updater/Settings/XMLFileApplicationUpdaterSettings.settings
@@ -74,5 +74,14 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Source/Krypton Toolkit Suite Extended/Application Updater/app.config b/Source/Krypton Toolkit Suite Extended/Application Updater/app.config
index 9e7c3858..ddfcd542 100644
--- a/Source/Krypton Toolkit Suite Extended/Application Updater/app.config
+++ b/Source/Krypton Toolkit Suite Extended/Application Updater/app.config
@@ -120,6 +120,15 @@
+
+
+
+
+
+
+
+
+
diff --git a/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/Components/RenderBase.cs b/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/Components/RenderBase.cs
deleted file mode 100644
index 72979270..00000000
--- a/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/Components/RenderBase.cs
+++ /dev/null
@@ -1,1101 +0,0 @@
-using ComponentFactory.Krypton.Toolkit;
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Diagnostics;
-using System.Drawing;
-using System.Drawing.Drawing2D;
-using System.Drawing.Imaging;
-using System.Windows.Forms;
-
-namespace ExtendedControls.Base.Renderers.Components
-{
- ///
- /// Provides base class for rendering implementations.
- ///
- [ToolboxItem(false)]
- public abstract class RenderBase : Component,
- IRenderer,
- IRenderBorder,
- IRenderBack,
- IRenderContent,
- IRenderTabBorder,
- IRenderRibbon,
- IRenderGlyph
- {
- #region Static Fields
- private static readonly object _threadLock = new object();
-
- private static readonly ColorMatrix _matrixGrayScale = new ColorMatrix(new float[][]{new float[]{0.3f,0.3f,0.3f,0,0},
- new float[]{0.59f,0.59f,0.59f,0,0},
- new float[]{0.11f,0.11f,0.11f,0,0},
- new float[]{0,0,0,1,0},
- new float[]{0,0,0,0,1}});
-
- private static readonly ColorMatrix _matrixGrayScaleRed = new ColorMatrix(new float[][]{new float[]{1,0,0,0,0},
- new float[]{0,0.59f,0.59f,0,0},
- new float[]{0,0.11f,0.11f,0,0},
- new float[]{0,0,0,1,0},
- new float[]{0,0,0,0,1}});
-
- private static readonly ColorMatrix _matrixGrayScaleGreen = new ColorMatrix(new float[][]{new float[]{0.3f,0,0.3f,0,0},
- new float[]{0,1,0,0,0},
- new float[]{0.11f,0,0.11f,0,0},
- new float[]{0,0,0,1,0},
- new float[]{0,0,0,0,1}});
-
- private static readonly ColorMatrix _matrixGrayScaleBlue = new ColorMatrix(new float[][]{new float[]{0.3f,0.3f,0,0,0},
- new float[]{0.59f,0.59f,0,0,0},
- new float[]{0,0,1,0,0},
- new float[]{0,0,0,1,0},
- new float[]{0,0,0,0,1}});
-
- private static readonly ColorMatrix _matrixLight = new ColorMatrix(new float[][]{new float[]{1,0,0,0,0},
- new float[]{0,1,0,0,0},
- new float[]{0,0,1,0,0},
- new float[]{0,0,0,1,0},
- new float[]{0.1f,0.1f,0.1f,0,1}});
-
- private static readonly ColorMatrix _matrixLightLight = new ColorMatrix(new float[][]{new float[]{1,0,0,0,0},
- new float[]{0,1,0,0,0},
- new float[]{0,0,1,0,0},
- new float[]{0,0,0,1,0},
- new float[]{0.2f,0.2f,0.2f,0,1}});
-
- private static readonly ColorMatrix _matrixDark = new ColorMatrix(new float[][]{new float[]{1,0,0,0,0},
- new float[]{0,1,0,0,0},
- new float[]{0,0,1,0,0},
- new float[]{0,0,0,1,0},
- new float[]{-0.1f,-0.1f,-0.1f,0,1}});
-
- private static readonly ColorMatrix _matrixDarkDark = new ColorMatrix(new float[][]{new float[]{1,0,0,0,0},
- new float[]{0,1,0,0,0},
- new float[]{0,0,1,0,0},
- new float[]{0,0,0,1,0},
- new float[]{-0.25f,-0.25f,-0.25f,0,1}});
- #endregion
-
- #region IRenderer
- ///
- /// Gets the standard border renderer.
- ///
- public IRenderBorder RenderStandardBorder
- {
- [DebuggerStepThrough]
- get { return this; }
- }
-
- ///
- /// Gets the standard background renderer.
- ///
- public IRenderBack RenderStandardBack
- {
- [DebuggerStepThrough]
- get { return this; }
- }
-
- ///
- /// Gets the standard content renderer.
- ///
- public IRenderContent RenderStandardContent
- {
- [DebuggerStepThrough]
- get { return this; }
- }
-
- ///
- /// Gets the tab border renderer.
- ///
- public IRenderTabBorder RenderTabBorder
- {
- [DebuggerStepThrough]
- get { return this; }
- }
-
- ///
- /// Gets the ribbon renderer.
- ///
- public IRenderRibbon RenderRibbon
- {
- [DebuggerStepThrough]
- get { return this; }
- }
-
- ///
- /// Gets the glpyh renderer.
- ///
- public IRenderGlyph RenderGlyph
- {
- [DebuggerStepThrough]
- get { return this; }
- }
-
- ///
- /// Gets a renderer for drawing the toolstrips.
- ///
- /// Color palette to use when rendering toolstrip.
- public abstract ToolStripRenderer RenderToolStrip(IPalette colorPalette);
- #endregion
-
- #region RenderStandardBorder
- ///
- /// Gets the raw padding used per edge of the border.
- ///
- /// Palette used for drawing.
- /// State associated with rendering.
- /// Visual orientation of the border.
- /// Padding structure detailing all four edges.
- public abstract Padding GetBorderRawPadding(IPaletteBorder palette,
- PaletteState state,
- VisualOrientation orientation);
-
- ///
- /// Gets the padding used to position display elements completely inside border drawing.
- ///
- /// Palette used for drawing.
- /// State associated with rendering.
- /// Visual orientation of the border.
- /// Padding structure detailing all four edges.
- public abstract Padding GetBorderDisplayPadding(IPaletteBorder palette,
- PaletteState state,
- VisualOrientation orientation);
-
- ///
- /// Generate a graphics path that is the outside edge of the border.
- ///
- /// Rendering context.
- /// Target rectangle.
- /// Palette used for drawing.
- /// Visual orientation of the border.
- /// State associated with rendering.
- /// GraphicsPath instance.
- public abstract GraphicsPath GetOutsideBorderPath(RenderContext context,
- Rectangle rect,
- IPaletteBorder palette,
- VisualOrientation orientation,
- PaletteState state);
-
- ///
- /// Generate a graphics path that is in the middle of the border.
- ///
- /// Rendering context.
- /// Target rectangle.
- /// Palette used for drawing.
- /// Visual orientation of the border.
- /// State associated with rendering.
- /// GraphicsPath instance.
- public abstract GraphicsPath GetBorderPath(RenderContext context,
- Rectangle rect,
- IPaletteBorder palette,
- VisualOrientation orientation,
- PaletteState state);
-
- ///
- /// Generate a graphics path that encloses the border and is used when rendering a background to ensure the background does not draw over the border area.
- ///
- /// Rendering context.
- /// Target rectangle.
- /// Palette used for drawing.
- /// Visual orientation of the border.
- /// State associated with rendering.
- /// GraphicsPath instance.
- public abstract GraphicsPath GetBackPath(RenderContext context,
- Rectangle rect,
- IPaletteBorder palette,
- VisualOrientation orientation,
- PaletteState state);
-
- ///
- /// Draw border on the inside edge of the specified rectangle.
- ///
- /// Rendering context.
- /// Target rectangle.
- /// Palette used for drawing.
- /// Visual orientation of the border.
- /// State associated with rendering.
- public abstract void DrawBorder(RenderContext context,
- Rectangle rect,
- IPaletteBorder palette,
- VisualOrientation orientation,
- PaletteState state);
- #endregion
-
- #region RenderStandardBack
- ///
- /// Draw background to fill the specified path.
- ///
- /// Rendering context.
- /// Target rectangle that encloses path.
- /// Graphics path.
- /// Palette used for drawing.
- /// Visual orientation of the background.
- /// State associated with rendering.
- /// Cache used for drawing.
- public abstract IDisposable DrawBack(RenderContext context,
- Rectangle rect,
- GraphicsPath path,
- IPaletteBack palette,
- VisualOrientation orientation,
- PaletteState state,
- IDisposable memento);
- #endregion
-
- #region RenderStandardContent
- ///
- /// Get the preferred size for drawing the content.
- ///
- /// Layout context.
- /// Content palette details.
- /// Content values.
- /// Visual orientation of the content.
- /// State associated with rendering.
- /// Drawing onto a composition element.
- /// If composition, should glowing be drawn.
- /// Preferred size.
- public abstract Size GetContentPreferredSize(ViewLayoutContext context,
- IPaletteContent palette,
- IContentValues values,
- VisualOrientation orientation,
- PaletteState state,
- bool composition,
- bool glowing);
-
- ///
- /// Perform layout calculations on the provided content.
- ///
- /// Layout context.
- /// Space available for laying out.
- /// Content palette details.
- /// Content values.
- /// Visual orientation of the content.
- /// State associated with rendering.
- /// Drawing onto a composition element.
- /// If composition, should glowing be drawn.
- /// Memento with cached information.
- public abstract IDisposable LayoutContent(ViewLayoutContext context,
- Rectangle availableRect,
- IPaletteContent palette,
- IContentValues values,
- VisualOrientation orientation,
- PaletteState state,
- bool composition,
- bool glowing);
-
- ///
- /// Perform draw of content using provided memento.
- ///
- /// Render context.
- /// Display area available for drawing.
- /// Content palette details.
- /// Cached values from layout call.
- /// Visual orientation of the content.
- /// State associated with rendering.
- /// Drawing onto a composition element.
- /// If compisition, should glowing be drawn.
- /// Allow drawing of focus rectangle.
- public abstract void DrawContent(RenderContext context,
- Rectangle displayRect,
- IPaletteContent palette,
- IDisposable memento,
- VisualOrientation orientation,
- PaletteState state,
- bool composition,
- bool glowing,
- bool allowFocusRect);
-
- ///
- /// Request the calculated display of the image.
- ///
- /// Cached values from layout call.
- /// True if the image is being displayed; otherwise false.
- public abstract bool GetContentImageDisplayed(IDisposable memento);
-
- ///
- /// Request the calculated position of the content image.
- ///
- /// Cached values from layout call.
- /// Display rectangle for the image content.
- public abstract Rectangle GetContentImageRectangle(IDisposable memento);
-
- ///
- /// Request the calculated display of the short text.
- ///
- /// Cached values from layout call.
- /// True if the short text is being displayed; otherwise false.
- public abstract bool GetContentShortTextDisplayed(IDisposable memento);
-
- ///
- /// Request the calculated position of the content short text.
- ///
- /// Cached values from layout call.
- /// Display rectangle for the image content.
- public abstract Rectangle GetContentShortTextRectangle(IDisposable memento);
-
- ///
- /// Request the calculated display of the long text.
- ///
- /// Cached values from layout call.
- /// True if the long text is being displayed; otherwise false.
- public abstract bool GetContentLongTextDisplayed(IDisposable memento);
-
- ///
- /// Request the calculated position of the content long text.
- ///
- /// Cached values from layout call.
- /// Display rectangle for the image content.
- public abstract Rectangle GetContentLongTextRectangle(IDisposable memento);
- #endregion
-
- #region RenderTabBorder
- ///
- /// Gets if the tabs should be drawn from left to right for z-ordering.
- ///
- /// Style of tab border.
- /// True for left to right, otherwise draw right to left.
- public abstract bool GetTabBorderLeftDrawing(TabBorderStyle tabBorderStyle);
-
- ///
- /// Gets the spacing used to separate each tab border instance.
- ///
- /// Style of tab border.
- /// Number of pixels to space instances.
- public abstract int GetTabBorderSpacingGap(TabBorderStyle tabBorderStyle);
-
- ///
- /// Gets the padding used to position display elements completely inside border drawing.
- ///
- /// Layout context.
- /// Palette used for drawing.
- /// State associated with rendering.
- /// Visual orientation of the border.
- /// Style of tab border.
- /// Padding structure detailing all four edges.
- public abstract Padding GetTabBorderDisplayPadding(ViewLayoutContext context,
- IPaletteBorder palette,
- PaletteState state,
- VisualOrientation orientation,
- TabBorderStyle tabBorderStyle);
-
- ///
- /// Generate a graphics path that encloses the border itself.
- ///
- /// Rendering context.
- /// Target rectangle.
- /// Palette used for drawing.
- /// Visual orientation of the border.
- /// State associated with rendering.
- /// Style of tab border.
- /// GraphicsPath instance.
- public abstract GraphicsPath GetTabBorderPath(RenderContext context,
- Rectangle rect,
- IPaletteBorder palette,
- VisualOrientation orientation,
- PaletteState state,
- TabBorderStyle tabBorderStyle);
-
- ///
- /// Generate a graphics path that encloses the border and is used when rendering a background to ensure the background does not draw over the border area.
- ///
- /// Rendering context.
- /// Target rectangle.
- /// Palette used for drawing.
- /// Visual orientation of the border.
- /// State associated with rendering.
- /// Style of tab border.
- /// GraphicsPath instance.
- public abstract GraphicsPath GetTabBackPath(RenderContext context,
- Rectangle rect,
- IPaletteBorder palette,
- VisualOrientation orientation,
- PaletteState state,
- TabBorderStyle tabBorderStyle);
-
- ///
- /// Draw border on the inside edge of the specified rectangle.
- ///
- /// Rendering context.
- /// Target rectangle.
- /// Palette used for drawing.
- /// Visual orientation of the border.
- /// State associated with rendering.
- /// Style of tab border.
- public abstract void DrawTabBorder(RenderContext context,
- Rectangle rect,
- IPaletteBorder palette,
- VisualOrientation orientation,
- PaletteState state,
- TabBorderStyle tabBorderStyle);
- #endregion
-
- #region RenderRibbon
- ///
- /// Draw the background of a ribbon element.
- ///
- /// Ribbon shape.
- /// Rendering context.
- /// Target rectangle.
- /// State associated with rendering.
- /// Palette used for sourcing settings.
- /// Orientation for drawing.
- /// Drawing onto a composition element.
- /// Cached values to use when drawing.
- public abstract IDisposable DrawRibbonBack(PaletteRibbonShape shape,
- RenderContext context,
- Rectangle rect,
- PaletteState state,
- IPaletteRibbonBack palette,
- VisualOrientation orientation,
- bool composition,
- IDisposable memento);
-
- ///
- /// Draw a context ribbon tab title.
- ///
- /// Ribbon shape.
- /// Rendering context.
- /// Target rectangle.
- /// Palette used for general ribbon settings.
- /// Palette used for background ribbon settings.
- /// Cached values to use when drawing.
- public abstract IDisposable DrawRibbonTabContextTitle(PaletteRibbonShape shape,
- RenderContext context,
- Rectangle rect,
- IPaletteRibbonGeneral paletteGeneral,
- IPaletteRibbonBack paletteBack,
- IDisposable memento);
-
- ///
- /// Draw the application button.
- ///
- /// Ribbon shape.
- /// Rendering context.
- /// Target rectangle.
- /// State associated with rendering.
- /// Palette used for sourcing settings.
- /// Cached storage for drawing objects.
- public abstract IDisposable DrawRibbonApplicationButton(PaletteRibbonShape shape,
- RenderContext context,
- Rectangle rect,
- PaletteState state,
- IPaletteRibbonBack palette,
- IDisposable memento);
-
- ///
- /// Draw the application tab.
- ///
- /// Ribbon shape.
- /// Rendering context.
- /// Target rectangle.
- /// State associated with rendering.
- /// Base color1 used for drawing the ribbon tab.
- /// Base color2 used for drawing the ribbon tab.
- /// Cached values to use when drawing.
- public abstract IDisposable DrawRibbonApplicationTab(PaletteRibbonShape shape,
- RenderContext context,
- Rectangle rect,
- PaletteState state,
- Color baseColor1,
- Color baseColor2,
- IDisposable memento);
-
- ///
- /// Perform drawing of a ribbon cluster edge.
- ///
- /// Ribbon shape.
- /// Render context.
- /// Display area available for drawing.
- /// Palette used for recovering drawing details.
- /// State associated with rendering.
- public abstract void DrawRibbonClusterEdge(PaletteRibbonShape shape,
- RenderContext context,
- Rectangle displayRect,
- IPaletteBack paletteBack,
- PaletteState state);
- #endregion
-
- #region RenderGlyph
- ///
- /// Perform drawing of a separator glyph.
- ///
- /// Render context.
- /// Display area available for drawing.
- /// Background palette details.
- /// Border palette details.
- /// Visual orientation of the content.
- /// State associated with rendering.
- /// Can the separator be moved.
- public abstract void DrawSeparator(RenderContext context,
- Rectangle displayRect,
- IPaletteBack paletteBack,
- IPaletteBorder paletteBorder,
- Orientation orientation,
- PaletteState state,
- bool canMove);
-
- ///
- /// Calculate the requested display size for the check box.
- ///
- /// Render context.
- /// Palette for sourcing display values.
- /// Should check box be displayed as enabled.
- /// The checked state of the check box.
- /// Should check box be displayed as hot tracking.
- /// Should check box be displayed as pressed.
- public abstract Size GetCheckBoxPreferredSize(ViewLayoutContext context,
- IPalette palette,
- bool enabled,
- CheckState checkState,
- bool tracking,
- bool pressed);
-
- ///
- /// Perform drawing of a check box.
- ///
- /// Render context.
- /// Display area available for drawing.
- /// Palette for sourcing display values.
- /// Should check box be displayed as enabled.
- /// The checked state of the check box.
- /// Should check box be displayed as hot tracking.
- /// Should check box be displayed as pressed.
- public abstract void DrawCheckBox(RenderContext context,
- Rectangle displayRect,
- IPalette palette,
- bool enabled,
- CheckState checkState,
- bool tracking,
- bool pressed);
-
- ///
- /// Calculate the requested display size for the radio button.
- ///
- /// Render context.
- /// Palette for sourcing display values.
- /// Should check box be displayed as enabled.
- /// Checked state of the radio button.
- /// Should check box be displayed as hot tracking.
- /// Should check box be displayed as pressed.
- public abstract Size GetRadioButtonPreferredSize(ViewLayoutContext context,
- IPalette palette,
- bool enabled,
- bool checkState,
- bool tracking,
- bool pressed);
- ///
- /// Perform drawing of a radio button.
- ///
- /// Render context.
- /// Display area available for drawing.
- /// Palette for sourcing display values.
- /// Should radio button be displayed as enabled.
- /// Checked state of the radio button.
- /// Should radio button be displayed as hot tracking.
- /// Should radio button be displayed as pressed.
- public abstract void DrawRadioButton(RenderContext context,
- Rectangle displayRect,
- IPalette palette,
- bool enabled,
- bool checkState,
- bool tracking,
- bool pressed);
-
- ///
- /// Calculate the requested display size for the drop down button.
- ///
- /// Render context.
- /// Palette for sourcing display values.
- /// State for which image size is needed.
- /// How to orientate the image.
- public abstract Size GetDropDownButtonPreferredSize(ViewLayoutContext context,
- IPalette palette,
- PaletteState state,
- VisualOrientation orientation);
-
- ///
- /// Perform drawing of a drop down button.
- ///
- /// Render context.
- /// Display area available for drawing.
- /// Palette for sourcing display values.
- /// State for which image size is needed.
- /// How to orientate the image.
- public abstract void DrawDropDownButton(RenderContext context,
- Rectangle displayRect,
- IPalette palette,
- PaletteState state,
- VisualOrientation orientation);
-
- ///
- /// Draw a numeric up button image appropriate for a input control.
- ///
- /// Render context.
- /// Available drawing rectangle space.
- /// Content palette for getting colors.
- /// State associated with rendering.
- public abstract void DrawInputControlNumericUpGlyph(RenderContext context,
- Rectangle cellRect,
- IPaletteContent paletteContent,
- PaletteState state);
-
- ///
- /// Draw a numeric down button image appropriate for a input control.
- ///
- /// Render context.
- /// Available drawing rectangle space.
- /// Content palette for getting colors.
- /// State associated with rendering.
- public abstract void DrawInputControlNumericDownGlyph(RenderContext context,
- Rectangle cellRect,
- IPaletteContent paletteContent,
- PaletteState state);
-
- ///
- /// Draw a drop down grid appropriate for a input control.
- ///
- /// Render context.
- /// Available drawing rectangle space.
- /// Content palette for getting colors.
- /// State associated with rendering.
- public abstract void DrawInputControlDropDownGlyph(RenderContext context,
- Rectangle cellRect,
- IPaletteContent paletteContent,
- PaletteState state);
-
-
- ///
- /// Perform drawing of a ribbon dialog box launcher glyph.
- ///
- /// Ribbon shape.
- /// Render context.
- /// Display area available for drawing.
- /// General ribbon palette details.
- /// State associated with rendering.
- public abstract void DrawRibbonDialogBoxLauncher(PaletteRibbonShape shape,
- RenderContext context,
- Rectangle displayRect,
- IPaletteRibbonGeneral paletteGeneral,
- PaletteState state);
-
- ///
- /// Perform drawing of a ribbon drop arrow glyph.
- ///
- /// Ribbon shape.
- /// Render context.
- /// Display area available for drawing.
- /// General ribbon palette details.
- /// State associated with rendering.
- public abstract void DrawRibbonDropArrow(PaletteRibbonShape shape,
- RenderContext context,
- Rectangle displayRect,
- IPaletteRibbonGeneral paletteGeneral,
- PaletteState state);
-
- ///
- /// Perform drawing of a ribbon context arrow glyph.
- ///
- /// Ribbon shape.
- /// Render context.
- /// Display area available for drawing.
- /// General ribbon palette details.
- /// State associated with rendering.
- public abstract void DrawRibbonContextArrow(PaletteRibbonShape shape,
- RenderContext context,
- Rectangle displayRect,
- IPaletteRibbonGeneral paletteGeneral,
- PaletteState state);
-
- ///
- /// Perform drawing of a ribbon overflow image.
- ///
- /// Ribbon shape.
- /// Render context.
- /// Display area available for drawing.
- /// General ribbon palette details.
- /// State associated with rendering.
- public abstract void DrawRibbonOverflow(PaletteRibbonShape shape,
- RenderContext context,
- Rectangle displayRect,
- IPaletteRibbonGeneral paletteGeneral,
- PaletteState state);
-
- ///
- /// Perform drawing of a ribbon group separator.
- ///
- /// Ribbon shape.
- /// Render context.
- /// Display area available for drawing.
- /// General ribbon palette details.
- /// State associated with rendering.
- public abstract void DrawRibbonGroupSeparator(PaletteRibbonShape shape,
- RenderContext context,
- Rectangle displayRect,
- IPaletteRibbonGeneral paletteGeneral,
- PaletteState state);
-
- ///
- /// Draw a grid sorting direction glyph.
- ///
- /// Render context.
- /// Sorting order of the glyph.
- /// Available drawing rectangle space.
- /// Palette to use for sourcing values.
- /// State associated with rendering.
- /// Should be drawn from right to left.
- /// Remainder space left over for other drawing.
- public abstract Rectangle DrawGridSortGlyph(RenderContext context,
- SortOrder sortOrder,
- Rectangle cellRect,
- IPaletteContent paletteContent,
- PaletteState state,
- bool rtl);
-
- ///
- /// Draw a grid row glyph.
- ///
- /// Render context.
- /// Row glyph.
- /// Available drawing rectangle space.
- /// Palette to use for sourcing values.
- /// State associated with rendering.
- /// Should be drawn from right to left.
- /// Remainder space left over for other drawing.
- public abstract Rectangle DrawGridRowGlyph(RenderContext context,
- GridRowGlyph rowGlyph,
- Rectangle cellRect,
- IPaletteContent paletteContent,
- PaletteState state,
- bool rtl);
-
- ///
- /// Draw a grid error glyph.
- ///
- /// Render context.
- /// Available drawing rectangle space.
- /// State associated with rendering.
- /// Should be drawn from right to left.
- /// Remainder space left over for other drawing.
- public abstract Rectangle DrawGridErrorGlyph(RenderContext context,
- Rectangle cellRect,
- PaletteState state,
- bool rtl);
-
- ///
- /// Draw a solid area glyph suitable for a drag drop area.
- ///
- /// Render context.
- /// Drawing rectangle space.
- /// Palette source of drawing values.
- public abstract void DrawDragDropSolidGlyph(RenderContext context,
- Rectangle drawRect,
- IPaletteDragDrop dragDropPalette);
-
- ///
- /// Measure the drag and drop docking glyphs.
- ///
- /// Set of drag docking data.
- /// Palette source of drawing values.
- /// Feedback requested.
- public abstract void MeasureDragDropDockingGlyph(RenderDragDockingData dragData,
- IPaletteDragDrop dragDropPalette,
- PaletteDragFeedback feedback);
-
- ///
- /// Draw a solid area glyph suitable for a drag drop area.
- ///
- /// Render context.
- /// Set of drag docking data.
- /// Palette source of drawing values.
- /// Feedback requested.
- public abstract void DrawDragDropDockingGlyph(RenderContext context,
- RenderDragDockingData dragData,
- IPaletteDragDrop dragDropPalette,
- PaletteDragFeedback feedback);
-
- ///
- /// Draw the track bar ticks glyph.
- ///
- /// Render context.
- /// Element state.
- /// Source of palette colors.
- /// Drawing rectangle that should contain ticks.
- /// Orientation of the drawing area.
- /// Drawing on the topRight or the bottomLeft.
- /// Size of the position indicator.
- /// First value.
- /// Last value.
- /// How often ticks are drawn.
- public abstract void DrawTrackTicksGlyph(RenderContext context,
- PaletteState state,
- IPaletteElementColor elementPalette,
- Rectangle drawRect,
- Orientation orientation,
- bool topRight,
- Size positionSize,
- int minimum,
- int maximum,
- int frequency);
-
- ///
- /// Draw the track bar track glyph.
- ///
- /// Render context.
- /// Element state.
- /// Source of palette colors.
- /// Drawing rectangle that should contain the track.
- /// Drawing orientation.
- /// Drawing as a volume control or standard slider.
- public abstract void DrawTrackGlyph(RenderContext context,
- PaletteState state,
- IPaletteElementColor elementPalette,
- Rectangle drawRect,
- Orientation orientation,
- bool volumeControl);
-
- ///
- /// Draw the track bar position glyph.
- ///
- /// Render context.
- /// Element state.
- /// Source of palette colors.
- /// Drawing rectangle that should contain the track.
- /// Drawing orientation.
- /// Tick marks that surround the position.
- public abstract void DrawTrackPositionGlyph(RenderContext context,
- PaletteState state,
- IPaletteElementColor elementPalette,
- Rectangle drawRect,
- Orientation orientation,
- TickStyle tickStyle);
- #endregion
-
- #region EvalTransparentPaint
- ///
- /// Evaluate if transparent painting is needed for background palette.
- ///
- /// Background palette to test.
- /// Element state associated with palette.
- /// True if transparent painting required.
- public abstract bool EvalTransparentPaint(IPaletteBack paletteBack,
- PaletteState state);
-
- ///
- /// Evaluate if transparent painting is needed for background or border palettes.
- ///
- /// Background palette to test.
- /// Background palette to test.
- /// Element state associated with palette.
- /// True if transparent painting required.
- public abstract bool EvalTransparentPaint(IPaletteBack paletteBack,
- IPaletteBorder paletteBorder,
- PaletteState state);
- #endregion
-
- #region DrawIconHelper
-
- ///
- /// Helper routine to draw an image taking into account various properties.
- ///
- /// Rendering context.
- /// Icon to be drawn.
- /// Destination rectangle.
- /// Visual orientation.
- ///
- protected static void DrawIconHelper(ViewContext context,
- Icon icon,
- Rectangle iconRect,
- VisualOrientation orientation)
- {
- Debug.Assert(context != null);
-
- // Validate reference parameter
- if (context == null)
- {
- throw new ArgumentNullException(nameof(context));
- }
-
- try
- {
- // Finally, just draw the icon and let the transforms do the rest
- context.Graphics.DrawIcon(icon, iconRect);
- }
- finally
- {
- }
- }
- #endregion
-
- #region DrawImageHelper
-
- ///
- /// Helper routine to draw an image taking into account various properties.
- ///
- /// Rendering context.
- /// Image to be drawn.
- /// Color that should become transparent.
- /// Destination rectangle.
- /// Visual orientation.
- /// Drawing effect.
- /// Image color to remap.
- /// New color for remap.
- ///
- protected static void DrawImageHelper(ViewContext context,
- Image image,
- Color remapTransparent,
- Rectangle imageRect,
- VisualOrientation orientation,
- PaletteImageEffect effect,
- Color remapColor,
- Color remapNew)
- {
- Debug.Assert(context != null);
-
- // Prevent problems with multiple threads using the same palette images
- // by only allowing a single thread to draw the provided image at a time
- lock (_threadLock)
- {
- // Validate reference parameter
- if (context == null)
- {
- throw new ArgumentNullException(nameof(context));
- }
-
- // Use image attributes class to modify image drawing for effects
- ImageAttributes attribs = new ImageAttributes();
-
- switch (effect)
- {
- case PaletteImageEffect.Disabled:
- attribs.SetColorMatrix(CommonHelper.MatrixDisabled);
- break;
- case PaletteImageEffect.GrayScale:
- attribs.SetColorMatrix(_matrixGrayScale, ColorMatrixFlag.SkipGrays);
- break;
- case PaletteImageEffect.GrayScaleRed:
- attribs.SetColorMatrix(_matrixGrayScaleRed, ColorMatrixFlag.SkipGrays);
- break;
- case PaletteImageEffect.GrayScaleGreen:
- attribs.SetColorMatrix(_matrixGrayScaleGreen, ColorMatrixFlag.SkipGrays);
- break;
- case PaletteImageEffect.GrayScaleBlue:
- attribs.SetColorMatrix(_matrixGrayScaleBlue, ColorMatrixFlag.SkipGrays);
- break;
- case PaletteImageEffect.Light:
- attribs.SetColorMatrix(_matrixLight);
- break;
- case PaletteImageEffect.LightLight:
- attribs.SetColorMatrix(_matrixLightLight);
- break;
- case PaletteImageEffect.Dark:
- attribs.SetColorMatrix(_matrixDark);
- break;
- case PaletteImageEffect.DarkDark:
- attribs.SetColorMatrix(_matrixDarkDark);
- break;
- case PaletteImageEffect.Inherit:
- // Should never happen!
- Debug.Assert(false);
- break;
- }
-
- // Do we need to remap a colors in the bitmap?
- if ((remapTransparent != Color.Empty) ||
- ((remapColor != Color.Empty) && (remapNew != Color.Empty)))
- {
- List colorMaps = new List();
-
- // Create remapping for the transparent color
- if (remapTransparent != Color.Empty)
- {
- ColorMap remap = new ColorMap
- {
- OldColor = remapTransparent,
- NewColor = Color.Transparent
- };
- colorMaps.Add(remap);
- }
-
- // Create remapping from source to target colors
- if ((remapColor != Color.Empty) && (remapNew != Color.Empty))
- {
- ColorMap remap = new ColorMap
- {
- OldColor = remapColor,
- NewColor = remapNew
- };
- colorMaps.Add(remap);
- }
-
- attribs.SetRemapTable(colorMaps.ToArray(), ColorAdjustType.Bitmap);
- }
-
- int translateX = 0;
- int translateY = 0;
- float rotation = 0f;
-
- // Perform any transformations needed for orientation
- switch (orientation)
- {
- case VisualOrientation.Bottom:
- // Translate to opposite side of origin, so the rotate can
- // then bring it back to original position but mirror image
- translateX = (imageRect.X * 2) + imageRect.Width;
- translateY = (imageRect.Y * 2) + imageRect.Height;
- rotation = 180f;
- break;
- case VisualOrientation.Left:
- // Invert the dimensions of the rectangle for drawing upwards
- imageRect = new Rectangle(imageRect.X, imageRect.Y, imageRect.Height, imageRect.Width);
-
- // Translate back from a quarter left turn to the original place
- translateX = imageRect.X - imageRect.Y;
- translateY = imageRect.X + imageRect.Y + imageRect.Width;
- rotation = -90f;
- break;
- case VisualOrientation.Right:
- // Invert the dimensions of the rectangle for drawing upwards
- imageRect = new Rectangle(imageRect.X, imageRect.Y, imageRect.Height, imageRect.Width);
-
- // Translate back from a quarter right turn to the original place
- translateX = imageRect.X + imageRect.Y + imageRect.Height;
- translateY = -(imageRect.X - imageRect.Y);
- rotation = 90f;
- break;
- }
-
- // Apply the transforms if we have any to apply
- if ((translateX != 0) || (translateY != 0))
- {
- context.Graphics.TranslateTransform(translateX, translateY);
- }
-
- if (rotation != 0f)
- {
- context.Graphics.RotateTransform(rotation);
- }
-
- try
- {
- // Finally, just draw the image and let the transforms do the rest
- context.Graphics.DrawImage(image, imageRect, 0, 0, imageRect.Width, imageRect.Height, GraphicsUnit.Pixel, attribs);
- }
- catch (ArgumentException)
- {
- }
- finally
- {
- if (rotation != 0f)
- {
- context.Graphics.RotateTransform(-rotation);
- }
-
- // Remove the applied transforms
- if ((translateX != 0) | (translateY != 0))
- {
- context.Graphics.TranslateTransform(-translateX, -translateY);
- }
- }
- }
- }
- #endregion
- }
-}
\ No newline at end of file
diff --git a/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/Components/RenderOffice2007.cs b/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/Components/RenderOffice2007.cs
deleted file mode 100644
index fdd95b09..00000000
--- a/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/Components/RenderOffice2007.cs
+++ /dev/null
@@ -1,185 +0,0 @@
-using ComponentFactory.Krypton.Toolkit;
-using ExtendedControls.Base.Renderers.Core;
-using System;
-using System.Diagnostics;
-using System.Drawing;
-using System.Drawing.Drawing2D;
-using System.Windows.Forms;
-
-namespace ExtendedControls.Base.Renderers.Components
-{
- ///
- /// Extends the professional renderer to provide Office2007 style additions.
- ///
- public class RenderOffice2007 : RenderProfessional
- {
- #region Static Fields
-
- private const float BORDER_PERCENT = 0.6f;
- private const float WHITE_PERCENT = 0.4f;
- private static readonly Blend _ribbonGroup5Blend;
- private static readonly Blend _ribbonGroup6Blend;
- private static readonly Blend _ribbonGroup7Blend;
- #endregion
-
- #region Identity
- static RenderOffice2007()
- {
- _ribbonGroup5Blend = new Blend
- {
- Factors = new float[] { 0.0f, 0.0f, 1.0f },
- Positions = new float[] { 0.0f, 0.5f, 1.0f }
- };
-
- _ribbonGroup6Blend = new Blend
- {
- Factors = new float[] { 0.0f, 0.0f, 0.75f, 1.0f },
- Positions = new float[] { 0.0f, 0.1f, 0.45f, 1.0f }
- };
-
- _ribbonGroup7Blend = new Blend
- {
- Factors = new float[] { 0.0f, 1.0f, 1.0f, 0.0f },
- Positions = new float[] { 0.0f, 0.15f, 0.85f, 1.0f }
- };
- }
- #endregion
-
- #region RenderRibbon Overrides
- ///
- /// Perform drawing of a ribbon cluster edge.
- ///
- /// Ribbon shape.
- /// Render context.
- /// Display area available for drawing.
- /// Palette used for recovering drawing details.
- /// State associated with rendering.
- public override void DrawRibbonClusterEdge(PaletteRibbonShape shape,
- ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle displayRect,
- IPaletteBack paletteBack,
- PaletteState state)
- {
- Debug.Assert(context != null);
- Debug.Assert(paletteBack != null);
-
- // Get the first border color
- Color borderColor = paletteBack.GetBackColor1(state);
-
- // We want to lighten it by merging with white
- Color lightColor = CommonHelper.MergeColors(borderColor, BORDER_PERCENT,
- Color.White, WHITE_PERCENT);
-
- // Draw inside of the border edge in a lighter version of the border
- using (SolidBrush drawBrush = new SolidBrush(lightColor))
- {
- context.Graphics.FillRectangle(drawBrush, displayRect);
- }
- }
-
- #endregion
-
- #region IRenderer Overrides
-
- ///
- /// Gets a renderer for drawing the toolstrips.
- ///
- /// Color palette to use when rendering toolstrip.
- ///
- public override ToolStripRenderer RenderToolStrip(IPalette colorPalette)
- {
- Debug.Assert(colorPalette != null);
-
- // Validate incoming parameter
- if (colorPalette == null)
- {
- throw new ArgumentNullException(nameof(colorPalette));
- }
-
- // Use the professional renderer but pull colors from the palette
- KryptonOffice2007Renderer renderer = new KryptonOffice2007Renderer(colorPalette.ColorTable)
- {
-
- // Seup the need to use rounded corners
- RoundedEdges = (colorPalette.ColorTable.UseRoundedEdges != InheritBool.False)
- };
-
- return renderer;
- }
- #endregion
-
- #region Implementation
- ///
- /// Internal rendering method.
- ///
- protected override IDisposable DrawRibbonTabContext(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- IPaletteRibbonGeneral paletteGeneral,
- IPaletteRibbonBack paletteBack,
- IDisposable memento)
- {
- if ((rect.Width > 0) && (rect.Height > 0))
- {
- Color c1 = paletteGeneral.GetRibbonTabSeparatorContextColor(PaletteState.Normal);
- Color c2 = paletteBack.GetRibbonBackColor5(PaletteState.ContextCheckedNormal);
-
- bool generate = true;
- MementoRibbonTabContextOffice cache;
-
- // Access a cache instance and decide if cache resources need generating
- if (!(memento is MementoRibbonTabContextOffice))
- {
- memento?.Dispose();
-
- cache = new MementoRibbonTabContextOffice(rect, c1, c2);
- memento = cache;
- }
- else
- {
- cache = (MementoRibbonTabContextOffice)memento;
- generate = !cache.UseCachedValues(rect, c1, c2);
- }
-
- // Do we need to generate the contents of the cache?
- if (generate)
- {
- // Dispose of existing values
- cache.Dispose();
-
- Rectangle borderRect = new Rectangle(rect.X - 1, rect.Y - 1, rect.Width + 2, rect.Height + 2);
- cache.fillRect = new Rectangle(rect.X + 1, rect.Y, rect.Width - 2, rect.Height - 1);
-
- LinearGradientBrush borderBrush = new LinearGradientBrush(borderRect, c1, Color.Transparent, 270f)
- {
- Blend = _ribbonGroup5Blend
- };
- cache.borderPen = new Pen(borderBrush);
-
- LinearGradientBrush underlineBrush = new LinearGradientBrush(borderRect, Color.Transparent, Color.FromArgb(200, c2), 0f)
- {
- Blend = _ribbonGroup7Blend
- };
- cache.underlinePen = new Pen(underlineBrush);
-
- cache.fillBrush = new LinearGradientBrush(borderRect, Color.FromArgb(106, c2), Color.Transparent, 270f)
- {
- Blend = _ribbonGroup6Blend
- };
- }
-
- // Draw the left and right border lines
- context.Graphics.DrawLine(cache.borderPen, rect.X, rect.Y, rect.X, rect.Bottom - 1);
- context.Graphics.DrawLine(cache.borderPen, rect.Right - 1, rect.Y, rect.Right - 1, rect.Bottom - 1);
-
- // Fill the inner area with a gradient context specific color
- context.Graphics.FillRectangle(cache.fillBrush, cache.fillRect);
-
- // Overdraw the brighter line at bottom
- context.Graphics.DrawLine(cache.underlinePen, rect.X + 1, rect.Bottom - 2, rect.Right - 2, rect.Bottom - 2);
- }
-
- return memento;
- }
- #endregion
- }
-}
\ No newline at end of file
diff --git a/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/Components/RenderOffice2010.cs b/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/Components/RenderOffice2010.cs
deleted file mode 100644
index 7a3de2e7..00000000
--- a/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/Components/RenderOffice2010.cs
+++ /dev/null
@@ -1,175 +0,0 @@
-using ComponentFactory.Krypton.Toolkit;
-using ExtendedControls.Base.Renderers.Core;
-using System;
-using System.Diagnostics;
-using System.Drawing;
-using System.Drawing.Drawing2D;
-using System.Windows.Forms;
-
-namespace ExtendedControls.Base.Renderers.Components
-{
- ///
- /// Extends the professional renderer to provide Office2010 style additions.
- ///
- public class RenderOffice2010 : RenderProfessional
- {
- #region Static Fields
-
- private const float BORDER_PERCENT = 0.6f;
- private const float WHITE_PERCENT = 0.4f;
- private static readonly Blend _ribbonGroup5Blend;
- private static readonly Blend _ribbonGroup6Blend;
- private static readonly Blend _ribbonGroup7Blend;
- #endregion
-
- #region Identity
- static RenderOffice2010()
- {
- _ribbonGroup5Blend = new Blend
- {
- Factors = new float[] { 0.0f, 0.0f, 1.0f },
- Positions = new float[] { 0.0f, 0.5f, 1.0f }
- };
-
- _ribbonGroup6Blend = new Blend
- {
- Factors = new float[] { 0.0f, 0.0f, 0.75f, 1.0f },
- Positions = new float[] { 0.0f, 0.1f, 0.45f, 1.0f }
- };
-
- _ribbonGroup7Blend = new Blend
- {
- Factors = new float[] { 0.0f, 1.0f, 1.0f, 0.0f },
- Positions = new float[] { 0.0f, 0.15f, 0.85f, 1.0f }
- };
- }
- #endregion
-
- #region RenderRibbon Overrides
- ///
- /// Perform drawing of a ribbon cluster edge.
- ///
- /// Ribbon shape.
- /// Render context.
- /// Display area available for drawing.
- /// Palette used for recovering drawing details.
- /// State associated with rendering.
- public override void DrawRibbonClusterEdge(PaletteRibbonShape shape,
- ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle displayRect,
- IPaletteBack paletteBack,
- PaletteState state)
- {
- Debug.Assert(context != null);
- Debug.Assert(paletteBack != null);
-
- // Get the first border color
- Color borderColor = paletteBack.GetBackColor1(state);
-
- // We want to lighten it by merging with white
- Color lightColor = CommonHelper.MergeColors(borderColor, BORDER_PERCENT,
- Color.White, WHITE_PERCENT);
-
- // Draw inside of the border edge in a lighter version of the border
- using (SolidBrush drawBrush = new SolidBrush(lightColor))
- {
- context.Graphics.FillRectangle(drawBrush, displayRect);
- }
- }
-
- #endregion
-
- #region IRenderer Overrides
-
- ///
- /// Gets a renderer for drawing the toolstrips.
- ///
- /// Color palette to use when rendering toolstrip.
- ///
- public override ToolStripRenderer RenderToolStrip(IPalette colorPalette)
- {
- Debug.Assert(colorPalette != null);
-
- // Validate incoming parameter
- if (colorPalette == null)
- {
- throw new ArgumentNullException(nameof(colorPalette));
- }
-
- // Use the professional renderer but pull colors from the palette
- KryptonOffice2010Renderer renderer = new KryptonOffice2010Renderer(colorPalette.ColorTable)
- {
-
- // Seup the need to use rounded corners
- RoundedEdges = (colorPalette.ColorTable.UseRoundedEdges != InheritBool.False)
- };
-
- return renderer;
- }
- #endregion
-
- #region Implementation
-
- ///
- /// Internal rendering method.
- ///
- protected override IDisposable DrawRibbonTabContext(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- IPaletteRibbonGeneral paletteGeneral,
- IPaletteRibbonBack paletteBack,
- IDisposable memento)
- {
- if ((rect.Width > 0) && (rect.Height > 0))
- {
- Color c1 = paletteGeneral.GetRibbonTabSeparatorContextColor(PaletteState.Normal);
- Color c2 = paletteBack.GetRibbonBackColor5(PaletteState.ContextCheckedNormal);
-
- bool generate = true;
- MementoRibbonTabContextOffice2010 cache;
-
- // Access a cache instance and decide if cache resources need generating
- if (!(memento is MementoRibbonTabContextOffice2010))
- {
- memento?.Dispose();
-
- cache = new MementoRibbonTabContextOffice2010(rect, c1, c2);
- memento = cache;
- }
- else
- {
- cache = (MementoRibbonTabContextOffice2010)memento;
- generate = !cache.UseCachedValues(rect, c1, c2);
- }
-
- // Do we need to generate the contents of the cache?
- if (generate)
- {
- // Dispose of existing values
- cache.Dispose();
-
- cache.borderOuterPen = new Pen(c1);
- cache.borderInnerPen = new Pen(CommonHelper.MergeColors(Color.Black, 0.1f, c2, 0.9f));
- cache.topBrush = new SolidBrush(c2);
- Color lightC2 = ControlPaint.Light(c2);
- cache.bottomBrush = new LinearGradientBrush(new RectangleF(rect.X - 1, rect.Y, rect.Width + 2, rect.Height + 1),
- Color.FromArgb(128, lightC2), Color.FromArgb(64, lightC2), 90f);
- }
-
- // Draw the left and right borders
- context.Graphics.DrawLine(cache.borderOuterPen, rect.X, rect.Y, rect.X, rect.Bottom);
- context.Graphics.DrawLine(cache.borderInnerPen, rect.X + 1, rect.Y, rect.X + 1, rect.Bottom - 1);
- context.Graphics.DrawLine(cache.borderOuterPen, rect.Right - 1, rect.Y, rect.Right - 1, rect.Bottom - 1);
- context.Graphics.DrawLine(cache.borderInnerPen, rect.Right - 2, rect.Y, rect.Right - 2, rect.Bottom - 1);
-
- // Draw the solid block of colour at the top
- context.Graphics.FillRectangle(cache.topBrush, rect.X + 2, rect.Y, rect.Width - 4, 4);
-
- // Draw the gradient to the bottom
- context.Graphics.FillRectangle(cache.bottomBrush, rect.X + 2, rect.Y + 4, rect.Width - 4, rect.Height - 4);
- }
-
- return memento;
- }
- #endregion
- }
-}
\ No newline at end of file
diff --git a/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/Components/RenderOffice2013.cs b/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/Components/RenderOffice2013.cs
deleted file mode 100644
index f27241e3..00000000
--- a/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/Components/RenderOffice2013.cs
+++ /dev/null
@@ -1,487 +0,0 @@
-using ComponentFactory.Krypton.Toolkit;
-using ExtendedControls.Base.Renderers.Core;
-using System;
-using System.Diagnostics;
-using System.Drawing;
-using System.Drawing.Drawing2D;
-using System.Windows.Forms;
-
-namespace ExtendedControls.Base.Renderers.Components
-{
- ///
- /// Extends the professional renderer to provide Office2010 style additions.
- ///
- public class RenderOffice2013 : RenderOffice2010
- {
- #region Static Fields
- private static readonly float BORDER_PERCENT = 0.6f;
- private static readonly float WHITE_PERCENT = 0.4f;
- //private static readonly Blend _ribbonGroup5Blend;
- //private static readonly Blend _ribbonGroup6Blend;
- //private static readonly Blend _ribbonGroup7Blend;
- #endregion
-
- #region Identity
- static RenderOffice2013()
- {
- //_ribbonGroup5Blend = new Blend();
- //_ribbonGroup5Blend.Factors = new float[] { 0.0f, 0.0f, 1.0f };
- //_ribbonGroup5Blend.Positions = new float[] { 0.0f, 0.5f, 1.0f };
-
- //_ribbonGroup6Blend = new Blend();
- //_ribbonGroup6Blend.Factors = new float[] { 0.0f, 0.0f, 0.75f, 1.0f };
- //_ribbonGroup6Blend.Positions = new float[] { 0.0f, 0.1f, 0.45f, 1.0f };
-
- //_ribbonGroup7Blend = new Blend();
- //_ribbonGroup7Blend.Factors = new float[] { 0.0f, 1.0f, 1.0f, 0.0f };
- //_ribbonGroup7Blend.Positions = new float[] { 0.0f, 0.15f, 0.85f, 1.0f };
- }
- #endregion
-
- #region RenderRibbon Overrides
- ///
- /// Perform drawing of a ribbon cluster edge.
- ///
- /// Ribbon shape.
- /// Render context.
- /// Display area available for drawing.
- /// Palette used for recovering drawing details.
- /// State associated with rendering.
- public override void DrawRibbonClusterEdge(PaletteRibbonShape shape,
- ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle displayRect,
- IPaletteBack paletteBack,
- PaletteState state)
- {
- Debug.Assert(context != null);
- Debug.Assert(paletteBack != null);
-
- // Get the first border color
- Color borderColor = paletteBack.GetBackColor1(state);
-
- // We want to lighten it by merging with white
- Color lightColor = CommonHelper.MergeColors(borderColor, BORDER_PERCENT,
- Color.White, WHITE_PERCENT);
-
- // Draw inside of the border edge in a lighter version of the border
- using (SolidBrush drawBrush = new SolidBrush(lightColor))
- {
- context.Graphics.FillRectangle(drawBrush, displayRect);
- }
- }
-
- #endregion
-
- #region IRenderer Overrides
-
- ///
- /// Gets a renderer for drawing the toolstrips.
- ///
- /// Color palette to use when rendering toolstrip.
- ///
- public override ToolStripRenderer RenderToolStrip(IPalette colorPalette)
- {
- Debug.Assert(colorPalette != null);
-
- // Validate incoming parameter
- if (colorPalette == null)
- {
- throw new ArgumentNullException(nameof(colorPalette));
- }
-
- // Use the professional renderer but pull colors from the palette
- KryptonOffice2013Renderer renderer = new KryptonOffice2013Renderer(colorPalette.ColorTable)
- {
-
- // Seup the need to use rounded corners
- RoundedEdges = (colorPalette.ColorTable.UseRoundedEdges != InheritBool.False)
- };
-
- return renderer;
- }
- #endregion
-
- #region Implementation
-
- ///
- /// Internal rendering method.
- ///
- protected override IDisposable DrawRibbonTabContext(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- IPaletteRibbonGeneral paletteGeneral,
- IPaletteRibbonBack paletteBack,
- IDisposable memento)
- {
- if ((rect.Width > 0) && (rect.Height > 0))
- {
- Color c1 = paletteGeneral.GetRibbonTabSeparatorContextColor(PaletteState.Normal);
- Color c2 = paletteBack.GetRibbonBackColor5(PaletteState.ContextCheckedNormal);
-
- bool generate = true;
- MementoRibbonTabContextOffice2010 cache;
-
- // Access a cache instance and decide if cache resources need generating
- if ((memento == null) || !(memento is MementoRibbonTabContextOffice2010))
- {
- if (memento != null)
- {
- memento.Dispose();
- }
-
- cache = new MementoRibbonTabContextOffice2010(rect, c1, c2);
- memento = cache;
- }
- else
- {
- cache = (MementoRibbonTabContextOffice2010)memento;
- generate = !cache.UseCachedValues(rect, c1, c2);
- }
-
- // Do we need to generate the contents of the cache?
- if (generate)
- {
- // Dispose of existing values
- cache.Dispose();
-
- cache.borderOuterPen = new Pen(c1);
- cache.borderInnerPen = new Pen(CommonHelper.MergeColors(Color.Black, 0.1f, c2, 0.9f));
- cache.topBrush = new SolidBrush(c2);
- Color lightC2 = ControlPaint.Light(c2);
- cache.bottomBrush = new LinearGradientBrush(new RectangleF(rect.X - 1, rect.Y, rect.Width + 2, rect.Height + 1),
- Color.FromArgb(128, lightC2), Color.FromArgb(64, lightC2), 90f);
- }
-
- // Draw the left and right borders
- context.Graphics.DrawLine(cache.borderOuterPen, rect.X, rect.Y, rect.X, rect.Bottom);
- context.Graphics.DrawLine(cache.borderInnerPen, rect.X + 1, rect.Y, rect.X + 1, rect.Bottom - 1);
- context.Graphics.DrawLine(cache.borderOuterPen, rect.Right - 1, rect.Y, rect.Right - 1, rect.Bottom - 1);
- context.Graphics.DrawLine(cache.borderInnerPen, rect.Right - 2, rect.Y, rect.Right - 2, rect.Bottom - 1);
-
- // Draw the solid block of colour at the top
- context.Graphics.FillRectangle(cache.topBrush, rect.X + 2, rect.Y, rect.Width - 4, 4);
-
- // Draw the gradient to the bottom
- context.Graphics.FillRectangle(cache.bottomBrush, rect.X + 2, rect.Y + 4, rect.Width - 4, rect.Height - 4);
- }
-
- return memento;
- }
- ///
- /// Draw the application tab.
- ///
- /// Ribbon shape.
- /// Rendering context.
- /// Target rectangle.
- /// State associated with rendering.
- /// Base color1 used for drawing the ribbon tab.
- /// Base color2 used for drawing the ribbon tab.
- /// Cached values to use when drawing.
- public override IDisposable DrawRibbonApplicationTab(PaletteRibbonShape shape,
- ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- PaletteState state,
- Color baseColor1,
- Color baseColor2,
- IDisposable memento)
- {
- if ((rect.Width > 0) && (rect.Height > 0))
- {
- bool generate = true;
- MementoRibbonAppTab2013 cache;
-
- // Access a cache instance and decide if cache resources need generating
- if ((memento == null) || !(memento is MementoRibbonAppTab2013))
- {
- if (memento != null)
- {
- memento.Dispose();
- }
-
- cache = new MementoRibbonAppTab2013(rect, baseColor1);
- memento = cache;
- }
- else
- {
- cache = (MementoRibbonAppTab2013)memento;
- generate = !cache.UseCachedValues(rect, baseColor1);
- }
-
- // Do we need to generate the contents of the cache?
- if (generate)
- {
- // Dispose of existing values
- cache.Dispose();
-
- // Create common paths to all the app tab states
- cache.GeneratePaths(rect, state);
- //cache.borderPen = new Pen(baseColor1);
-
- // Create state specific colors/brushes/pens
- switch (state)
- {
- case PaletteState.Normal:
- //cache.borderBrush = new SolidBrush(baseColor1);
- cache.insideFillBrush = new SolidBrush(baseColor1);
-
- //cache.insideFillBrush.SetSigmaBellShape(0.33f);
- //cache.highlightBrush.CenterColor = Color.FromArgb(64, Color.White);
- break;
- case PaletteState.Tracking:
- cache.insideFillBrush = new SolidBrush(baseColor2);
- //cache.borderBrush = new SolidBrush(baseColor2);
- //cache.insideFillBrush = new LinearGradientBrush(new RectangleF(rect.X, rect.Y + 1, rect.Width, rect.Height),
- // CommonHelper.MergeColors(baseColor1, 0.3f, baseColor2, 0.7f),
- // CommonHelper.MergeColors(baseColor1, 0.6f, baseColor2, 0.4f),
- // 90f);
-
- //cache.insideFillBrush.SetSigmaBellShape(0.33f);
- //cache.highlightBrush.CenterColor = Color.FromArgb(100, Color.White);
- break;
- case PaletteState.Tracking | PaletteState.FocusOverride:
- cache.insideFillBrush = new SolidBrush(ControlPaint.LightLight(baseColor2));
- //cache.borderBrush = new SolidBrush(ControlPaint.LightLight(baseColor2));
- //cache.insideFillBrush = new LinearGradientBrush(new RectangleF(rect.X, rect.Y + 1, rect.Width, rect.Height),
- // CommonHelper.MergeColors(baseColor1, 0.3f, baseColor2, 0.7f),
- // CommonHelper.MergeColors(baseColor1, 0.6f, baseColor2, 0.4f),
- // 90f);
-
- //cache.insideFillBrush.SetSigmaBellShape(0.33f);
- //cache.highlightBrush.CenterColor = ControlPaint.LightLight(baseColor2);
- break;
- case PaletteState.Pressed:
- cache.insideFillBrush = new SolidBrush(baseColor2);
-
- //cache.borderBrush = new SolidBrush(CommonHelper.MergeColors(baseColor1, 0.5f, baseColor2, 0.5f));
- //cache.insideFillBrush = new LinearGradientBrush(new RectangleF(rect.X, rect.Y + 1, rect.Width, rect.Height),
- // CommonHelper.MergeColors(baseColor1, 0.3f, baseColor2, 0.7f),
- // CommonHelper.MergeColors(baseColor1, 0.75f, baseColor2, 0.25f),
- // 90f);
-
- //cache.insideFillBrush.SetSigmaBellShape(0f);
- //cache.highlightBrush.CenterColor = Color.FromArgb(90, Color.White);
- break;
- }
- }
-
- // Fill the entire tab area and then add a border around the edge
- //context.Graphics.FillPath(cache.borderBrush, cache.borderFillPath);
-
- // Draw the outside border
- //using (AntiAlias aa = new AntiAlias(context.Graphics))
- // context.Graphics.DrawPath(cache.borderPen, cache.borderPath);
-
- // Fill inside area
- //context.Graphics.FillPath(cache.insideFillBrush, cache.insideFillPath);
- context.Graphics.FillRectangle(cache.insideFillBrush, cache.rect);
-
- // Draw highlight over bottom half
- //using (Clipping clip = new Clipping(context.Graphics, cache.insideFillPath))
- // context.Graphics.FillPath(cache.highlightBrush, cache.highlightPath);
- }
-
- return memento;
- }
-
- ///
- /// Internal rendering method.
- ///
- protected override IDisposable DrawRibbonTabSelected2010(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- PaletteState state,
- IPaletteRibbonBack palette,
- VisualOrientation orientation,
- IDisposable memento,
- bool standard)
- {
- if ((rect.Width > 0) && (rect.Height > 0))
- {
- Color c1 = palette.GetRibbonBackColor1(state);
- Color c2 = palette.GetRibbonBackColor2(state);
- Color c3 = palette.GetRibbonBackColor3(state);
- Color c4 = palette.GetRibbonBackColor4(state);
- Color c5 = palette.GetRibbonBackColor5(state);
-
- bool generate = true;
- MementoRibbonTabSelected2010 cache;
-
- // Access a cache instance and decide if cache resources need generating
- if ((memento == null) || !(memento is MementoRibbonTabSelected2010))
- {
- if (memento != null)
- {
- memento.Dispose();
- }
-
- cache = new MementoRibbonTabSelected2010(rect, c1, c2, c3, c4, c5, orientation);
- memento = cache;
- }
- else
- {
- cache = (MementoRibbonTabSelected2010)memento;
- generate = !cache.UseCachedValues(rect, c1, c2, c3, c4, c5, orientation);
- }
-
- // Do we need to generate the contents of the cache?
- if (generate)
- {
- // Dispose of existing values
- cache.Dispose();
-
- // If we have a context color to use then modify the drawing colors
- if (c5 != Color.Empty)
- {
- if (!standard)
- {
- c5 = CommonHelper.MergeColors(c5, 0.65f, Color.Black, 0.35f);
- }
-
- c1 = Color.FromArgb(196, c5);
- }
-
- switch (orientation)
- {
- case VisualOrientation.Top:
- DrawRibbonTabSelectedTop2010(rect, c2, c3, c5, cache);
- break;
- case VisualOrientation.Left:
- DrawRibbonTabSelectedLeft2010(rect, c2, c3, c5, cache);
- break;
- case VisualOrientation.Right:
- DrawRibbonTabSelectedRight2010(rect, c2, c3, c5, cache);
- break;
- case VisualOrientation.Bottom:
- DrawRibbonTabSelectedBottom2010(rect, c2, c3, c5, cache);
- break;
- }
-
- cache.outsidePen = new Pen(c1);
- cache.centerPen = new Pen(c4);
- }
-
- context.Graphics.FillRectangle(cache.centerBrush, cache.rect);
- //context.Graphics.FillPath(cache.centerBrush, cache.outsidePath);
-
- //if (c5 != Color.Empty)
- // context.Graphics.FillPath(cache.insideBrush, cache.insidePath);
-
- //using (AntiAlias aa = new AntiAlias(context.Graphics))
- // context.Graphics.DrawPath(cache.outsidePen, cache.outsidePath);
- context.Graphics.DrawRectangle(cache.outsidePen, cache.rect);
-
- //switch (orientation)
- //{
- // case VisualOrientation.Top:
- // DrawRibbonTabSelectedTopDraw2010(rect, cache, context.Graphics);
- // break;
- // case VisualOrientation.Left:
- // DrawRibbonTabSelectedLeftDraw2010(rect, cache, context.Graphics);
- // break;
- // case VisualOrientation.Right:
- // DrawRibbonTabSelectedRightDraw2010(rect, cache, context.Graphics);
- // break;
- // case VisualOrientation.Bottom:
- // DrawRibbonTabSelectedBottomDraw2010(rect, cache, context.Graphics);
- // break;
- //}
- }
-
- return memento;
- }
-
- ///
- /// Internal rendering method.
- ///
- protected override IDisposable DrawRibbonTabTracking2010(PaletteRibbonShape shape,
- ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- PaletteState state,
- IPaletteRibbonBack palette,
- VisualOrientation orientation,
- IDisposable memento,
- bool standard)
- {
- if ((rect.Width > 0) && (rect.Height > 0))
- {
- Color c1 = palette.GetRibbonBackColor1(state);
- Color c2 = palette.GetRibbonBackColor2(state);
- Color c3 = palette.GetRibbonBackColor3(state);
- Color c4 = palette.GetRibbonBackColor4(state);
- Color c5 = palette.GetRibbonBackColor5(state);
-
- bool generate = true;
- MementoRibbonTabTracking2010 cache;
-
- // Access a cache instance and decide if cache resources need generating
- if ((memento == null) || !(memento is MementoRibbonTabTracking2010))
- {
- if (memento != null)
- {
- memento.Dispose();
- }
-
- cache = new MementoRibbonTabTracking2010(rect, c1, c2, c3, c4, orientation);
- memento = cache;
- }
- else
- {
- cache = (MementoRibbonTabTracking2010)memento;
- generate = !cache.UseCachedValues(rect, c1, c2, c3, c4, orientation);
- }
-
- // Do we need to generate the contents of the cache?
- if (generate)
- {
- // Dispose of existing values
- cache.Dispose();
-
- // If c5 has a colour then use that to highlight the tab
- if (c5 != Color.Empty)
- {
- if (!standard)
- {
- c5 = CommonHelper.MergeColors(c5, 0.65f, Color.Black, 0.35f);
- }
-
- c1 = c5;
- c2 = CommonHelper.MergeColors(c2, 0.8f, ControlPaint.Light(c5), 0.2f);
- c3 = CommonHelper.MergeColors(c3, 0.7f, c5, 0.3f);
- }
-
- switch (orientation)
- {
- case VisualOrientation.Top:
- DrawRibbonTabTrackingTop2010(rect, c3, c4, cache);
- break;
- case VisualOrientation.Left:
- DrawRibbonTabTrackingLeft2010(rect, c3, c4, cache);
- break;
- case VisualOrientation.Right:
- DrawRibbonTabTrackingRight2010(rect, c3, c4, cache);
- break;
- case VisualOrientation.Bottom:
- DrawRibbonTabTrackingBottom2010(rect, c3, c4, cache);
- break;
- }
-
- cache.outsidePen = new Pen(c1);
- cache.outsideBrush = new SolidBrush(c2);
- }
-
- // Fill the full background
- //context.Graphics.FillPath(cache.outsideBrush, cache.outsidePath);
- context.Graphics.FillRectangle(cache.outsideBrush, cache.rect);
-
- // Draw the border
- //using (AntiAlias aa = new AntiAlias(context.Graphics))
- // context.Graphics.DrawPath(cache.outsidePen, cache.borderPath);
- context.Graphics.DrawRectangle(cache.outsidePen, cache.rect);
-
- // Fill the inside area
- //context.Graphics.FillPath(cache.insideBrush, cache.insidePath);
- }
-
- return memento;
- }
- }
- #endregion
-}
\ No newline at end of file
diff --git a/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/Components/RenderProfessional.cs b/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/Components/RenderProfessional.cs
deleted file mode 100644
index 02d1ded0..00000000
--- a/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/Components/RenderProfessional.cs
+++ /dev/null
@@ -1,204 +0,0 @@
-using ComponentFactory.Krypton.Toolkit;
-using System;
-using System.Drawing;
-using System.Drawing.Drawing2D;
-using System.Windows.Forms;
-
-namespace ExtendedControls.Base.Renderers.Components
-{
- ///
- /// Extends the standard renderer to provide Professional style additions.
- ///
- public class RenderProfessional : RenderStandard
- {
- #region Static Fields
-
- private const int GRAB_SQUARE_LENGTH = 2;
- private const int GRAB_SQUARE_OFFSET = 1;
- private const int GRAB_SQUARE_TOTAL = 3;
- private const int GRAB_SQUARE_GAP = 1;
- private const int GRAB_SQUARE_MIN_SPACE = 5;
- private const int GRAB_SQUARE_COUNT = 5;
- private static readonly Color _grabHandleLight = Color.FromArgb(228, 255, 255, 255);
- private static readonly Color _grabHandleDark = Color.FromArgb(144, 0, 0, 0);
- #endregion
-
- #region RenderGlyph Overrides
- ///
- /// Perform drawing of a separator glyph.
- ///
- /// Render context.
- /// Display area available for drawing.
- /// Background palette details.
- /// Border palette details.
- /// Visual orientation of the content.
- /// State associated with rendering.
- /// Can the separator be moved.
- public override void DrawSeparator(RenderContext context,
- Rectangle displayRect,
- IPaletteBack paletteBack,
- IPaletteBorder paletteBorder,
- Orientation orientation,
- PaletteState state,
- bool canMove)
- {
- // Let base class perform standard processing
- base.DrawSeparator(context,
- displayRect,
- paletteBack,
- paletteBorder,
- orientation,
- state,
- canMove);
-
- // If we are drawing the background then draw grab handles on top
- if (paletteBack.GetBackDraw(state) == InheritBool.True)
- {
- // Only draw grab handle if the user can move the separator
- if (canMove)
- {
- DrawGrabHandleGlyph(context, displayRect, orientation, state);
- }
- }
- }
- #endregion
-
- #region Implementation
- ///
- /// Internal rendering method.
- ///
- protected virtual void DrawGrabHandleGlyph(RenderContext context,
- Rectangle displayRect,
- Orientation orientation,
- PaletteState state)
- {
- // Is there enough room to draw the at least one grab handle?
- if ((displayRect.Height >= GRAB_SQUARE_MIN_SPACE) && (displayRect.Width >= GRAB_SQUARE_MIN_SPACE))
- {
- // Reduce rectangle to remove the border around the display area edges
- displayRect.Inflate(-GRAB_SQUARE_GAP, -GRAB_SQUARE_GAP);
-
- // Find how much space is available for drawing grab handles in the orientation
- int orientationSpace = (orientation == Orientation.Horizontal ? displayRect.Width : displayRect.Height);
-
- // Try to display the maximum allowed number of handles, but show less if not possible
- for (int i = GRAB_SQUARE_COUNT; i > 0; i--)
- {
- // Calculate how much space this number of grab handles takes up
- int requiredSpace = (i * GRAB_SQUARE_TOTAL) + (i > 1 ? (i - 1) * GRAB_SQUARE_GAP : 0);
-
- // Is there enough space all the grab handles?
- if (requiredSpace <= orientationSpace)
- {
- // Find offset before showing the first handle
- int offset = (orientationSpace - requiredSpace) / 2;
-
- // Find location of first handle
- Point draw = orientation == Orientation.Horizontal
- ? new Point(displayRect.X + offset,
- displayRect.Y + ((displayRect.Height - GRAB_SQUARE_TOTAL) / 2))
- : new Point(displayRect.X + ((displayRect.Width - GRAB_SQUARE_TOTAL) / 2),
- displayRect.Y + offset);
-
- using (Brush lightBrush = new SolidBrush(_grabHandleLight),
- darkBrush = new SolidBrush(_grabHandleDark))
- {
- // Draw each grab handle in turn
- for (int j = 0; j < i; j++)
- {
- // Draw the light colored square
- context.Graphics.FillRectangle(lightBrush,
- draw.X + GRAB_SQUARE_OFFSET,
- draw.Y + GRAB_SQUARE_OFFSET,
- GRAB_SQUARE_LENGTH,
- GRAB_SQUARE_LENGTH);
-
- // Draw the dark colored square overlapping the dark
- context.Graphics.FillRectangle(darkBrush,
- draw.X,
- draw.Y,
- GRAB_SQUARE_LENGTH,
- GRAB_SQUARE_LENGTH);
-
- // Move to the next handle position
- if (orientation == Orientation.Horizontal)
- {
- draw.X += GRAB_SQUARE_TOTAL + GRAB_SQUARE_GAP;
- }
- else
- {
- draw.Y += GRAB_SQUARE_TOTAL + GRAB_SQUARE_GAP;
- }
- }
- }
-
- // Finished
- break;
- }
- }
- }
- }
-
- ///
- /// Internal rendering method.
- ///
- protected override IDisposable DrawRibbonTabContext(RenderContext context,
- Rectangle rect,
- IPaletteRibbonGeneral paletteGeneral,
- IPaletteRibbonBack paletteBack,
- IDisposable memento)
- {
- if ((rect.Width > 0) && (rect.Height > 0))
- {
- Color c1 = paletteGeneral.GetRibbonTabSeparatorContextColor(PaletteState.Normal);
- Color c2 = paletteBack.GetRibbonBackColor5(PaletteState.ContextCheckedNormal);
-
- bool generate = true;
- MementoRibbonTabContextOffice2010 cache;
-
- // Access a cache instance and decide if cache resources need generating
- if (!(memento is MementoRibbonTabContextOffice2010))
- {
- memento?.Dispose();
-
- cache = new MementoRibbonTabContextOffice2010(rect, c1, c2);
- memento = cache;
- }
- else
- {
- cache = (MementoRibbonTabContextOffice2010)memento;
- generate = !cache.UseCachedValues(rect, c1, c2);
- }
-
- // Do we need to generate the contents of the cache?
- if (generate)
- {
- // Dispose of existing values
- cache.Dispose();
-
- cache.borderOuterPen = new Pen(c1);
- cache.borderInnerPen = new Pen(CommonHelper.MergeColors(Color.Black, 0.1f, c2, 0.9f));
- cache.topBrush = new SolidBrush(c2);
- Color lightC2 = ControlPaint.Light(c2);
- cache.bottomBrush = new LinearGradientBrush(new RectangleF(rect.X - 1, rect.Y, rect.Width + 2, rect.Height + 1),
- Color.FromArgb(128, lightC2), Color.FromArgb(64, lightC2), 90f);
- }
-
- // Draw the left and right borders
- context.Graphics.DrawLine(cache.borderOuterPen, rect.X, rect.Y, rect.X, rect.Bottom);
- context.Graphics.DrawLine(cache.borderInnerPen, rect.X + 1, rect.Y, rect.X + 1, rect.Bottom - 1);
- context.Graphics.DrawLine(cache.borderOuterPen, rect.Right - 1, rect.Y, rect.Right - 1, rect.Bottom - 1);
- context.Graphics.DrawLine(cache.borderInnerPen, rect.Right - 2, rect.Y, rect.Right - 2, rect.Bottom - 1);
-
- // Draw the solid block of colour at the top
- context.Graphics.FillRectangle(cache.topBrush, rect.X + 2, rect.Y, rect.Width - 4, 4);
-
- // Draw the gradient to the bottom
- context.Graphics.FillRectangle(cache.bottomBrush, rect.X + 2, rect.Y + 4, rect.Width - 4, rect.Height - 4);
- }
-
- return memento;
- }
- #endregion
- }
-}
\ No newline at end of file
diff --git a/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/Components/RenderSparkle.cs b/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/Components/RenderSparkle.cs
deleted file mode 100644
index 6f5c6805..00000000
--- a/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/Components/RenderSparkle.cs
+++ /dev/null
@@ -1,401 +0,0 @@
-using ComponentFactory.Krypton.Toolkit;
-using ExtendedControls.Base.Renderers.Core;
-using System;
-using System.Diagnostics;
-using System.Drawing;
-using System.Drawing.Drawing2D;
-using System.Windows.Forms;
-
-namespace ExtendedControls.Base.Renderers.Components
-{
- ///
- /// Extends the professional renderer to provide Sparkle style additions.
- ///
- public class RenderSparkle : RenderProfessional
- {
- #region Static Fields
- private static readonly Blend _ribbonGroup5Blend;
- private static readonly Blend _ribbonGroup6Blend;
- private static readonly Blend _ribbonGroup7Blend;
- #endregion
-
- #region Identity
- static RenderSparkle()
- {
- _ribbonGroup5Blend = new Blend
- {
- Factors = new float[] { 0.0f, 0.0f, 1.0f },
- Positions = new float[] { 0.0f, 0.5f, 1.0f }
- };
-
- _ribbonGroup6Blend = new Blend
- {
- Factors = new float[] { 0.0f, 0.0f, 0.75f, 1.0f },
- Positions = new float[] { 0.0f, 0.1f, 0.45f, 1.0f }
- };
-
- _ribbonGroup7Blend = new Blend
- {
- Factors = new float[] { 0.0f, 1.0f, 1.0f, 0.0f },
- Positions = new float[] { 0.0f, 0.15f, 0.85f, 1.0f }
- };
- }
- #endregion
-
- #region RenderRibbon Overrides
- ///
- /// Draw the background of a ribbon element.
- ///
- /// Ribbon shape.
- /// Rendering context.
- /// Target rectangle.
- /// State associated with rendering.
- /// Palette used for sourcing settings.
- /// Orientation for drawing.
- /// Drawing onto a composition element.
- /// Cached values to use when drawing.
- public override IDisposable DrawRibbonBack(PaletteRibbonShape shape,
- ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- PaletteState state,
- IPaletteRibbonBack palette,
- VisualOrientation orientation,
- bool composition,
- IDisposable memento)
- {
- // Note is the incoming state is detailed we are drawing inside a popip
- bool showingInPopup = ((state & PaletteState.FocusOverride) == PaletteState.FocusOverride);
- if (showingInPopup)
- {
- state = state & ~PaletteState.FocusOverride;
- }
-
- switch (palette.GetRibbonBackColorStyle(state))
- {
- case PaletteRibbonColorStyle.RibbonGroupNormalBorderTracking:
- return DrawRibbonGroupNormalBorder(context, rect, state, palette, true, false, memento);
- case PaletteRibbonColorStyle.RibbonGroupAreaBorder:
- return DrawRibbonGroupAreaBorder1And2(context, rect, state, palette, false, true, memento);
- case PaletteRibbonColorStyle.RibbonGroupAreaBorder2:
- return DrawRibbonGroupAreaBorder1And2(context, rect, state, palette, true, true, memento);
- default:
- return base.DrawRibbonBack(shape, context, rect, state, palette, orientation, composition, memento);
- }
- }
-
- ///
- /// Draw a context ribbon tab title.
- ///
- /// Ribbon shape.
- /// Rendering context.
- /// Target rectangle.
- /// Palette used for general ribbon settings.
- /// Palette used for background ribbon settings.
- /// Cached storage for drawing objects.
- public override IDisposable DrawRibbonTabContextTitle(PaletteRibbonShape shape,
- ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- IPaletteRibbonGeneral paletteGeneral,
- IPaletteRibbonBack paletteBack,
- IDisposable memento)
- {
- return DrawRibbonTabContext(context, rect, paletteGeneral, paletteBack, memento);
- }
-
- ///
- /// Draw the application button.
- ///
- /// Ribbon shape.
- /// Rendering context.
- /// Target rectangle.
- /// State associated with rendering.
- /// Palette used for sourcing settings.
- /// Cached storage for drawing objects.
- public override IDisposable DrawRibbonApplicationButton(PaletteRibbonShape shape,
- ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- PaletteState state,
- IPaletteRibbonBack palette,
- IDisposable memento)
- {
- return DrawRibbonAppButton(shape, context, rect, state, palette, true, memento);
- }
-
- ///
- /// Perform drawing of a ribbon drop arrow glyph.
- ///
- /// Ribbon shape.
- /// Render context.
- /// Display area available for drawing.
- /// General ribbon palette details.
- /// State associated with rendering.
- ///
- public override void DrawRibbonDropArrow(PaletteRibbonShape shape,
- ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle displayRect,
- IPaletteRibbonGeneral paletteGeneral,
- PaletteState state)
- {
- Debug.Assert(context != null);
- Debug.Assert(paletteGeneral != null);
-
- // Validate parameter references
- if (context == null)
- {
- throw new ArgumentNullException(nameof(context));
- }
-
- if (paletteGeneral == null)
- {
- throw new ArgumentNullException(nameof(paletteGeneral));
- }
-
- Color darkColor = (state == PaletteState.Disabled ? paletteGeneral.GetRibbonDisabledDark(state) :
- paletteGeneral.GetRibbonGroupDialogDark(state));
-
- Color lightColor = (state == PaletteState.Disabled ? paletteGeneral.GetRibbonDisabledLight(state) :
- paletteGeneral.GetRibbonGroupDialogLight(state));
-
- using (Pen darkPen = new Pen(darkColor),
- lightPen = new Pen(lightColor))
- {
- context.Graphics.DrawLine(lightPen, displayRect.Left, displayRect.Top + 1, displayRect.Left + 2, displayRect.Top + 3);
- context.Graphics.DrawLine(lightPen, displayRect.Left + 2, displayRect.Top + 3, displayRect.Left + 4, displayRect.Top + 1);
- context.Graphics.DrawLine(lightPen, displayRect.Left + 4, displayRect.Top + 1, displayRect.Left + 1, displayRect.Top + 1);
- context.Graphics.DrawLine(lightPen, displayRect.Left + 1, displayRect.Top + 1, displayRect.Left + 2, displayRect.Top + 2);
- context.Graphics.DrawLine(darkPen, displayRect.Left, displayRect.Top + 2, displayRect.Left + 2, displayRect.Top + 4);
- context.Graphics.DrawLine(darkPen, displayRect.Left + 2, displayRect.Top + 4, displayRect.Left + 4, displayRect.Top + 2);
- }
- }
- #endregion
-
- #region RenderGlyph Overrides
-
- ///
- /// Draw a drop down grid appropriate for a input control.
- ///
- /// Render context.
- /// Available drawing rectangle space.
- /// Content palette for getting colors.
- /// State associated with rendering.
- ///
- public override void DrawInputControlDropDownGlyph(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle cellRect,
- IPaletteContent paletteContent,
- PaletteState state)
- {
- Debug.Assert(context != null);
- Debug.Assert(paletteContent != null);
-
- // Validate parameter references
- if (context == null)
- {
- throw new ArgumentNullException(nameof(context));
- }
-
- if (paletteContent == null)
- {
- throw new ArgumentNullException(nameof(paletteContent));
- }
-
- Color c1 = paletteContent.GetContentShortTextColor1(state);
-
- // Find the top left starting position for drawing lines
- int xStart = cellRect.Left + ((cellRect.Right - cellRect.Left - 4) / 2);
- int yStart = cellRect.Top + ((cellRect.Bottom - cellRect.Top - 3) / 2);
-
- using (Pen darkPen = new Pen(c1))
- {
- context.Graphics.DrawLine(darkPen, xStart, yStart, xStart + 4, yStart);
- context.Graphics.DrawLine(darkPen, xStart + 1, yStart + 1, xStart + 3, yStart + 1);
- context.Graphics.DrawLine(darkPen, xStart + 2, yStart + 2, xStart + 2, yStart + 1);
- }
- }
-
- ///
- /// Draw a numeric up button image appropriate for a input control.
- ///
- /// Render context.
- /// Available drawing rectangle space.
- /// Content palette for getting colors.
- /// State associated with rendering.
- ///
- public override void DrawInputControlNumericUpGlyph(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle cellRect,
- IPaletteContent paletteContent,
- PaletteState state)
- {
- Debug.Assert(context != null);
- Debug.Assert(paletteContent != null);
-
- // Validate parameter references
- if (context == null)
- {
- throw new ArgumentNullException(nameof(context));
- }
-
- if (paletteContent == null)
- {
- throw new ArgumentNullException(nameof(paletteContent));
- }
-
- Color c1 = paletteContent.GetContentShortTextColor1(state);
-
- // Find the top left starting position for drawing lines
- int xStart = cellRect.Left + ((cellRect.Right - cellRect.Left - 4) / 2);
- int yStart = cellRect.Top + ((cellRect.Bottom - cellRect.Top - 3) / 2);
-
- using (Pen darkPen = new Pen(c1))
- {
- context.Graphics.DrawLine(darkPen, xStart, yStart + 3, xStart + 4, yStart + 3);
- context.Graphics.DrawLine(darkPen, xStart + 1, yStart + 2, xStart + 3, yStart + 2);
- context.Graphics.DrawLine(darkPen, xStart + 2, yStart + 2, xStart + 2, yStart + 1);
- }
- }
-
- ///
- /// Draw a numeric down button image appropriate for a input control.
- ///
- /// Render context.
- /// Available drawing rectangle space.
- /// Content palette for getting colors.
- /// State associated with rendering.
- ///
- public override void DrawInputControlNumericDownGlyph(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle cellRect,
- IPaletteContent paletteContent,
- PaletteState state)
- {
- Debug.Assert(context != null);
- Debug.Assert(paletteContent != null);
-
- // Validate parameter references
- if (context == null)
- {
- throw new ArgumentNullException(nameof(context));
- }
-
- if (paletteContent == null)
- {
- throw new ArgumentNullException(nameof(paletteContent));
- }
-
- Color c1 = paletteContent.GetContentShortTextColor1(state);
-
- // Find the top left starting position for drawing lines
- int xStart = cellRect.Left + ((cellRect.Right - cellRect.Left - 4) / 2);
- int yStart = cellRect.Top + ((cellRect.Bottom - cellRect.Top - 3) / 2);
-
- using (Pen darkPen = new Pen(c1))
- {
- context.Graphics.DrawLine(darkPen, xStart, yStart, xStart + 4, yStart);
- context.Graphics.DrawLine(darkPen, xStart + 1, yStart + 1, xStart + 3, yStart + 1);
- context.Graphics.DrawLine(darkPen, xStart + 2, yStart + 2, xStart + 2, yStart + 1);
- }
- }
- #endregion
-
- #region IRenderer Overrides
-
- ///
- /// Gets a renderer for drawing the toolstrips.
- ///
- /// Color palette to use when rendering toolstrip.
- ///
- public override ToolStripRenderer RenderToolStrip(IPalette colorPalette)
- {
- Debug.Assert(colorPalette != null);
-
- // Validate incoming parameter
- if (colorPalette == null)
- {
- throw new ArgumentNullException(nameof(colorPalette));
- }
-
- // Use the professional renderer but pull colors from the palette
- KryptonSparkleRenderer renderer = new KryptonSparkleRenderer(colorPalette.ColorTable)
- {
-
- // Seup the need to use rounded corners
- RoundedEdges = (colorPalette.ColorTable.UseRoundedEdges != InheritBool.False)
- };
-
- return renderer;
- }
- #endregion
-
- #region Implementation
- ///
- /// Internal rendering method.
- ///
- protected override IDisposable DrawRibbonTabContext(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- IPaletteRibbonGeneral paletteGeneral,
- IPaletteRibbonBack paletteBack,
- IDisposable memento)
- {
- if ((rect.Width > 0) && (rect.Height > 0))
- {
- Color c1 = paletteGeneral.GetRibbonTabSeparatorContextColor(PaletteState.Normal);
- Color c2 = paletteBack.GetRibbonBackColor5(PaletteState.ContextCheckedNormal);
-
- bool generate = true;
- MementoRibbonTabContextOffice cache;
-
- // Access a cache instance and decide if cache resources need generating
- if (!(memento is MementoRibbonTabContextOffice))
- {
- memento?.Dispose();
-
- cache = new MementoRibbonTabContextOffice(rect, c1, c2);
- memento = cache;
- }
- else
- {
- cache = (MementoRibbonTabContextOffice)memento;
- generate = !cache.UseCachedValues(rect, c1, c2);
- }
-
- // Do we need to generate the contents of the cache?
- if (generate)
- {
- // Dispose of existing values
- cache.Dispose();
-
- Rectangle borderRect = new Rectangle(rect.X - 1, rect.Y - 1, rect.Width + 2, rect.Height + 2);
- cache.fillRect = new Rectangle(rect.X + 1, rect.Y, rect.Width - 2, rect.Height - 1);
-
- LinearGradientBrush borderBrush = new LinearGradientBrush(borderRect, c1, Color.Transparent, 270f)
- {
- Blend = _ribbonGroup5Blend
- };
- cache.borderPen = new Pen(borderBrush);
-
- LinearGradientBrush underlineBrush = new LinearGradientBrush(borderRect, Color.Transparent, Color.FromArgb(200, c2), 0f)
- {
- Blend = _ribbonGroup7Blend
- };
- cache.underlinePen = new Pen(underlineBrush);
-
- cache.fillBrush = new LinearGradientBrush(borderRect, Color.FromArgb(106, c2), Color.Transparent, 270f)
- {
- Blend = _ribbonGroup6Blend
- };
- }
-
- // Draw the left and right border lines
- context.Graphics.DrawLine(cache.borderPen, rect.X, rect.Y, rect.X, rect.Bottom - 1);
- context.Graphics.DrawLine(cache.borderPen, rect.Right - 1, rect.Y, rect.Right - 1, rect.Bottom - 1);
-
- // Fill the inner area with a gradient context specific color
- context.Graphics.FillRectangle(cache.fillBrush, cache.fillRect);
-
- // Overdraw the brighter line at bottom
- context.Graphics.DrawLine(cache.underlinePen, rect.X + 1, rect.Bottom - 2, rect.Right - 2, rect.Bottom - 2);
- }
-
- return memento;
- }
- #endregion
- }
-}
\ No newline at end of file
diff --git a/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/Components/RenderStandard.cs b/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/Components/RenderStandard.cs
deleted file mode 100644
index 61d91ccd..00000000
--- a/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/Components/RenderStandard.cs
+++ /dev/null
@@ -1,12118 +0,0 @@
-using ComponentFactory.Krypton.Toolkit;
-using ExtendedControls.Base.Renderers.Core;
-using System;
-using System.Diagnostics;
-using System.Drawing;
-using System.Drawing.Drawing2D;
-using System.Drawing.Imaging;
-using System.Drawing.Text;
-using System.Windows.Forms;
-using System.Windows.Forms.VisualStyles;
-
-namespace ExtendedControls.Base.Renderers.Components
-{
- ///
- /// Provides the standard renderer that honors all palette properties.
- ///
- public class RenderStandard : RenderBase
- {
- #region Static Fields
- // Constants
- private const int DRAG_ARROW_WIDTH = 13;
- private const int DRAG_ARROW_HEIGHT = 7;
- private const int DRAG_ARROW_GAP = 4;
- private const int SPACING_TAB_DOCK_OUTSIZE = 3;
- private const int SPACING_TAB_OUTSIZE_PADDING = 1;
- private const int SPACING_TAB_SQUARE_EQUAL_SMALL = -1;
- private const int SPACING_TAB_SQUARE_EQUAL_MEDIUM = 2;
- private const int SPACING_TAB_SQUARE_EQUAL_LARGE = 5;
- private const int SPACING_TAB_SQUARE_OUTSIZE_SMALL = -5;
- private const int SPACING_TAB_SQUARE_OUTSIZE_MEDIUM = -3;
- private const int SPACING_TAB_SQUARE_OUTSIZE_LARGE = 2;
- private const int SPACING_TAB_ROUNDED_EQUAL_SMALL = -1;
- private const int SPACING_TAB_ROUNDED_EQUAL_MEDIUM = 2;
- private const int SPACING_TAB_ROUNDED_EQUAL_LARGE = 5;
- private const int SPACING_TAB_ROUNDED_OUTSIZE_SMALL = -5;
- private const int SPACING_TAB_ROUNDED_OUTSIZE_MEDIUM = -3;
- private const int SPACING_TAB_ROUNDED_OUTSIZE_LARGE = 2;
- private const int SPACING_TAB_ROUNDED_CORNER = 2;
- private const int SPACING_TAB_SLANT_EQUAL = -7;
- private const int SPACING_TAB_SLANT_EQUAL_BOTH = -17;
- private const int SPACING_TAB_SLANT_OUTSIZE = -11;
- private const int SPACING_TAB_SLANT_PADDING = 12;
- private const int SPACING_TAB_ONE_NOTE = -14;
- private const int SPACING_TAB_ONE_NOTE_LPI = 12;
- private const int SPACING_TAB_ONE_NOTE_RPI = 19;
- private const int SPACING_TAB_ONE_NOTE_TPI = 5;
- private const int SPACING_TAB_ONE_NOTE_BPI = 0;
- private const int SPACING_TAB_ONE_NOTE_LPS = 4;
- private const int SPACING_TAB_ONE_NOTE_RPS = 24;
- private const int SPACING_TAB_ONE_NOTE_TPS = 3;
- private const int SPACING_TAB_ONE_NOTE_BPS = 2;
- private const int SPACING_TAB_SMOOTH_E = -6;
- private const int SPACING_TAB_SMOOTH_O = -14;
- private const int SPACING_TAB_SMOOTH_LRE = 5;
- private const int SPACING_TAB_SMOOTH_TE = 3;
- private const int SPACING_TAB_SMOOTH_LRO = 9;
- private const int SPACING_TAB_SMOOTH_TO = 7;
- private const int GROUP_FRAME_TITLE_HEIGHT = 8;
- private const float GROUP_GRADIENT_TWO = 0.16f;
- private const float GROUP_GRADIENT_FRAME = 0.32f;
-
- private static readonly Color _darken5 = Color.FromArgb(5, Color.Black);
- private static readonly Color _darken8 = Color.FromArgb(8, Color.Black);
- private static readonly Color _darken12 = Color.FromArgb(12, Color.Black);
- private static readonly Color _darken16 = Color.FromArgb(16, Color.Black);
- private static readonly Color _darken18 = Color.FromArgb(18, Color.Black);
- private static readonly Color _darken38 = Color.FromArgb(38, Color.Black);
- private static readonly Color _whiten200 = Color.FromArgb(200, Color.White);
- private static readonly Color _whiten160 = Color.FromArgb(160, Color.White);
- private static readonly Color _whiten128 = Color.FromArgb(128, Color.White);
- private static readonly Color _whiten120 = Color.FromArgb(120, Color.White);
- private static readonly Color _whiten92 = Color.FromArgb(92, Color.White);
- private static readonly Color _whiten80 = Color.FromArgb(80, Color.White);
- private static readonly Color _whiten64 = Color.FromArgb(64, Color.White);
- private static readonly Color _whiten60 = Color.FromArgb(60, Color.White);
- private static readonly Color _whiten50 = Color.FromArgb(50, Color.White);
- private static readonly Color _whiten45 = Color.FromArgb(45, Color.White);
- private static readonly Color _whiten32 = Color.FromArgb(32, Color.White);
- private static readonly Color _whiten30 = Color.FromArgb(30, Color.White);
- private static readonly Color _whiten10 = Color.FromArgb(10, Color.White);
- private static readonly Color _whiten5 = Color.FromArgb(5, Color.White);
- private static readonly Color _242 = Color.FromArgb(242, 242, 242);
- private static readonly Color _218 = Color.FromArgb(218, 218, 218);
- private static readonly Color _190 = Color.FromArgb(190, 190, 190);
-
- // Blends
- private static readonly Blend _linear25Blend, _linear33Blend, _linear40Blend, _linear50Blend;
- private static readonly Blend _switch25Blend, _switch33Blend, _switch50Blend, _switch90Blend;
- private static readonly Blend _halfCutBlend, _quarterPhaseBlend, _oneNoteBlend, _linearShadowBlend;
- private static readonly Blend _rounding2Blend, _rounding3Blend, _rounding4Blend, _rounding5Blend;
- private static readonly Blend _ribbonInBlend, _ribbonOutBlend, _ribbonTopBlend, _ribbonGroupArea3;
- private static readonly Blend _ribbonTabSelected1Blend, _ribbonTabSelected2Blend;
- private static readonly Blend _ribbonGroup1Blend, _ribbonGroup2Blend, _ribbonGroup3Blend;
- private static readonly Blend _ribbonGroup4Blend, _ribbonGroup5Blend, _ribbonGroup6Blend;
- private static readonly Blend _ribbonGroup7Blend, _ribbonGroup8Blend, _ribbonGroup9Blend;
- private static readonly Blend _ribbonTabTopBlend, _ribbonAppButtonBlend;
- private static readonly Blend _dragRoundedInsideBlend;
-
- // Pens
- private static readonly Pen _paleShadowPen;
- private static readonly Pen _lightShadowPen;
- private static readonly Pen _mediumShadowPen;
- private static readonly Pen _medium2ShadowPen;
- private static readonly Pen _darkShadowPen;
- private static readonly Pen _light1Pen;
- private static readonly Pen _light2Pen;
- private static readonly Pen _whitenMediumPen;
- private static readonly Pen _buttonShadowPen;
- private static readonly Pen _compositionPen;
-
- // Brushes
- private static readonly SolidBrush _whitenLightBrush;
- private static readonly SolidBrush _whitenLightLBrush;
- private static readonly SolidBrush _compositionBrush;
- private static readonly SolidBrush _buttonBorder1Brush;
- private static readonly SolidBrush _buttonBorder2Brush;
-
- // Images
- private static readonly ImageList _gridSortOrder;
- private static readonly ImageList _gridRowIndicators;
- private static readonly ImageList _gridErrorIcon;
- #endregion
-
- #region Identity
- static RenderStandard()
- {
- _linear25Blend = new Blend
- {
- Factors = new float[] { 0.0f, 0.0f, 0.0f, 1.0f },
- Positions = new float[] { 0.0f, 0.25f, 0.25f, 1.0f }
- };
-
- _linear33Blend = new Blend
- {
- Factors = new float[] { 0.0f, 0.0f, 0.0f, 1.0f },
- Positions = new float[] { 0.0f, 0.33f, 0.33f, 1.0f }
- };
-
- _linear40Blend = new Blend
- {
- Factors = new float[] { 0.0f, 0.0f, 0.0f, 1.0f },
- Positions = new float[] { 0.0f, 0.40f, 0.40f, 1.0f }
- };
-
- _linear50Blend = new Blend
- {
- Factors = new float[] { 0.0f, 0.0f, 0.0f, 1.0f },
- Positions = new float[] { 0.0f, 0.50f, 0.50f, 1.0f }
- };
-
- _linearShadowBlend = new Blend
- {
- Factors = new float[] { 0.0f, 1.0f, 1.0f },
- Positions = new float[] { 0.0f, 0.30f, 1.0f }
- };
-
- _switch25Blend = new Blend
- {
- Factors = new float[] { 0.0f, 0.0f, 1.0f, 1.0f },
- Positions = new float[] { 0.0f, 0.25f, 0.25f, 1.0f }
- };
-
- _switch33Blend = new Blend
- {
- Factors = new float[] { 0.0f, 0.0f, 1.0f, 1.0f },
- Positions = new float[] { 0.0f, 0.33f, 0.33f, 1.0f }
- };
-
- _switch50Blend = new Blend
- {
- Factors = new float[] { 0.0f, 0.0f, 1.0f, 1.0f },
- Positions = new float[] { 0.0f, 0.5f, 0.5f, 1.0f }
- };
-
- _switch90Blend = new Blend
- {
- Factors = new float[] { 0.0f, 0.0f, 0.0f, 1.0f },
- Positions = new float[] { 0.0f, 0.90f, 0.90f, 1.0f }
- };
-
- _halfCutBlend = new Blend
- {
- Factors = new float[] { 0.0f, 0.50f, 1.0f, 0.05f },
- Positions = new float[] { 0.0f, 0.45f, 0.45f, 1.0f }
- };
-
- _quarterPhaseBlend = new Blend
- {
- Factors = new float[] { 0.0f, 0.0f, 0.25f, 0.70f, 1.0f, 1.0f },
- Positions = new float[] { 0.0f, 0.10f, 0.20f, 0.30f, 0.5f, 1.0f }
- };
-
- _oneNoteBlend = new Blend
- {
- Factors = new float[] { 0.15f, 0.75f, 1.0f, 1.0f },
- Positions = new float[] { 0.0f, 0.45f, 0.45f, 1.0f }
- };
-
- _rounding2Blend = new Blend
- {
- Factors = new float[] { 0.8f, 0.2f, 0f, 0.07f, 1.0f },
- Positions = new float[] { 0.0f, 0.33f, 0.33f, 0.43f, 1.0f }
- };
-
- _rounding3Blend = new Blend
- {
- Factors = new float[] { 1.0f, 0.7f, 0.7f, 0f, 0.1f, 0.55f, 1.0f, 1.0f },
- Positions = new float[] { 0.0f, 0.16f, 0.33f, 0.35f, 0.51f, 0.85f, 0.85f, 1.0f }
- };
-
- _rounding4Blend = new Blend
- {
- Factors = new float[] { 1.0f, 0.78f, 0.48f, 1.0f, 1.0f },
- Positions = new float[] { 0.0f, 0.33f, 0.33f, 0.90f, 1.0f }
- };
-
- _rounding5Blend = new Blend
- {
- Factors = new float[] { 0.0f, 0.0f, 1.0f, 1.0f },
- Positions = new float[] { 0.0f, 0.20f, 0.84f, 1.0f }
- };
-
- _ribbonInBlend = new Blend
- {
- Factors = new float[] { 0.66f, 1.0f, 0.0f },
- Positions = new float[] { 0.0f, 0.50f, 1.0f }
- };
-
- _ribbonOutBlend = new Blend
- {
- Factors = new float[] { 0.2f, 1.0f, 0.0f },
- Positions = new float[] { 0.0f, 0.50f, 1.0f }
- };
-
- _ribbonTopBlend = new Blend
- {
- Factors = new float[] { 0.0f, 1.0f, 1.0f, 0.0f },
- Positions = new float[] { 0.0f, 0.2f, 0.8f, 1.0f }
- };
-
- _ribbonGroup1Blend = new Blend
- {
- Factors = new float[] { 0.0f, 0.0f, 0.6f, 1.0f },
- Positions = new float[] { 0.0f, 0.18f, 0.75f, 1.0f }
- };
-
- _ribbonGroup2Blend = new Blend
- {
- Factors = new float[] { 0.0f, 0.5f, 1.0f, 1.0f },
- Positions = new float[] { 0.0f, 0.18f, 0.2f, 1.0f }
- };
-
- _ribbonGroup3Blend = new Blend
- {
- Factors = new float[] { 0.0f, 0.0f, 1.0f, 0.0f, 0.0f },
- Positions = new float[] { 0.0f, 0.90f, 0.97f, 0.97f, 1.0f }
- };
-
- _ribbonGroup4Blend = new Blend
- {
- Factors = new float[] { 0.0f, 0.4f, 1.0f, 1.0f, },
- Positions = new float[] { 0.0f, 0.045f, 0.33f, 1.0f }
- };
-
- _ribbonGroup5Blend = new Blend
- {
- Factors = new float[] { 0.0f, 0.0f, 1.0f },
- Positions = new float[] { 0.0f, 0.5f, 1.0f }
- };
-
- _ribbonGroup6Blend = new Blend
- {
- Factors = new float[] { 0.0f, 0.0f, 1.0f },
- Positions = new float[] { 0.0f, 0.4f, 1.0f }
- };
-
- _ribbonGroup7Blend = new Blend
- {
- Factors = new float[] { 0.0f, 1.0f, 1.0f, 0.0f },
- Positions = new float[] { 0.0f, 0.15f, 0.85f, 1.0f }
- };
-
- _ribbonGroup8Blend = new Blend
- {
- Factors = new float[] { 0.0f, 0.0f, 1.0f },
- Positions = new float[] { 0.0f, 0.85f, 1.0f }
- };
-
- _ribbonGroup9Blend = new Blend
- {
- Factors = new float[] { 0.0f, 0.5f, 0.75f, 0.9f, 1.0f },
- Positions = new float[] { 0.0f, 0.25f, 0.50f, 0.75f, 1.0f }
- };
-
- _ribbonGroupArea3 = new Blend
- {
- Factors = new float[] { 1.0f, 0.0f, 0.0f, 1.0f },
- Positions = new float[] { 0.0f, 0.1f, 0.85f, 1.0f }
- };
-
- _ribbonTabSelected1Blend = new Blend
- {
- Factors = new float[] { 0.0f, 0.0f, 0.0f, 1.0f, 1.0f },
- Positions = new float[] { 0.0f, 0.50f, 0.50f, 0.9f, 1.0f }
- };
-
- _ribbonTabSelected2Blend = new Blend
- {
- Factors = new float[] { 0.0f, 1.0f, 1.0f },
- Positions = new float[] { 0.0f, 0.75f, 1.0f }
- };
-
- _ribbonTabTopBlend = new Blend
- {
- Factors = new float[] { 0.0f, 1.0f, 1.0f },
- Positions = new float[] { 0.0f, 0.2f, 1.0f }
- };
-
- _ribbonAppButtonBlend = new Blend
- {
- Factors = new float[] { 0.0f, 0.0f, 0.5f, 1.0f, 1.0f },
- Positions = new float[] { 0.0f, 0.1f, 0.5f, 0.5f, 1.0f }
- };
-
- _dragRoundedInsideBlend = new Blend
- {
- Factors = new float[] { 0.05f, 0.2f, 0.5f, 1.0f },
- Positions = new float[] { 0.0f, 0.5f, 0.5f, 1.0f }
- };
-
- _paleShadowPen = new Pen(Color.FromArgb(6, Color.Black));
- _lightShadowPen = new Pen(Color.FromArgb(8, Color.Black));
- _mediumShadowPen = new Pen(Color.FromArgb(10, Color.Black));
- _medium2ShadowPen = new Pen(Color.FromArgb(12, Color.Black));
- _darkShadowPen = new Pen(Color.FromArgb(18, Color.Black));
- _light1Pen = new Pen(Color.FromArgb(150, Color.White));
- _light2Pen = new Pen(Color.FromArgb(100, Color.White));
- _whitenMediumPen = new Pen(_whiten128);
- _buttonShadowPen = new Pen(Color.FromArgb(48, Color.Black));
- _compositionPen = new Pen(Color.FromArgb(96, Color.Black));
-
- _whitenLightBrush = new SolidBrush(_whiten30);
- _whitenLightLBrush = new SolidBrush(_whiten64);
- _compositionBrush = new SolidBrush(Color.FromArgb(32, Color.White));
-
- _buttonBorder1Brush = new SolidBrush(Color.FromArgb(20, 52, 59, 64));
- _buttonBorder2Brush = new SolidBrush(Color.FromArgb(70, 52, 59, 64));
-
- _gridSortOrder = new ImageList
- {
- TransparentColor = Color.Magenta,
- ImageSize = new Size(17, 11)
- };
- _gridSortOrder.Images.AddStrip(Properties.Resources.GridSortOrder);
-
- _gridRowIndicators = new ImageList
- {
- TransparentColor = Color.Magenta,
- ImageSize = new Size(19, 13)
- };
- _gridRowIndicators.Images.AddStrip(Properties.Resources.GridRowIndicators);
-
- _gridErrorIcon = new ImageList
- {
- TransparentColor = Color.Magenta,
- ImageSize = new Size(18, 17)
- };
- _gridErrorIcon.Images.AddStrip(Properties.Resources.GridErrorIcon);
- }
- #endregion
-
- #region IRenderer Overrides
- ///
- /// Gets a renderer for drawing the toolstrips.
- ///
- /// Color palette to use when rendering toolstrip.
- public override ToolStripRenderer RenderToolStrip(IPalette colorPalette)
- {
- Debug.Assert(colorPalette != null);
-
- // Validate incoming parameter
- if (colorPalette == null)
- {
- throw new ArgumentNullException(nameof(colorPalette));
- }
-
- // Use the professional renderer but pull colors from the palette
- KryptonStandardRenderer renderer = new KryptonStandardRenderer(colorPalette.ColorTable)
- {
-
- // Seup the need to use rounded corners
- RoundedEdges = (colorPalette.ColorTable.UseRoundedEdges != InheritBool.False)
- };
-
- return renderer;
- }
- #endregion
-
- #region RenderStandardBorder Overrides
-
- ///
- /// Gets the raw padding used per edge of the border.
- ///
- /// Palette used for drawing.
- /// State associated with rendering.
- /// Visual orientation of the border.
- ///
- /// Padding structure detailing all four edges.
- public override Padding GetBorderRawPadding(IPaletteBorder palette,
- PaletteState state,
- VisualOrientation orientation)
- {
- Debug.Assert(palette != null);
-
- // Validate parameter reference
- if (palette == null)
- {
- throw new ArgumentNullException(nameof(palette));
- }
-
- PaletteDrawBorders borders = palette.GetBorderDrawBorders(state);
-
- // If there is at least one border to be drawn
- if (CommonHelper.HasABorder(borders))
- {
- int borderWidth = palette.GetBorderWidth(state);
-
- switch (borders)
- {
- case PaletteDrawBorders.Bottom:
- return new Padding(0, 0, 0, borderWidth);
- case PaletteDrawBorders.BottomLeft:
- return new Padding(borderWidth, 0, 0, borderWidth);
- case PaletteDrawBorders.BottomLeftRight:
- return new Padding(borderWidth, 0, borderWidth, borderWidth);
- case PaletteDrawBorders.BottomRight:
- return new Padding(0, 0, borderWidth, borderWidth);
- case PaletteDrawBorders.Left:
- return new Padding(borderWidth, 0, 0, 0);
- case PaletteDrawBorders.LeftRight:
- return new Padding(borderWidth, 0, borderWidth, 0);
- case PaletteDrawBorders.Top:
- return new Padding(0, borderWidth, 0, 0);
- case PaletteDrawBorders.Right:
- return new Padding(0, 0, borderWidth, 0);
- case PaletteDrawBorders.TopBottom:
- return new Padding(0, borderWidth, 0, borderWidth);
- case PaletteDrawBorders.TopBottomLeft:
- return new Padding(borderWidth, borderWidth, 0, borderWidth);
- case PaletteDrawBorders.TopBottomRight:
- return new Padding(0, borderWidth, borderWidth, borderWidth);
- case PaletteDrawBorders.TopLeft:
- return new Padding(borderWidth, borderWidth, 0, 0);
- case PaletteDrawBorders.TopLeftRight:
- return new Padding(borderWidth, borderWidth, borderWidth, 0);
- case PaletteDrawBorders.TopRight:
- return new Padding(0, borderWidth, borderWidth, 0);
- case PaletteDrawBorders.All:
- return new Padding(borderWidth);
- default:
- // Should never happen!
- Debug.Assert(false);
- return Padding.Empty;
- }
- }
- else
- {
- return Padding.Empty;
- }
- }
-
- ///
- /// Gets the padding used to position display elements completely inside border drawing.
- ///
- /// Palette used for drawing.
- /// State associated with rendering.
- /// Visual orientation of the border.
- ///
- /// Padding structure detailing all four edges.
- public override Padding GetBorderDisplayPadding(IPaletteBorder palette,
- PaletteState state,
- VisualOrientation orientation)
- {
- Debug.Assert(palette != null);
-
- // Validate parameter reference
- if (palette == null)
- {
- throw new ArgumentNullException(nameof(palette));
- }
-
- PaletteDrawBorders borders = palette.GetBorderDrawBorders(state);
-
- // If there is at least one border to be drawn
- if (CommonHelper.HasABorder(borders))
- {
- int borderWidth = palette.GetBorderWidth(state);
-
- // Divide the rounding effect by PI to get the actual pixel distance needed
- // for offseting. But add 2 so it starts indenting on a rounding of just 1.
- int roundPadding = Convert.ToInt16((palette.GetBorderRounding(state) + borderWidth + 2) / Math.PI);
-
- // If not involving rounding then padding for an edge is just the border width
- int squarePadding = borderWidth;
-
- // Borders thicker than 1 need extra offsetting, by half the extra width
- if (borderWidth > 1)
- {
- int halfExtra = borderWidth / 2;
- roundPadding += halfExtra;
- }
-
- // Enforce the width of the border as the minimum to ensure
- // it still works as expected for small values of rounding
- if (roundPadding < borderWidth)
- {
- roundPadding = borderWidth;
- }
-
- switch (borders)
- {
- case PaletteDrawBorders.Bottom:
- return new Padding(0, 0, 0, squarePadding);
- case PaletteDrawBorders.BottomLeft:
- return new Padding(roundPadding, 0, 0, roundPadding);
- case PaletteDrawBorders.BottomLeftRight:
- return new Padding(roundPadding, 0, roundPadding, roundPadding);
- case PaletteDrawBorders.BottomRight:
- return new Padding(0, 0, roundPadding, roundPadding);
- case PaletteDrawBorders.Left:
- return new Padding(squarePadding, 0, 0, 0);
- case PaletteDrawBorders.LeftRight:
- return new Padding(squarePadding, 0, squarePadding, 0);
- case PaletteDrawBorders.Top:
- return new Padding(0, squarePadding, 0, 0);
- case PaletteDrawBorders.Right:
- return new Padding(0, 0, squarePadding, 0);
- case PaletteDrawBorders.TopBottom:
- return new Padding(0, squarePadding, 0, squarePadding);
- case PaletteDrawBorders.TopBottomLeft:
- return new Padding(roundPadding, roundPadding, 0, roundPadding);
- case PaletteDrawBorders.TopBottomRight:
- return new Padding(0, roundPadding, roundPadding, roundPadding);
- case PaletteDrawBorders.TopLeft:
- return new Padding(roundPadding, roundPadding, 0, 0);
- case PaletteDrawBorders.TopLeftRight:
- return new Padding(roundPadding, roundPadding, roundPadding, 0);
- case PaletteDrawBorders.TopRight:
- return new Padding(0, roundPadding, roundPadding, 0);
- case PaletteDrawBorders.All:
- return new Padding(roundPadding);
- default:
- // Should never happen!
- Debug.Assert(false);
- return Padding.Empty;
- }
- }
- else
- {
- return Padding.Empty;
- }
- }
-
- ///
- /// Generate a graphics path that is the outside edge of the border.
- ///
- /// Rendering context.
- /// Target rectangle.
- /// Palette used for drawing.
- /// Visual orientation of the border.
- /// State associated with rendering.
- ///
- /// GraphicsPath instance.
- public override GraphicsPath GetOutsideBorderPath(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- IPaletteBorder palette,
- VisualOrientation orientation,
- PaletteState state)
- {
- Debug.Assert(context != null);
- Debug.Assert(palette != null);
-
- // Validate parameter references
- if (context == null)
- {
- throw new ArgumentNullException(nameof(context));
- }
-
- if (palette == null)
- {
- throw new ArgumentNullException(nameof(palette));
- }
-
- Debug.Assert(context.Control != null);
- Debug.Assert(!context.Control.IsDisposed);
-
- // Use helper to create a border path on the outside
- return CreateBorderBackPath(true, false, rect,
- CommonHelper.OrientateDrawBorders(palette.GetBorderDrawBorders(state), orientation),
- palette.GetBorderWidth(state),
- palette.GetBorderRounding(state),
- (palette.GetBorderGraphicsHint(state) == PaletteGraphicsHint.AntiAlias),
- 0);
- }
-
- ///
- /// Generate a graphics path that is in the middle of the border.
- ///
- /// Rendering context.
- /// Target rectangle.
- /// Palette used for drawing.
- /// Visual orientation of the border.
- /// State associated with rendering.
- ///
- /// GraphicsPath instance.
- public override GraphicsPath GetBorderPath(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- IPaletteBorder palette,
- VisualOrientation orientation,
- PaletteState state)
- {
- Debug.Assert(context != null);
- Debug.Assert(palette != null);
-
- // Validate parameter references
- if (context == null)
- {
- throw new ArgumentNullException(nameof(context));
- }
-
- if (palette == null)
- {
- throw new ArgumentNullException(nameof(palette));
- }
-
- Debug.Assert(context.Control != null);
- Debug.Assert(!context.Control.IsDisposed);
-
- // Use helper to create a border path in middle of the pen
- return CreateBorderBackPath(false,
- true,
- rect,
- CommonHelper.OrientateDrawBorders(palette.GetBorderDrawBorders(state), orientation),
- palette.GetBorderWidth(state),
- palette.GetBorderRounding(state),
- (palette.GetBorderGraphicsHint(state) == PaletteGraphicsHint.AntiAlias),
- 0);
- }
-
- ///
- /// Generate a graphics path that encloses the border and is used when rendering a background to ensure the background does not draw over the border area.
- ///
- /// Rendering context.
- /// Target rectangle.
- /// Palette used for drawing.
- /// Visual orientation of the border.
- /// State associated with rendering.
- ///
- /// GraphicsPath instance.
- public override GraphicsPath GetBackPath(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- IPaletteBorder palette,
- VisualOrientation orientation,
- PaletteState state)
- {
- Debug.Assert(context != null);
- Debug.Assert(palette != null);
-
- // Validate parameter references
- if (context == null)
- {
- throw new ArgumentNullException(nameof(context));
- }
-
- if (palette == null)
- {
- throw new ArgumentNullException(nameof(palette));
- }
-
- Debug.Assert(context.Control != null);
- Debug.Assert(!context.Control.IsDisposed);
-
- // Use helper to create a border path in middle of the pen
- return CreateBorderBackPath(false,
- true,
- rect,
- CommonHelper.OrientateDrawBorders(palette.GetBorderDrawBorders(state), orientation),
- palette.GetBorderWidth(state),
- palette.GetBorderRounding(state),
- (palette.GetBorderGraphicsHint(state) == PaletteGraphicsHint.AntiAlias),
- 0);
- }
-
- ///
- /// Draw border on the inside edge of the specified rectangle.
- ///
- /// Rendering context.
- /// Target rectangle.
- /// Palette used for drawing.
- /// Visual orientation of the border.
- /// State associated with rendering.
- ///
- public override void DrawBorder(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- IPaletteBorder palette,
- VisualOrientation orientation,
- PaletteState state)
- {
- Debug.Assert(context != null);
- Debug.Assert(palette != null);
-
- // Validate parameter references
- if (context == null)
- {
- throw new ArgumentNullException(nameof(context));
- }
-
- if (palette == null)
- {
- throw new ArgumentNullException(nameof(palette));
- }
-
- Debug.Assert(context.Control != null);
- Debug.Assert(!context.Control.IsDisposed);
-
- PaletteDrawBorders borders = palette.GetBorderDrawBorders(state);
-
- // Is there anything to actually draw?
- if ((rect.Width > 0) && (rect.Height > 0) && CommonHelper.HasABorder(borders))
- {
- // Only use anti aliasing if the border is rounded
- SmoothingMode smoothMode = (palette.GetBorderRounding(state) > 0 ? SmoothingMode.AntiAlias : SmoothingMode.Default);
-
- // We want to draw using anti aliasing for a nice smooth effect
- using (GraphicsHint hint = new GraphicsHint(context.Graphics, palette.GetBorderGraphicsHint(state)))
- {
- // Cache commonly used values
- int borderWidth = palette.GetBorderWidth(state);
-
- // Get the orientation correct borders value
- borders = CommonHelper.OrientateDrawBorders(borders, orientation);
-
- // Is there any border to actually draw?
- if (borderWidth > 0)
- {
- using (Clipping clip = new Clipping(context.Graphics, rect))
- {
- // We always create the first border path variant
- GraphicsPath borderPath0 = CreateBorderBackPath(true, true, rect, borders, borderWidth,
- palette.GetBorderRounding(state),
- (smoothMode == SmoothingMode.AntiAlias), 0);
-
- GraphicsPath borderPath1 = null;
-
- // We only need the second border path if the two borders used are opposite each other
- if ((borders == PaletteDrawBorders.TopBottom) ||
- (borders == PaletteDrawBorders.LeftRight))
- {
- borderPath1 = CreateBorderBackPath(true, true, rect, borders, borderWidth,
- palette.GetBorderRounding(state),
- (smoothMode == SmoothingMode.AntiAlias), 1);
- }
-
- // Get the rectangle to use when dealing with gradients
- Rectangle gradientRect = context.GetAlignedRectangle(palette.GetBorderColorAlign(state), rect);
-
- // Use standard helper routine to create appropriate color brush
- PaletteColorStyle colorStyle = palette.GetBorderColorStyle(state);
- using (Pen borderPen = new Pen(CreateColorBrush(gradientRect,
- palette.GetBorderColor1(state),
- palette.GetBorderColor2(state),
- colorStyle,
- palette.GetBorderColorAngle(state),
- orientation), borderWidth))
- {
- if (colorStyle == PaletteColorStyle.Dashed)
- {
- borderPen.DashPattern = new float[] { 2, 2 };
- }
-
- context.Graphics.DrawPath(borderPen, borderPath0);
-
- // Optionally also draw the second path
- if (borderPath1 != null)
- {
- context.Graphics.DrawPath(borderPen, borderPath1);
- }
- }
-
- Image borderImage = palette.GetBorderImage(state);
- PaletteImageStyle borderImageStyle = palette.GetBorderImageStyle(state);
-
- // Do we need to draw the image?
- if (ShouldDrawImage(borderImage))
- {
- // Get the rectangle to use when dealing with gradients
- Rectangle imageRect = context.GetAlignedRectangle(palette.GetBorderImageAlign(state), rect);
-
- // Use standard helper routine to create appropriate image brush
- using (Pen borderPen = new Pen(CreateImageBrush(imageRect, borderImage, borderImageStyle), borderWidth))
- {
- context.Graphics.DrawPath(borderPen, borderPath0);
-
- // Optionally also draw the second path
- if (borderPath1 != null)
- {
- context.Graphics.DrawPath(borderPen, borderPath1);
- }
- }
- }
-
- // Remember to dispose of resources
- borderPath0.Dispose();
-
- borderPath1?.Dispose();
- }
- }
- }
- }
- }
- #endregion
-
- #region RenderStandardBack Overrides
-
- ///
- /// Draw background to fill the specified path.
- ///
- /// Rendering context.
- /// Target rectangle that encloses path.
- /// Graphics path.
- /// Palette used for drawing.
- /// Visual orientation of the border.
- /// State associated with rendering.
- /// Cache used for drawing.
- ///
- public override IDisposable DrawBack(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- GraphicsPath path,
- IPaletteBack palette,
- VisualOrientation orientation,
- PaletteState state,
- IDisposable memento)
- {
- Debug.Assert(context != null);
- Debug.Assert(path != null);
- Debug.Assert(palette != null);
-
- // Validate parameter references
- if (context == null)
- {
- throw new ArgumentNullException(nameof(context));
- }
-
- if (palette == null)
- {
- throw new ArgumentNullException(nameof(palette));
- }
-
- Debug.Assert(context.Control != null);
- Debug.Assert(!context.Control.IsDisposed);
-
- // Is there anything to actually draw?
- if ((rect.Width > 0) && (rect.Height > 0))
- {
- // We want to draw using anti aliasing for a nice smooth effect
- using (GraphicsHint smooth = new GraphicsHint(context.Graphics, palette.GetBackGraphicsHint(state)))
- {
- // Cache commonly used values
- Image backImage = palette.GetBackImage(state);
- PaletteImageStyle backImageStyle = palette.GetBackImageStyle(state);
- PaletteColorStyle backColorStyle = palette.GetBackColorStyle(state);
- Color backColor1 = palette.GetBackColor1(state);
- Color backColor2 = palette.GetBackColor2(state);
- float backColorAngle = palette.GetBackColorAngle(state);
-
- // Get the rectangle to use when dealing with gradients
- Rectangle gradientRect = context.GetAlignedRectangle(palette.GetBackColorAlign(state), rect);
-
- switch (backColorStyle)
- {
- case PaletteColorStyle.GlassSimpleFull:
- memento = RenderGlassHelpers.DrawBackGlassSimpleFull(context, rect, backColor1, backColor2, orientation, path, memento);
- break;
- case PaletteColorStyle.GlassNormalFull:
- memento = RenderGlassHelpers.DrawBackGlassNormalFull(context, rect, backColor1, backColor2, orientation, path, memento);
- break;
- case PaletteColorStyle.GlassTrackingFull:
- memento = RenderGlassHelpers.DrawBackGlassTrackingFull(context, rect, backColor1, backColor2, orientation, path, memento);
- break;
- case PaletteColorStyle.GlassPressedFull:
- memento = RenderGlassHelpers.DrawBackGlassPressedFull(context, rect, backColor1, backColor2, orientation, path, memento);
- break;
- case PaletteColorStyle.GlassCheckedFull:
- memento = RenderGlassHelpers.DrawBackGlassCheckedFull(context, rect, backColor1, backColor2, orientation, path, memento);
- break;
- case PaletteColorStyle.GlassCheckedTrackingFull:
- memento = RenderGlassHelpers.DrawBackGlassCheckedTrackingFull(context, rect, backColor1, backColor2, orientation, path, memento);
- break;
- case PaletteColorStyle.GlassNormalStump:
- memento = RenderGlassHelpers.DrawBackGlassNormalStump(context, rect, backColor1, backColor2, orientation, path, memento);
- break;
- case PaletteColorStyle.GlassTrackingStump:
- memento = RenderGlassHelpers.DrawBackGlassTrackingStump(context, rect, backColor1, backColor2, orientation, path, memento);
- break;
- case PaletteColorStyle.GlassPressedStump:
- memento = RenderGlassHelpers.DrawBackGlassPressedStump(context, rect, backColor1, backColor2, orientation, path, memento);
- break;
- case PaletteColorStyle.GlassCheckedStump:
- memento = RenderGlassHelpers.DrawBackGlassCheckedStump(context, rect, backColor1, backColor2, orientation, path, memento);
- break;
- case PaletteColorStyle.GlassCheckedTrackingStump:
- memento = RenderGlassHelpers.DrawBackGlassCheckedTrackingStump(context, rect, backColor1, backColor2, orientation, path, memento);
- break;
- case PaletteColorStyle.GlassThreeEdge:
- memento = RenderGlassHelpers.DrawBackGlassThreeEdge(context, rect, backColor1, backColor2, orientation, path, memento);
- break;
- case PaletteColorStyle.GlassNormalSimple:
- memento = RenderGlassHelpers.DrawBackGlassNormalSimple(context, rect, backColor1, backColor2, orientation, path, memento);
- break;
- case PaletteColorStyle.GlassTrackingSimple:
- memento = RenderGlassHelpers.DrawBackGlassTrackingSimple(context, rect, backColor1, backColor2, orientation, path, memento);
- break;
- case PaletteColorStyle.GlassPressedSimple:
- memento = RenderGlassHelpers.DrawBackGlassPressedSimple(context, rect, backColor1, backColor2, orientation, path, memento);
- break;
- case PaletteColorStyle.GlassCheckedSimple:
- memento = RenderGlassHelpers.DrawBackGlassCheckedSimple(context, rect, backColor1, backColor2, orientation, path, memento);
- break;
- case PaletteColorStyle.GlassCheckedTrackingSimple:
- memento = RenderGlassHelpers.DrawBackGlassCheckedTrackingSimple(context, rect, backColor1, backColor2, orientation, path, memento);
- break;
- case PaletteColorStyle.GlassCenter:
- memento = RenderGlassHelpers.DrawBackGlassCenter(context, rect, backColor1, backColor2, orientation, path, memento);
- break;
- case PaletteColorStyle.GlassBottom:
- memento = RenderGlassHelpers.DrawBackGlassBottom(context, rect, backColor1, backColor2, orientation, path, memento);
- break;
- case PaletteColorStyle.GlassFade:
- memento = RenderGlassHelpers.DrawBackGlassFade(context, rect, backColor1, backColor2, orientation, path, memento);
- break;
- case PaletteColorStyle.ExpertTracking:
- memento = RenderExpertHelpers.DrawBackExpertTracking(context, rect, backColor1, backColor2, orientation, path, memento);
- break;
- case PaletteColorStyle.ExpertPressed:
- memento = RenderExpertHelpers.DrawBackExpertPressed(context, rect, backColor1, backColor2, orientation, path, memento);
- break;
- case PaletteColorStyle.ExpertChecked:
- memento = RenderExpertHelpers.DrawBackExpertChecked(context, rect, backColor1, backColor2, orientation, path, memento);
- break;
- case PaletteColorStyle.ExpertCheckedTracking:
- memento = RenderExpertHelpers.DrawBackExpertCheckedTracking(context, rect, backColor1, backColor2, orientation, path, memento);
- break;
- case PaletteColorStyle.ExpertSquareHighlight:
- memento = RenderExpertHelpers.DrawBackExpertSquareHighlight(context, rect, backColor1, backColor2, orientation, path, memento, false);
- break;
- case PaletteColorStyle.ExpertSquareHighlight2:
- memento = RenderExpertHelpers.DrawBackExpertSquareHighlight(context, rect, backColor1, backColor2, orientation, path, memento, true);
- break;
- case PaletteColorStyle.SolidInside:
- DrawBackSolidInside(context, gradientRect, backColor1, backColor2, path);
- break;
- case PaletteColorStyle.SolidLeftLine:
- case PaletteColorStyle.SolidRightLine:
- case PaletteColorStyle.SolidTopLine:
- case PaletteColorStyle.SolidBottomLine:
- case PaletteColorStyle.SolidAllLine:
- DrawBackSolidLine(context, rect, backColor1, backColor2, backColorStyle, path);
- break;
- case PaletteColorStyle.OneNote:
- DrawBackOneNote(context, gradientRect, backColor1, backColor2,
- backColorStyle, backColorAngle, orientation, path);
- break;
- case PaletteColorStyle.RoundedTopLeftWhite:
- DrawBackRoundedTopLeftWhite(context, rect, gradientRect, backColor1, backColor2,
- backColorStyle, backColorAngle, orientation, path);
- break;
- case PaletteColorStyle.RoundedTopLight:
- DrawBackRoundedTopLight(context, rect, gradientRect, backColor1, backColor2,
- backColorStyle, backColorAngle, orientation, path);
- break;
- case PaletteColorStyle.Rounding4:
- DrawBackRounded4(context, rect, gradientRect, backColor1, backColor2,
- backColorStyle, backColorAngle, orientation, path);
- break;
- case PaletteColorStyle.Rounding5:
- DrawBackRounding5(context, rect, gradientRect, backColor1, backColor2,
- backColorStyle, backColorAngle, orientation, path);
- break;
- case PaletteColorStyle.LinearShadow:
- DrawBackLinearShadow(context, rect, gradientRect, backColor1, backColor2,
- backColorStyle, backColorAngle, orientation, path);
- break;
- default:
- // Use standard helper routine to create appropriate color brush
- using (Brush backBrush = CreateColorBrush(gradientRect, backColor1, backColor2,
- backColorStyle, backColorAngle, orientation))
- {
- context.Graphics.FillPath(backBrush, path);
- }
- break;
- }
-
- // Do we need to draw the image?
- if (ShouldDrawImage(backImage))
- {
- // Get the rectangle to use when dealing with gradients
- Rectangle imageRect = context.GetAlignedRectangle(palette.GetBackImageAlign(state), rect);
-
- // Use standard helper routine to create appropriate image brush
- using (Brush backBrush = CreateImageBrush(imageRect, backImage, backImageStyle))
- {
- context.Graphics.FillPath(backBrush, path);
- }
- }
- }
- }
-
- return memento;
- }
-
- #endregion
-
- #region RenderStandardContent Overrides
-
- ///
- /// Get the preferred size for drawing the content.
- ///
- /// Layout context.
- /// Content palette details.
- /// Content values.
- /// Visual orientation of the content.
- /// State associated with rendering.
- /// Should draw on a composition element.
- /// If composition, should glowing be drawn.
- ///
- /// Preferred size.
- public override Size GetContentPreferredSize(ViewLayoutContext context,
- IPaletteContent palette,
- IContentValues values,
- VisualOrientation orientation,
- PaletteState state,
- bool composition,
- bool glowing)
- {
- Debug.Assert(context != null);
- Debug.Assert(palette != null);
- Debug.Assert(values != null);
-
- // Validate parameter references
- if (context == null)
- {
- throw new ArgumentNullException(nameof(context));
- }
-
- if (palette == null)
- {
- throw new ArgumentNullException(nameof(palette));
- }
-
- Debug.Assert(context.Control != null);
- Debug.Assert(!context.Control.IsDisposed);
-
- // Provide a maximum sized rectangle for placing content into, in
- // order to work out how much of the space is actually allocated
- Rectangle displayRect = new Rectangle(Point.Empty, new Size(int.MaxValue, int.MaxValue));
-
- // Track the allocated space in each grid position
- Size[,] allocation = new Size[3, 3] { { Size.Empty, Size.Empty, Size.Empty },
- { Size.Empty, Size.Empty, Size.Empty },
- { Size.Empty, Size.Empty, Size.Empty } };
-
- // Create a memento for storing calculations
- using (StandardContentMemento memento = new StandardContentMemento())
- {
- // Cache the size of a spacing gap
- int spacingGap = palette.GetContentAdjacentGap(state);
-
- // Is the content intended for a vertical drawing orientation?
- bool vertical = (orientation == VisualOrientation.Left) ||
- (orientation == VisualOrientation.Right);
-
- // Drawing vertical means we can ignore right to left, otherwise get value from control
- RightToLeft rtl = (vertical ? RightToLeft.No : context.Control.RightToLeft);
-
- // Allocate space for each required content in turn
- AllocateImageSpace(memento, palette, values, state, displayRect, rtl, ref allocation);
- AllocateShortTextSpace(context, context.Graphics, memento, palette, values, state, displayRect, rtl, spacingGap, ref allocation, composition, glowing);
- AllocateLongTextSpace(context, context.Graphics, memento, palette, values, state, displayRect, rtl, spacingGap, ref allocation, composition, glowing);
-
- // Add up total allocated for rows and columns
- int allocatedWidth = AllocatedTotalWidth(allocation, -1, -1, spacingGap);
- int allocatedHeight = AllocatedTotalHeight(allocation);
-
- // Grab the padding for the content
- Padding borderPadding = palette.GetContentPadding(state);
-
- // For the form level buttons we have to calculate the correct padding based on caption area
- PaletteContentStyle contentStyle = palette.GetContentStyle();
- if ((contentStyle == PaletteContentStyle.ButtonForm) ||
- (contentStyle == PaletteContentStyle.ButtonFormClose))
- {
- borderPadding = ContentPaddingForButtonForm(borderPadding, context, allocatedHeight);
- }
-
- // The preferred size needed depends on the orientation.
- switch (orientation)
- {
- case VisualOrientation.Top:
- case VisualOrientation.Bottom:
- // Preferred size is the allocated space for the content plus the border padding
- return new Size(allocatedWidth + borderPadding.Horizontal,
- allocatedHeight + borderPadding.Vertical);
- case VisualOrientation.Left:
- case VisualOrientation.Right:
- // Preferred size is the allocated space for the content plus the border padding
- return new Size(allocatedHeight + borderPadding.Vertical,
- allocatedWidth + borderPadding.Horizontal);
- default:
- // Should never happen!
- Debug.Assert(false);
- return Size.Empty;
- }
- }
- }
-
- ///
- /// Perform layout calculations on the provided content.
- ///
- /// Layout context.
- /// Display area available for laying out.
- /// Content palette details.
- /// Content values.
- /// Visual orientation of the content.
- /// State associated with rendering.
- /// Should draw on a composition element.
- /// If composition, should glowing be drawn.
- ///
- /// Memento with cached information.
- public override IDisposable LayoutContent(ViewLayoutContext context,
- Rectangle availableRect,
- IPaletteContent palette,
- IContentValues values,
- VisualOrientation orientation,
- PaletteState state,
- bool composition,
- bool glowing)
- {
- Debug.Assert(context != null);
- Debug.Assert(palette != null);
- Debug.Assert(values != null);
-
- // Validate parameter references
- if (context == null)
- {
- throw new ArgumentNullException(nameof(context));
- }
-
- if (palette == null)
- {
- throw new ArgumentNullException(nameof(palette));
- }
-
- Debug.Assert(context.Control != null);
- Debug.Assert(!context.Control.IsDisposed);
-
- // Remember the original value, for use later
- Rectangle cacheDisplayRect = availableRect;
-
- // Grab the padding for the content
- Padding borderPadding = palette.GetContentPadding(state);
-
- // Is the content intended for a vertical drawing orientation?
- bool vertical = (orientation == VisualOrientation.Left) ||
- (orientation == VisualOrientation.Right);
-
- // If we need to apply in a vertical orientation
- if (vertical)
- {
- // Our algorithm only works by assuming a left to right horizontal
- // orientation, so we adjust the display rect to that orientation
- // and then at the end adjust the memento produced back to the
- // required orientation again. 'AdjustForOrientation'
- int temp = availableRect.Width;
- availableRect.Width = availableRect.Height;
- availableRect.Height = temp;
- }
-
- // Apply padding to the rectangle
- availableRect.X += borderPadding.Left;
- availableRect.Y += borderPadding.Top;
- availableRect.Width -= borderPadding.Horizontal;
- availableRect.Height -= borderPadding.Vertical;
-
- // If we need to apply in a vertical orientation
- if (vertical)
- {
- // This is the display rect we need to use in 'AdjustForOrientation'
- // and cache it for later. The displayRect itself is modified during
- // the below process and so cannot be used directly.
- int temp = cacheDisplayRect.Width;
- cacheDisplayRect.Width = cacheDisplayRect.Height;
- cacheDisplayRect.Height = temp;
- }
-
- // Track the allocated space in each grid position
- Size[,] allocation = new Size[3, 3] { { Size.Empty, Size.Empty, Size.Empty },
- { Size.Empty, Size.Empty, Size.Empty },
- { Size.Empty, Size.Empty, Size.Empty } };
-
- // Create a memento to return to caller
- StandardContentMemento memento = new StandardContentMemento();
-
- // Cache the size of a spacing gap
- int spacingGap = palette.GetContentAdjacentGap(state);
-
- // Drawing vertical means we can ignore right to left, otherwise get value from control
- RightToLeft rtl = (vertical ? RightToLeft.No : context.Control.RightToLeft);
-
- // Allocate space for each required content in turn
- AllocateImageSpace(memento, palette, values, state, availableRect, rtl, ref allocation);
- AllocateShortTextSpace(context, context.Graphics, memento, palette, values, state, availableRect, rtl, spacingGap, ref allocation, composition, glowing);
- AllocateLongTextSpace(context, context.Graphics, memento, palette, values, state, availableRect, rtl, spacingGap, ref allocation, composition, glowing);
-
- // Find the width of the columns and heights of the rows
- int[] colWidths = AllocatedColumnWidths(allocation, -1);
- int[] rowHeights = AllocatedRowHeights(allocation);
-
- // Add up total allocated for rows and columns
- int allocatedWidth = AllocatedTotalWidth(allocation, -1, -1, spacingGap);
- int allocatedHeight = AllocatedTotalHeight(allocation);
-
- // Excess width to allocate?
- if (allocatedWidth < availableRect.Width)
- {
- ApplyExcessSpace(availableRect.Width - allocatedWidth, ref colWidths);
- }
-
- // Excess height to allocate?
- if (allocatedHeight < availableRect.Height)
- {
- rowHeights[1] += (availableRect.Height - allocatedHeight);
- }
-
- // Find x positions and y positions
- int col0 = availableRect.Left;
- int col1 = col0 + colWidths[0];
-
- // Do we need to add a spacing gap after the first column?
- if (((colWidths[0] > 0) && (colWidths[1] > 0)) ||
- ((colWidths[0] > 0) && (colWidths[1] == 0) && (colWidths[2] > 0)))
- {
- col1 += spacingGap;
- }
-
- int col2 = col1 + colWidths[1];
-
- // Do we need to add a spacing gap after the second column?
- if ((colWidths[1] > 0) && (colWidths[2] > 0))
- {
- col2 += spacingGap;
- }
-
- int row0 = availableRect.Top;
- int row1 = row0 + rowHeights[0];
- int row2 = row1 + rowHeights[1];
-
- // Decide on the ordering of the alignment to position
- PaletteRelativeAlign aAlign = (rtl == RightToLeft.Yes ? PaletteRelativeAlign.Far : PaletteRelativeAlign.Near);
- const PaletteRelativeAlign B_ALIGN = PaletteRelativeAlign.Center;
- PaletteRelativeAlign cAlign = (rtl == RightToLeft.Yes ? PaletteRelativeAlign.Near : PaletteRelativeAlign.Far);
-
- // Size and position the contents of each aligned cell
- PositionAlignContent(memento, palette, state, rtl, aAlign, PaletteRelativeAlign.Near, col0, row0, colWidths[0], rowHeights[0], spacingGap);
- PositionAlignContent(memento, palette, state, rtl, aAlign, PaletteRelativeAlign.Center, col0, row1, colWidths[0], rowHeights[1], spacingGap);
- PositionAlignContent(memento, palette, state, rtl, aAlign, PaletteRelativeAlign.Far, col0, row2, colWidths[0], rowHeights[2], spacingGap);
- PositionAlignContent(memento, palette, state, rtl, B_ALIGN, PaletteRelativeAlign.Near, col1, row0, colWidths[1], rowHeights[0], spacingGap);
- PositionAlignContent(memento, palette, state, rtl, B_ALIGN, PaletteRelativeAlign.Center, col1, row1, colWidths[1], rowHeights[1], spacingGap);
- PositionAlignContent(memento, palette, state, rtl, B_ALIGN, PaletteRelativeAlign.Far, col1, row2, colWidths[1], rowHeights[2], spacingGap);
- PositionAlignContent(memento, palette, state, rtl, cAlign, PaletteRelativeAlign.Near, col2, row0, colWidths[2], rowHeights[0], spacingGap);
- PositionAlignContent(memento, palette, state, rtl, cAlign, PaletteRelativeAlign.Center, col2, row1, colWidths[2], rowHeights[1], spacingGap);
- PositionAlignContent(memento, palette, state, rtl, cAlign, PaletteRelativeAlign.Far, col2, row2, colWidths[2], rowHeights[2], spacingGap);
-
- // Ask the memento to adjust itself for the required orientation
- memento.AdjustForOrientation(orientation, cacheDisplayRect);
-
- return memento;
- }
-
- ///
- /// Perform draw of content using provided memento.
- ///
- /// Render context.
- /// Display area available for drawing.
- /// Content palette details.
- /// Cached values from layout call.
- /// Visual orientation of the content.
- /// State associated with rendering.
- /// Drawing onto a composition element.
- /// If composition should glowing be drawn.
- /// Allow drawing of focus rectangle.
- ///
- public override void DrawContent(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle displayRect,
- IPaletteContent palette,
- IDisposable memento,
- VisualOrientation orientation,
- PaletteState state,
- bool composition,
- bool glowing,
- bool allowFocusRect)
- {
- Debug.Assert(context != null);
- Debug.Assert(memento != null);
- Debug.Assert(memento is StandardContentMemento);
-
- // Validate parameter references
- if (context == null)
- {
- throw new ArgumentNullException(nameof(context));
- }
-
- if (palette == null)
- {
- throw new ArgumentNullException(nameof(palette));
- }
-
- Debug.Assert(context.Control != null);
- Debug.Assert(!context.Control.IsDisposed);
-
- // Cast the incoming memento to the correct type
- StandardContentMemento standard = (StandardContentMemento)memento;
-
- if (standard.DrawImage)
- {
- DrawImageHelper(context,
- standard.Image,
- standard.ImageTransparentColor,
- standard.ImageRect,
- orientation,
- palette.GetContentImageEffect(state),
- palette.GetContentImageColorMap(state),
- palette.GetContentImageColorTo(state));
- }
-
- if (standard.DrawShortText)
- {
- using (GraphicsTextHint hint = new GraphicsTextHint(context.Graphics, standard.ShortTextHint))
- {
- // Get the rectangle to use when dealing with gradients
- Rectangle gradientRect = context.GetAlignedRectangle(palette.GetContentShortTextColorAlign(state), standard.ShortTextRect);
-
- // Use standard helper routine to create appropriate color brush
- Color color1 = palette.GetContentShortTextColor1(state);
- PaletteColorStyle colorStyle = palette.GetContentShortTextColorStyle(state);
- using (Brush colorBrush = CreateColorBrush(gradientRect,
- color1,
- palette.GetContentShortTextColor2(state),
- colorStyle,
- palette.GetContentShortTextColorAngle(state),
- orientation))
- {
- if (!AccurateText.DrawString(context.Graphics,
- colorBrush,
- standard.ShortTextRect,
- context.Control.RightToLeft,
- standard.Orientation,
- composition,
- glowing,
- state,
- standard.ShortTextMemento))
- {
- // Failed to draw means the font is likely to be invalid, get a fresh font
- standard.ShortTextMemento.Font = palette.GetContentShortTextNewFont(state);
-
- // Try again using the new font
- AccurateText.DrawString(context.Graphics,
- colorBrush,
- standard.ShortTextRect,
- context.Control.RightToLeft,
- standard.Orientation,
- composition,
- glowing,
- state,
- standard.ShortTextMemento);
- }
- }
-
- Image shortImage = palette.GetContentShortTextImage(state);
- PaletteImageStyle shortImageStyle = palette.GetContentShortTextImageStyle(state);
-
- // Do we need to draw the image?
- if (ShouldDrawImage(shortImage))
- {
- // Get the rectangle to use when dealing with gradients
- Rectangle imageRect = context.GetAlignedRectangle(palette.GetContentShortTextImageAlign(state), standard.ShortTextRect);
-
- // Use standard helper routine to create appropriate image brush
- using (Brush imageBrush = CreateImageBrush(imageRect, shortImage, shortImageStyle))
- {
- if (!AccurateText.DrawString(context.Graphics,
- imageBrush,
- standard.ShortTextRect,
- context.Control.RightToLeft,
- standard.Orientation,
- composition,
- glowing,
- state,
- standard.ShortTextMemento))
- {
- // Failed to draw means the font is likely to be invalid, get a fresh font
- standard.ShortTextMemento.Font = palette.GetContentShortTextNewFont(state);
-
- AccurateText.DrawString(context.Graphics,
- imageBrush,
- standard.ShortTextRect,
- context.Control.RightToLeft,
- standard.Orientation,
- composition,
- glowing,
- state,
- standard.ShortTextMemento);
- }
- }
- }
- }
- }
-
- if (standard.DrawLongText)
- {
- using (GraphicsTextHint hint = new GraphicsTextHint(context.Graphics, standard.LongTextHint))
- {
- // Get the rectangle to use when dealing with gradients
- Rectangle gradientRect = context.GetAlignedRectangle(palette.GetContentLongTextColorAlign(state), standard.LongTextRect);
-
- // Use standard helper routine to create appropriate color brush
- Color color1 = palette.GetContentLongTextColor1(state);
- PaletteColorStyle colorStyle = palette.GetContentLongTextColorStyle(state);
- using (Brush colorBrush = CreateColorBrush(gradientRect,
- color1,
- palette.GetContentLongTextColor2(state),
- colorStyle,
- palette.GetContentLongTextColorAngle(state),
- orientation))
- {
- if (!AccurateText.DrawString(context.Graphics,
- colorBrush,
- standard.LongTextRect,
- context.Control.RightToLeft,
- standard.Orientation,
- composition,
- glowing,
- state,
- standard.LongTextMemento))
- {
- // Failed to draw means the font is likely to be invalid, get a fresh font
- standard.LongTextMemento.Font = palette.GetContentLongTextNewFont(state);
-
- AccurateText.DrawString(context.Graphics,
- colorBrush,
- standard.LongTextRect,
- context.Control.RightToLeft,
- standard.Orientation,
- composition,
- glowing,
- state,
- standard.LongTextMemento);
- }
- }
-
- Image longImage = palette.GetContentLongTextImage(state);
- PaletteImageStyle longImageStyle = palette.GetContentLongTextImageStyle(state);
-
- // Do we need to draw the image?
- if (ShouldDrawImage(longImage))
- {
- // Get the rectangle to use when dealing with gradients
- Rectangle imageRect = context.GetAlignedRectangle(palette.GetContentLongTextImageAlign(state), standard.LongTextRect);
-
- // Use standard helper routine to create appropriate image brush
- using (Brush imageBrush = CreateImageBrush(imageRect, longImage, longImageStyle))
- {
- if (!AccurateText.DrawString(context.Graphics,
- imageBrush,
- standard.LongTextRect,
- context.Control.RightToLeft,
- standard.Orientation,
- composition,
- glowing,
- state,
- standard.LongTextMemento))
- {
- // Failed to draw means the font is likely to be invalid, get a fresh font
- standard.LongTextMemento.Font = palette.GetContentLongTextNewFont(state);
-
- AccurateText.DrawString(context.Graphics,
- imageBrush,
- standard.LongTextRect,
- context.Control.RightToLeft,
- standard.Orientation,
- composition,
- glowing,
- state,
- standard.LongTextMemento);
- }
- }
- }
- }
- }
-
- // Do we need to show this content has the focus?
- if (allowFocusRect && (palette.GetContentDrawFocus(state) == InheritBool.True))
- {
- // Place the rectangle 1 pixel inside the content display area
- displayRect.Inflate(-1, -1);
-
- // Use window forms provided helper class for drawing
- ControlPaint.DrawFocusRectangle(context.Graphics, displayRect);
- }
- }
-
- ///
- /// Request the calculated display of the image.
- ///
- /// Cached values from layout call.
- /// True if the image is being displayed; otherwise false.
- public override bool GetContentImageDisplayed(IDisposable memento)
- {
- if (memento != null)
- {
- StandardContentMemento standard = (StandardContentMemento)memento;
- return standard.DrawImage;
- }
- else
- {
- return false;
- }
- }
-
- ///
- /// Request the calculated position of the content image.
- ///
- /// Cached values from layout call.
- /// Display rectangle for the image content.
- public override Rectangle GetContentImageRectangle(IDisposable memento)
- {
- if (memento != null)
- {
- StandardContentMemento standard = (StandardContentMemento)memento;
- return standard.ImageRect;
- }
- else
- {
- return Rectangle.Empty;
- }
- }
-
- ///
- /// Request the calculated display of the short text.
- ///
- /// Cached values from layout call.
- /// True if the short text is being displayed; otherwise false.
- public override bool GetContentShortTextDisplayed(IDisposable memento)
- {
- if (memento != null)
- {
- StandardContentMemento standard = (StandardContentMemento)memento;
- return standard.DrawShortText;
- }
- else
- {
- return false;
- }
- }
-
- ///
- /// Request the calculated position of the content short text.
- ///
- /// Cached values from layout call.
- /// Display rectangle for the image content.
- public override Rectangle GetContentShortTextRectangle(IDisposable memento)
- {
- if (memento != null)
- {
- StandardContentMemento standard = (StandardContentMemento)memento;
- return standard.ShortTextRect;
- }
- else
- {
- return Rectangle.Empty;
- }
- }
-
- ///
- /// Request the calculated display of the long text.
- ///
- /// Cached values from layout call.
- /// True if the long text is being displayed; otherwise false.
- public override bool GetContentLongTextDisplayed(IDisposable memento)
- {
- if (memento != null)
- {
- StandardContentMemento standard = (StandardContentMemento)memento;
- return standard.DrawLongText;
- }
- else
- {
- return false;
- }
- }
-
- ///
- /// Request the calculated position of the content long text.
- ///
- /// Cached values from layout call.
- /// Display rectangle for the image content.
- public override Rectangle GetContentLongTextRectangle(IDisposable memento)
- {
- if (memento != null)
- {
- StandardContentMemento standard = (StandardContentMemento)memento;
- return standard.LongTextRect;
- }
- else
- {
- return Rectangle.Empty;
- }
- }
- #endregion
-
- #region RenderTabBorder Overrides
- ///
- /// Gets if the tabs should be drawn from left to right for z-ordering.
- ///
- /// Style of tab border.
- /// True for left to right, otherwise draw right to left.
- public override bool GetTabBorderLeftDrawing(TabBorderStyle tabBorderStyle)
- {
- switch (tabBorderStyle)
- {
- case TabBorderStyle.OneNote:
- return false;
- default:
- return true;
- }
- }
-
- ///
- /// Gets the spacing used to separate each tab border instance.
- ///
- /// Style of tab border.
- /// Number of pixels to space instances.
- public override int GetTabBorderSpacingGap(TabBorderStyle tabBorderStyle)
- {
- switch (tabBorderStyle)
- {
- case TabBorderStyle.DockEqual:
- case TabBorderStyle.SquareEqualSmall:
- return SPACING_TAB_SQUARE_EQUAL_SMALL;
- case TabBorderStyle.SquareEqualMedium:
- return SPACING_TAB_SQUARE_EQUAL_MEDIUM;
- case TabBorderStyle.SquareEqualLarge:
- return SPACING_TAB_SQUARE_EQUAL_LARGE;
- case TabBorderStyle.DockOutsize:
- case TabBorderStyle.SquareOutsizeSmall:
- return SPACING_TAB_SQUARE_OUTSIZE_SMALL;
- case TabBorderStyle.SquareOutsizeMedium:
- return SPACING_TAB_SQUARE_OUTSIZE_MEDIUM;
- case TabBorderStyle.SquareOutsizeLarge:
- return SPACING_TAB_SQUARE_OUTSIZE_LARGE;
- case TabBorderStyle.RoundedEqualSmall:
- return SPACING_TAB_ROUNDED_EQUAL_SMALL;
- case TabBorderStyle.RoundedEqualMedium:
- return SPACING_TAB_ROUNDED_EQUAL_MEDIUM;
- case TabBorderStyle.RoundedEqualLarge:
- return SPACING_TAB_ROUNDED_EQUAL_LARGE;
- case TabBorderStyle.RoundedOutsizeSmall:
- return SPACING_TAB_ROUNDED_OUTSIZE_SMALL;
- case TabBorderStyle.RoundedOutsizeMedium:
- return SPACING_TAB_ROUNDED_OUTSIZE_MEDIUM;
- case TabBorderStyle.RoundedOutsizeLarge:
- return SPACING_TAB_ROUNDED_OUTSIZE_LARGE;
- case TabBorderStyle.SlantEqualNear:
- case TabBorderStyle.SlantEqualFar:
- return SPACING_TAB_SLANT_EQUAL;
- case TabBorderStyle.SlantOutsizeNear:
- case TabBorderStyle.SlantOutsizeFar:
- return SPACING_TAB_SLANT_OUTSIZE;
- case TabBorderStyle.SlantEqualBoth:
- return SPACING_TAB_SLANT_EQUAL_BOTH;
- case TabBorderStyle.SlantOutsizeBoth:
- return SPACING_TAB_SLANT_OUTSIZE * 2;
- case TabBorderStyle.OneNote:
- return SPACING_TAB_ONE_NOTE;
- case TabBorderStyle.SmoothEqual:
- return SPACING_TAB_SMOOTH_E;
- case TabBorderStyle.SmoothOutsize:
- return SPACING_TAB_SMOOTH_O;
- default:
- // Should never happen!
- Debug.Assert(false);
- return 1;
- }
- }
-
- ///
- /// Gets the padding used to position display elements completely inside border drawing.
- ///
- /// View layout context.
- /// Palette used for drawing.
- /// State associated with rendering.
- /// Visual orientation of the border.
- /// Style of tab border.
- ///
- /// Padding structure detailing all four edges.
- public override Padding GetTabBorderDisplayPadding(ViewLayoutContext context,
- IPaletteBorder palette,
- PaletteState state,
- VisualOrientation orientation,
- TabBorderStyle tabBorderStyle)
- {
- Debug.Assert(palette != null);
-
- // Validate parameter reference
- if (palette == null)
- {
- throw new ArgumentNullException(nameof(palette));
- }
-
- // Get the width of the border
- int borderWidth = palette.GetBorderWidth(state);
-
- // Cache the right to left setting
- bool rtl = (context.Control.RightToLeft == RightToLeft.Yes);
-
- Padding ret = Padding.Empty;
-
- switch (tabBorderStyle)
- {
- case TabBorderStyle.DockEqual:
- case TabBorderStyle.SquareEqualMedium:
- case TabBorderStyle.SquareEqualSmall:
- case TabBorderStyle.SquareEqualLarge:
- case TabBorderStyle.RoundedEqualMedium:
- case TabBorderStyle.RoundedEqualSmall:
- case TabBorderStyle.RoundedEqualLarge:
- ret = new Padding(borderWidth, borderWidth, borderWidth, 0);
- break;
- case TabBorderStyle.DockOutsize:
- ret = new Padding(borderWidth + SPACING_TAB_DOCK_OUTSIZE, borderWidth + SPACING_TAB_SQUARE_OUTSIZE_LARGE, borderWidth + SPACING_TAB_DOCK_OUTSIZE, 0);
- break;
- case TabBorderStyle.SquareOutsizeMedium:
- case TabBorderStyle.SquareOutsizeSmall:
- case TabBorderStyle.SquareOutsizeLarge:
- case TabBorderStyle.RoundedOutsizeMedium:
- case TabBorderStyle.RoundedOutsizeSmall:
- case TabBorderStyle.RoundedOutsizeLarge:
- ret = new Padding(borderWidth + SPACING_TAB_OUTSIZE_PADDING,
- borderWidth + SPACING_TAB_OUTSIZE_PADDING, borderWidth + SPACING_TAB_OUTSIZE_PADDING, 0);
- break;
- case TabBorderStyle.SlantEqualNear:
- case TabBorderStyle.SlantOutsizeNear:
- // Calculte the extra needed for the outsize variant
- int x = (tabBorderStyle == TabBorderStyle.SlantOutsizeNear ? SPACING_TAB_OUTSIZE_PADDING : 0);
-
- switch (orientation)
- {
- case VisualOrientation.Top:
- ret = rtl
- ? new Padding(borderWidth + x, borderWidth + x,
- (borderWidth + x + SPACING_TAB_SLANT_PADDING) - 1, 0)
- : new Padding((borderWidth + x + SPACING_TAB_SLANT_PADDING) - 1, borderWidth + x,
- borderWidth + x, 0);
-
- break;
- case VisualOrientation.Left:
- ret = new Padding((borderWidth + x + SPACING_TAB_SLANT_PADDING) - 1, borderWidth + x, borderWidth + x, 0);
- break;
- case VisualOrientation.Right:
- ret = new Padding(borderWidth + x, borderWidth + x, (borderWidth + x + SPACING_TAB_SLANT_PADDING) - 1, 0);
- break;
- case VisualOrientation.Bottom:
- ret = rtl
- ? new Padding((borderWidth + x + SPACING_TAB_SLANT_PADDING) - 1, borderWidth + x,
- borderWidth + x, 0)
- : new Padding(borderWidth + x, borderWidth + x,
- (borderWidth + x + SPACING_TAB_SLANT_PADDING) - 1, 0);
-
- break;
- }
- break;
- case TabBorderStyle.SlantEqualFar:
- case TabBorderStyle.SlantOutsizeFar:
- // Calculte the extra needed for the outsize variant
- int y = (tabBorderStyle == TabBorderStyle.SlantOutsizeFar ? SPACING_TAB_OUTSIZE_PADDING : 0);
-
- switch (orientation)
- {
- case VisualOrientation.Top:
- ret = rtl
- ? new Padding((borderWidth + y + SPACING_TAB_SLANT_PADDING) - 1, borderWidth + y,
- borderWidth + y, 0)
- : new Padding(borderWidth + y, borderWidth + y,
- (borderWidth + y + SPACING_TAB_SLANT_PADDING) - 1, 0);
-
- break;
- case VisualOrientation.Left:
- ret = new Padding(borderWidth + y, borderWidth + y, (borderWidth + y + SPACING_TAB_SLANT_PADDING) - 1, 0);
- break;
- case VisualOrientation.Right:
- ret = new Padding((borderWidth + y + SPACING_TAB_SLANT_PADDING) - 1, borderWidth + y, borderWidth + y, 0);
- break;
- case VisualOrientation.Bottom:
- ret = rtl
- ? new Padding(borderWidth + y, borderWidth + y,
- (borderWidth + y + SPACING_TAB_SLANT_PADDING) - 1, 0)
- : new Padding((borderWidth + y + SPACING_TAB_SLANT_PADDING) - 1, borderWidth + y,
- borderWidth + y, 0);
-
- break;
- }
- break;
- case TabBorderStyle.SlantEqualBoth:
- case TabBorderStyle.SlantOutsizeBoth:
- // Calculte the extra needed for the outsize variant
- int z = (tabBorderStyle == TabBorderStyle.SlantOutsizeBoth ? SPACING_TAB_OUTSIZE_PADDING : 0);
-
- ret = new Padding((borderWidth + z + SPACING_TAB_SLANT_PADDING) - 1, borderWidth + z,
- (borderWidth + z + SPACING_TAB_SLANT_PADDING) - 1, 0);
- break;
- case TabBorderStyle.OneNote:
- // Is the current tab selected?
- bool selected = (state == PaletteState.CheckedNormal) ||
- (state == PaletteState.CheckedPressed) ||
- (state == PaletteState.CheckedTracking);
-
- // Find the correct edge padding values to use
- int lp = (selected ? SPACING_TAB_ONE_NOTE_LPS : SPACING_TAB_ONE_NOTE_LPI);
- int tp = (selected ? SPACING_TAB_ONE_NOTE_TPS : SPACING_TAB_ONE_NOTE_TPI);
- int bp = (selected ? SPACING_TAB_ONE_NOTE_BPS : SPACING_TAB_ONE_NOTE_BPI);
- int rp = (selected ? SPACING_TAB_ONE_NOTE_RPS : SPACING_TAB_ONE_NOTE_RPI);
-
- switch (orientation)
- {
- case VisualOrientation.Top:
- ret = rtl
- ? new Padding(borderWidth + rp, borderWidth + tp, borderWidth + lp, bp)
- : new Padding(borderWidth + lp, borderWidth + tp, borderWidth + rp, bp);
-
- break;
- case VisualOrientation.Left:
- ret = new Padding(borderWidth + rp, borderWidth + tp, borderWidth + lp, bp);
- break;
- case VisualOrientation.Right:
- ret = new Padding(borderWidth + lp, borderWidth + tp, borderWidth + rp, bp);
- break;
- case VisualOrientation.Bottom:
- ret = rtl
- ? new Padding(borderWidth + lp, borderWidth + tp, borderWidth + rp, bp)
- : new Padding(borderWidth + rp, borderWidth + tp, borderWidth + lp, bp);
-
- break;
- }
- break;
- case TabBorderStyle.SmoothEqual:
- ret = new Padding(borderWidth + SPACING_TAB_SMOOTH_LRE, borderWidth + SPACING_TAB_SMOOTH_TE, borderWidth + SPACING_TAB_SMOOTH_LRE, 0);
- break;
- case TabBorderStyle.SmoothOutsize:
- ret = new Padding(borderWidth + SPACING_TAB_SMOOTH_LRO, borderWidth + SPACING_TAB_SMOOTH_TO, borderWidth + SPACING_TAB_SMOOTH_LRO, 0);
- break;
- default:
- // Should never happen!
- Debug.Assert(false);
- break;
- }
-
- return ret;
- }
-
- ///
- /// Generate a graphics path that encloses the border itself.
- ///
- /// Rendering context.
- /// Target rectangle.
- /// Palette used for drawing.
- /// Visual orientation of the border.
- /// State associated with rendering.
- /// Style of tab border.
- ///
- /// GraphicsPath instance.
- public override GraphicsPath GetTabBorderPath(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- IPaletteBorder palette,
- VisualOrientation orientation,
- PaletteState state,
- TabBorderStyle tabBorderStyle)
- {
- Debug.Assert(context != null);
- Debug.Assert(palette != null);
-
- // Validate parameter references
- if (context == null)
- {
- throw new ArgumentNullException(nameof(context));
- }
-
- if (palette == null)
- {
- throw new ArgumentNullException(nameof(palette));
- }
-
- Debug.Assert(context.Control != null);
- Debug.Assert(!context.Control.IsDisposed);
-
- // Use helper to create a border path in middle of the pen
- return CreateTabBorderBackPath(context.Control.RightToLeft, state, false, rect,
- palette.GetBorderWidth(state), tabBorderStyle, orientation,
- (palette.GetBorderGraphicsHint(state) == PaletteGraphicsHint.AntiAlias));
- }
-
- ///
- /// Generate a graphics path that encloses the border and is used when rendering a background to ensure the background does not draw over the border area.
- ///
- /// Rendering context.
- /// Target rectangle.
- /// Palette used for drawing.
- /// Visual orientation of the border.
- /// State associated with rendering.
- /// Style of tab border.
- ///
- /// GraphicsPath instance.
- public override GraphicsPath GetTabBackPath(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- IPaletteBorder palette,
- VisualOrientation orientation,
- PaletteState state,
- TabBorderStyle tabBorderStyle)
- {
- Debug.Assert(context != null);
- Debug.Assert(palette != null);
-
- // Validate parameter references
- if (context == null)
- {
- throw new ArgumentNullException(nameof(context));
- }
-
- if (palette == null)
- {
- throw new ArgumentNullException(nameof(palette));
- }
-
- Debug.Assert(context.Control != null);
- Debug.Assert(!context.Control.IsDisposed);
-
- // Use helper to create a border path in middle of the pen
- return CreateTabBorderBackPath(context.Control.RightToLeft, state, false, rect,
- palette.GetBorderWidth(state), tabBorderStyle, orientation,
- (palette.GetBorderGraphicsHint(state) == PaletteGraphicsHint.AntiAlias));
- }
-
- ///
- /// Draw border on the inside edge of the specified rectangle.
- ///
- /// Rendering context.
- /// Target rectangle.
- /// Palette used for drawing.
- /// Visual orientation of the border.
- /// State associated with rendering.
- /// Style of tab border.
- ///
- public override void DrawTabBorder(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- IPaletteBorder palette,
- VisualOrientation orientation,
- PaletteState state,
- TabBorderStyle tabBorderStyle)
- {
- Debug.Assert(context != null);
- Debug.Assert(palette != null);
-
- // Validate parameter references
- if (context == null)
- {
- throw new ArgumentNullException(nameof(context));
- }
-
- if (palette == null)
- {
- throw new ArgumentNullException(nameof(palette));
- }
-
- Debug.Assert(context.Control != null);
- Debug.Assert(!context.Control.IsDisposed);
-
- // Is there anything to actually draw?
- if ((rect.Width > 0) && (rect.Height > 0))
- {
- // Decide if we need to use anti aliasing for a smoother looking visual
- using (GraphicsHint hint = new GraphicsHint(context.Graphics, palette.GetBorderGraphicsHint(state)))
- {
- // Cache commonly used values
- int borderWidth = palette.GetBorderWidth(state);
-
- // Is there any border to actually draw?
- if (borderWidth > 0)
- {
- // Create the path that represents the entire tab border
- using (GraphicsPath borderPath = CreateTabBorderBackPath(context.Control.RightToLeft, state, true, rect,
- borderWidth, tabBorderStyle, orientation,
- (palette.GetBorderGraphicsHint(state) == PaletteGraphicsHint.AntiAlias)))
- {
- // Get the rectangle to use when dealing with gradients
- Rectangle gradientRect = context.GetAlignedRectangle(palette.GetBorderColorAlign(state), rect);
-
- // Use standard helper routine to create appropriate color brush
- using (Brush borderBrush = CreateColorBrush(gradientRect,
- palette.GetBorderColor1(state),
- palette.GetBorderColor2(state),
- palette.GetBorderColorStyle(state),
- palette.GetBorderColorAngle(state),
- orientation))
- {
- using (Pen borderPen = new Pen(borderBrush, borderWidth))
- {
- context.Graphics.DrawPath(borderPen, borderPath);
- }
- }
-
- Image borderImage = palette.GetBorderImage(state);
-
- // Do we need to draw the image?
- if (ShouldDrawImage(borderImage))
- {
- // Get the rectangle to use when dealing with gradients
- Rectangle imageRect = context.GetAlignedRectangle(palette.GetBorderImageAlign(state), rect);
-
- // Get the image style to use for the image brush
- PaletteImageStyle borderImageStyle = palette.GetBorderImageStyle(state);
-
- // Use standard helper routine to create appropriate image brush
- using (Pen borderPen = new Pen(CreateImageBrush(imageRect, borderImage, borderImageStyle), borderWidth))
- {
- context.Graphics.DrawPath(borderPen, borderPath);
- }
- }
- }
- }
- }
- }
- }
- #endregion
-
- #region RenderRibbon Overrides
- ///
- /// Draw the background of a ribbon element.
- ///
- /// Ribbon shape.
- /// Rendering context.
- /// Target rectangle.
- /// State associated with rendering.
- /// Palette used for sourcing settings.
- /// Orientation for drawing.
- /// Drawing onto a composition element.
- /// Cached values to use when drawing.
- public override IDisposable DrawRibbonBack(PaletteRibbonShape shape,
- ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- PaletteState state,
- IPaletteRibbonBack palette,
- VisualOrientation orientation,
- bool composition,
- IDisposable memento)
- {
- // Note is the incoming state is detailed we are drawing inside a popip
- bool showingInPopup = ((state & PaletteState.FocusOverride) == PaletteState.FocusOverride);
- if (showingInPopup)
- {
- state = state & ~PaletteState.FocusOverride;
- }
-
- switch (palette.GetRibbonBackColorStyle(state))
- {
- case PaletteRibbonColorStyle.Empty:
- // Do nothing
- break;
- case PaletteRibbonColorStyle.Solid:
- using (SolidBrush backBrush = new SolidBrush(palette.GetRibbonBackColor1(state)))
- {
- context.Graphics.FillRectangle(backBrush, rect);
- }
-
- break;
- case PaletteRibbonColorStyle.Linear:
- return DrawRibbonLinear(context, rect, state, palette, memento);
- case PaletteRibbonColorStyle.LinearBorder:
- return DrawRibbonLinearBorder(context, rect, state, palette, memento);
- case PaletteRibbonColorStyle.RibbonAppMenuInner:
- return DrawRibbonAppMenuInner(context, rect, state, palette, memento);
- case PaletteRibbonColorStyle.RibbonAppMenuOuter:
- return DrawRibbonAppMenuOuter(context, rect, state, palette, memento);
- case PaletteRibbonColorStyle.RibbonQATFullbarRound:
- return DrawRibbonQATFullbarRound(context, rect, state, palette, memento);
- case PaletteRibbonColorStyle.RibbonQATFullbarSquare:
- return DrawRibbonQATFullbarSquare(context, rect, state, palette, memento);
- case PaletteRibbonColorStyle.RibbonQATMinibarSingle:
- return DrawRibbonQATMinibarSingle(context, rect, state, palette, composition, memento);
- case PaletteRibbonColorStyle.RibbonQATMinibarDouble:
- return DrawRibbonQATMinibarDouble(context, rect, state, palette, composition, memento);
- case PaletteRibbonColorStyle.RibbonQATOverflow:
- return DrawRibbonQATOverflow(shape, context, rect, state, palette, memento);
- case PaletteRibbonColorStyle.RibbonGroupGradientOne:
- return DrawRibbonGroupGradientOne(context, rect, state, palette, memento);
- case PaletteRibbonColorStyle.RibbonGroupGradientTwo:
- return DrawRibbonGroupGradientTwo(context, rect, state, palette, GROUP_GRADIENT_TWO, memento);
- case PaletteRibbonColorStyle.RibbonGroupCollapsedBorder:
- return DrawRibbonGroupCollapsedBorder(context, rect, state, palette, memento);
- case PaletteRibbonColorStyle.RibbonGroupCollapsedFrameBorder:
- return DrawRibbonGroupCollapsedFrameBorder(context, rect, state, palette, memento);
- case PaletteRibbonColorStyle.RibbonGroupCollapsedFrameBack:
- return DrawRibbonGroupGradientTwo(context, rect, state, palette, GROUP_GRADIENT_FRAME, memento);
- case PaletteRibbonColorStyle.RibbonGroupNormalBorder:
- return DrawRibbonGroupNormalBorder(context, rect, state, palette, false, false, memento);
- case PaletteRibbonColorStyle.RibbonGroupNormalBorderSep:
- return DrawRibbonGroupNormalBorderSep(showingInPopup, context, rect, state, palette, memento, false, false, false);
- case PaletteRibbonColorStyle.RibbonGroupNormalBorderSepPressedLight:
- return DrawRibbonGroupNormalBorderSep(showingInPopup, context, rect, state, palette, memento, true, false, false);
- case PaletteRibbonColorStyle.RibbonGroupNormalBorderSepPressedDark:
- return DrawRibbonGroupNormalBorderSep(showingInPopup, context, rect, state, palette, memento, true, false, true);
- case PaletteRibbonColorStyle.RibbonGroupNormalBorderSepTrackingLight:
- return DrawRibbonGroupNormalBorderSep(showingInPopup, context, rect, state, palette, memento, false, true, false);
- case PaletteRibbonColorStyle.RibbonGroupNormalBorderSepTrackingDark:
- return DrawRibbonGroupNormalBorderSep(showingInPopup, context, rect, state, palette, memento, false, true, true);
- case PaletteRibbonColorStyle.RibbonGroupNormalBorderTracking:
- return DrawRibbonGroupNormalBorder(context, rect, state, palette, true, false, memento);
- case PaletteRibbonColorStyle.RibbonGroupNormalBorderTrackingLight:
- return DrawRibbonGroupNormalBorder(context, rect, state, palette, true, true, memento);
- case PaletteRibbonColorStyle.RibbonGroupNormalTitle:
- return DrawRibbonGroupNormalTitle(context, rect, state, palette, memento);
- case PaletteRibbonColorStyle.RibbonGroupAreaBorder:
- return DrawRibbonGroupAreaBorder1And2(context, rect, state, palette, false, false, memento);
- case PaletteRibbonColorStyle.RibbonGroupAreaBorder2:
- return DrawRibbonGroupAreaBorder1And2(context, rect, state, palette, true, false, memento);
- case PaletteRibbonColorStyle.RibbonGroupAreaBorder3:
- return DrawRibbonGroupAreaBorder3And4(context, rect, state, palette, memento, true);
- case PaletteRibbonColorStyle.RibbonGroupAreaBorder4:
- return DrawRibbonGroupAreaBorder3And4(context, rect, state, palette, memento, false);
- case PaletteRibbonColorStyle.RibbonGroupAreaBorderContext:
- return DrawRibbonGroupAreaBorderContext(context, rect, state, palette, memento);
- case PaletteRibbonColorStyle.RibbonTabTracking2007:
- return DrawRibbonTabTracking2007(shape, context, rect, state, palette, orientation, memento);
- case PaletteRibbonColorStyle.RibbonTabFocus2010:
- return DrawRibbonTabFocus2010(shape, context, rect, state, palette, orientation, memento);
- case PaletteRibbonColorStyle.RibbonTabTracking2010:
- return DrawRibbonTabTracking2010(shape, context, rect, state, palette, orientation, memento, true);
- case PaletteRibbonColorStyle.RibbonTabTracking2010Alt:
- return DrawRibbonTabTracking2010(shape, context, rect, state, palette, orientation, memento, false);
- case PaletteRibbonColorStyle.RibbonTabGlowing:
- return DrawRibbonTabGlowing(shape, context, rect, state, palette, orientation, memento);
- case PaletteRibbonColorStyle.RibbonTabHighlight:
- return DrawRibbonTabHighlight(shape, context, rect, state, palette, orientation, memento, false);
- case PaletteRibbonColorStyle.RibbonTabHighlight2:
- return DrawRibbonTabHighlight(shape, context, rect, state, palette, orientation, memento, true);
- case PaletteRibbonColorStyle.RibbonTabSelected2007:
- return DrawRibbonTabSelected2007(context, rect, state, palette, orientation, memento);
- case PaletteRibbonColorStyle.RibbonTabSelected2010:
- return DrawRibbonTabSelected2010(context, rect, state, palette, orientation, memento, true);
- case PaletteRibbonColorStyle.RibbonTabSelected2010Alt:
- return DrawRibbonTabSelected2010(context, rect, state, palette, orientation, memento, false);
- case PaletteRibbonColorStyle.RibbonTabContextSelected:
- return DrawRibbonTabContextSelected(shape, context, rect, state, palette, orientation, memento);
- default:
- // Should never happen!
- Debug.Assert(false);
- break;
- }
-
- return null;
- }
-
- ///
- /// Draw a context ribbon tab title.
- ///
- /// Ribbon shape.
- /// Rendering context.
- /// Target rectangle.
- /// Palette used for general ribbon settings.
- /// Palette used for background ribbon settings.
- /// Cached storage for drawing objects.
- public override IDisposable DrawRibbonTabContextTitle(PaletteRibbonShape shape,
- ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- IPaletteRibbonGeneral paletteGeneral,
- IPaletteRibbonBack paletteBack,
- IDisposable memento)
- {
- return DrawRibbonTabContext(context, rect, paletteGeneral, paletteBack, memento);
- }
-
- ///
- /// Draw the application button.
- ///
- /// Ribbon shape.
- /// Rendering context.
- /// Target rectangle.
- /// State associated with rendering.
- /// Palette used for sourcing settings.
- /// Cached storage for drawing objects.
- public override IDisposable DrawRibbonApplicationButton(PaletteRibbonShape shape,
- ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- PaletteState state,
- IPaletteRibbonBack palette,
- IDisposable memento)
- {
- return DrawRibbonAppButton(shape, context, rect, state, palette, false, memento);
- }
-
- ///
- /// Draw the application tab.
- ///
- /// Ribbon shape.
- /// Rendering context.
- /// Target rectangle.
- /// State associated with rendering.
- /// Base color1 used for drawing the ribbon tab.
- /// Base color2 used for drawing the ribbon tab.
- /// Cached values to use when drawing.
- public override IDisposable DrawRibbonApplicationTab(PaletteRibbonShape shape,
- ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- PaletteState state,
- Color baseColor1,
- Color baseColor2,
- IDisposable memento)
- {
- return DrawRibbonAppTab(shape, context, rect, state, baseColor1, baseColor2, memento);
- }
-
- ///
- /// Perform drawing of a ribbon cluster edge.
- ///
- /// Ribbon shape.
- /// Render context.
- /// Display area available for drawing.
- /// Palette used for recovering drawing details.
- /// State associated with rendering.
- public override void DrawRibbonClusterEdge(PaletteRibbonShape shape,
- ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle displayRect,
- IPaletteBack paletteBack,
- PaletteState state)
- {
- Debug.Assert(context != null);
- Debug.Assert(paletteBack != null);
-
- // Draw inside of the border edge in a lighter version of the border
- using (SolidBrush drawBrush = new SolidBrush(paletteBack.GetBackColor1(state)))
- {
- context.Graphics.FillRectangle(drawBrush, displayRect);
- }
- }
- #endregion
-
- #region RenderGlyph Overrides
-
- ///
- /// Perform drawing of a separator glyph.
- ///
- /// Render context.
- /// Display area available for drawing.
- /// Background palette details.
- /// Border palette details.
- /// Visual orientation of the content.
- /// State associated with rendering.
- /// Can the separator be moved.
- ///
- public override void DrawSeparator(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle displayRect,
- IPaletteBack paletteBack,
- IPaletteBorder paletteBorder,
- Orientation orientation,
- PaletteState state,
- bool canMove)
- {
- Debug.Assert(context != null);
- Debug.Assert(paletteBack != null);
- Debug.Assert(paletteBorder != null);
-
- // Validate parameter references
- if (context == null)
- {
- throw new ArgumentNullException(nameof(context));
- }
-
- if (paletteBack == null)
- {
- throw new ArgumentNullException(nameof(paletteBack));
- }
-
- if (paletteBorder == null)
- {
- throw new ArgumentNullException(nameof(paletteBorder));
- }
-
- Debug.Assert(context.Control != null);
- Debug.Assert(!context.Control.IsDisposed);
-
- // Do we need to draw the background?
- if (paletteBack.GetBackDraw(state) == InheritBool.True)
- {
- // Convert from separator orientation to border orientation value
- VisualOrientation borderOrientation = (orientation == Orientation.Horizontal ? VisualOrientation.Top :
- VisualOrientation.Left);
-
- // Ask the border renderer for a path that encloses the border
- using (GraphicsPath borderPath = context.Renderer.RenderStandardBorder.GetBackPath(context, displayRect, paletteBorder, borderOrientation, state))
- {
- // Get the padding needed for the drawing area inside the border
- Padding borderPadding = context.Renderer.RenderStandardBorder.GetBorderRawPadding(paletteBorder, state, borderOrientation);
-
- // The area available for border drawing if the client rectangle with padding applied
- Rectangle enclosingRect = CommonHelper.ApplyPadding(borderOrientation, displayRect, borderPadding);
-
- // Convert from the two state orientation to our four state orientation
- VisualOrientation vo = (orientation == Orientation.Horizontal) ? VisualOrientation.Top : VisualOrientation.Left;
-
- // Render the background inside the border path
- context.Renderer.RenderStandardBack.DrawBack(context, enclosingRect, borderPath, paletteBack, vo, state, null);
- }
- }
-
- // Do we need to draw the border?
- if (paletteBorder.GetBorderDraw(state) == InheritBool.True)
- {
- // Convert from the two state orientation to our four state orientation
- VisualOrientation vo = (orientation == Orientation.Horizontal) ? VisualOrientation.Top : VisualOrientation.Left;
-
- // Render the border over the background and children
- context.Renderer.RenderStandardBorder.DrawBorder(context, displayRect, paletteBorder, vo, state);
- }
- }
-
- ///
- /// Calculate the requested display size for the check box.
- ///
- /// Render context.
- /// Palette for sourcing display values.
- /// Should check box be displayed as enabled.
- /// The checked state of the check box.
- /// Should check box be displayed as hot tracking.
- /// Should check box be displayed as pressed.
- ///
- public override Size GetCheckBoxPreferredSize(ViewLayoutContext context,
- IPalette palette,
- bool enabled,
- CheckState checkState,
- bool tracking,
- bool pressed)
- {
- Debug.Assert(context != null);
- Debug.Assert(palette != null);
-
- // Validate parameter references
- if (context == null)
- {
- throw new ArgumentNullException(nameof(context));
- }
-
- if (palette == null)
- {
- throw new ArgumentNullException(nameof(palette));
- }
-
- // Grab an image appropriate to the state
- Image drawImage = palette.GetCheckBoxImage(enabled, checkState, tracking, pressed);
-
- // If no image from the palette then get a system check box
- if (drawImage == null)
- {
- // Convert incoming parameters to check box state
- CheckBoxState state = DiscoverCheckBoxState(enabled, checkState, tracking, pressed);
-
- // Request the drawing size of the check box glyph
- return CheckBoxRenderer.GetGlyphSize(context.Graphics, state);
- }
- else
- {
- return drawImage.Size;
- }
- }
-
- ///
- /// Perform drawing of a check box.
- ///
- /// Render context.
- /// Display area available for drawing.
- /// Palette for sourcing display values.
- /// Should check box be displayed as enabled.
- /// The checked state of the check box.
- /// Should check box be displayed as hot tracking.
- /// Should check box be displayed as pressed.
- ///
- public override void DrawCheckBox(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle displayRect,
- IPalette palette,
- bool enabled,
- CheckState checkState,
- bool tracking,
- bool pressed)
- {
- Debug.Assert(context != null);
- Debug.Assert(palette != null);
-
- // Validate parameter references
- if (context == null)
- {
- throw new ArgumentNullException(nameof(context));
- }
-
- if (palette == null)
- {
- throw new ArgumentNullException(nameof(palette));
- }
-
- // Grab an image appropriate to the state
- Image drawImage = palette.GetCheckBoxImage(enabled, checkState, tracking, pressed);
-
- // If no image from the palette then get a system check box
- if (drawImage == null)
- {
- // Convert incoming parameters to check box state
- CheckBoxState state = DiscoverCheckBoxState(enabled, checkState, tracking, pressed);
-
- // Request the glyph be drawn at the top left of the display rectangle
- CheckBoxRenderer.DrawCheckBox(context.Graphics, displayRect.Location, state);
- }
- else
- {
- // Find the offset to center the image
- int xOffset = (displayRect.Width - drawImage.Width) / 2;
- int yOffset = (displayRect.Height - drawImage.Height) / 2;
-
- // Draw the image centered
- context.Graphics.DrawImage(drawImage,
- displayRect.X + xOffset, displayRect.Y + yOffset,
- drawImage.Width, drawImage.Height);
- }
- }
-
- ///
- /// Calculate the requested display size for the radio button.
- ///
- /// Render context.
- /// Palette for sourcing display values.
- /// Should check box be displayed as enabled.
- /// Checked state of the radio button.
- /// Should check box be displayed as hot tracking.
- /// Should check box be displayed as pressed.
- public override Size GetRadioButtonPreferredSize(ViewLayoutContext context,
- IPalette palette,
- bool enabled,
- bool checkState,
- bool tracking,
- bool pressed)
- {
- // Grab an image appropriate to the state
- Image drawImage = palette.GetRadioButtonImage(enabled, checkState, tracking, pressed);
-
- if (drawImage == null)
- {
- // Convert incoming parameters to radio button state
- RadioButtonState state = DiscoverRadioButtonState(enabled, checkState, tracking, pressed);
-
- // Request the drawing size of the radio button glyph
- return RadioButtonRenderer.GetGlyphSize(context.Graphics, state);
- }
- else
- {
- return drawImage.Size;
- }
- }
-
- ///
- /// Perform drawing of a radio button.
- ///
- /// Render context.
- /// Display area available for drawing.
- /// Palette for sourcing display values.
- /// Should radio button be displayed as enabled.
- /// Checked state of the radio button.
- /// Should radio button be displayed as hot tracking.
- /// Should radio button be displayed as pressed.
- ///
- public override void DrawRadioButton(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle displayRect,
- IPalette palette,
- bool enabled,
- bool checkState,
- bool tracking,
- bool pressed)
- {
- Debug.Assert(context != null);
- Debug.Assert(palette != null);
-
- // Validate parameter references
- if (context == null)
- {
- throw new ArgumentNullException(nameof(context));
- }
-
- if (palette == null)
- {
- throw new ArgumentNullException(nameof(palette));
- }
-
- // Grab an image appropriate to the state
- Image drawImage = palette.GetRadioButtonImage(enabled, checkState, tracking, pressed);
-
- // If no image from the palette then get a system radio button
- if (drawImage == null)
- {
- // Convert incoming parameters to radio button state
- RadioButtonState state = DiscoverRadioButtonState(enabled, checkState, tracking, pressed);
-
- // Request the glyph be drawn at the top left of the display rectangle
- RadioButtonRenderer.DrawRadioButton(context.Graphics, displayRect.Location, state);
- }
- else
- {
- // Find the offset to center the image
- int xOffset = (displayRect.Width - drawImage.Width) / 2;
- int yOffset = (displayRect.Height - drawImage.Height) / 2;
-
- // Draw the image centered
- context.Graphics.DrawImage(drawImage,
- displayRect.X + xOffset, displayRect.Y + yOffset,
- drawImage.Width, drawImage.Height);
- }
- }
-
- ///
- /// Calculate the requested display size for the drop down button.
- ///
- /// Render context.
- /// Palette for sourcing display values.
- /// State for which image size is needed.
- /// How to orientate the image.
- public override Size GetDropDownButtonPreferredSize(ViewLayoutContext context,
- IPalette palette,
- PaletteState state,
- VisualOrientation orientation)
- {
- // Grab an image appropriate to the state
- Image drawImage = palette.GetDropDownButtonImage(state);
-
- // Get the image defined size
- Size imageSize = Size.Empty;
- if (drawImage != null)
- {
- imageSize = drawImage.Size;
- }
-
- // Alter size for different orientations
- if ((orientation == VisualOrientation.Left) ||
- (orientation == VisualOrientation.Right))
- {
- // Switch dimensions to reflect rotation of 90 or 270 degrees
- imageSize = new Size(imageSize.Height, imageSize.Width);
- }
-
- return imageSize;
- }
-
- ///
- /// Perform drawing of a drop down button.
- ///
- /// Render context.
- /// Display area available for drawing.
- /// Palette for sourcing display values.
- /// State for which image size is needed.
- /// How to orientate the image.
- ///
- public override void DrawDropDownButton(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle displayRect,
- IPalette palette,
- PaletteState state,
- VisualOrientation orientation)
- {
- Debug.Assert(context != null);
- Debug.Assert(palette != null);
-
- // Validate parameter references
- if (context == null)
- {
- throw new ArgumentNullException(nameof(context));
- }
-
- if (palette == null)
- {
- throw new ArgumentNullException(nameof(palette));
- }
-
- // Grab an image appropriate to the state
- Image drawImage = palette.GetDropDownButtonImage(state);
- if (drawImage != null)
- {
- DrawImageHelper(context, drawImage, Color.Empty,
- displayRect, orientation, PaletteImageEffect.Normal,
- Color.Empty, Color.Empty);
- }
- }
-
- ///
- /// Draw a numeric up button image appropriate for a input control.
- ///
- /// Render context.
- /// Available drawing rectangle space.
- /// Content palette for getting colors.
- /// State associated with rendering.
- ///
- public override void DrawInputControlNumericUpGlyph(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle cellRect,
- IPaletteContent paletteContent,
- PaletteState state)
- {
- Debug.Assert(context != null);
- Debug.Assert(paletteContent != null);
-
- // Validate parameter references
- if (context == null)
- {
- throw new ArgumentNullException(nameof(context));
- }
-
- if (paletteContent == null)
- {
- throw new ArgumentNullException(nameof(paletteContent));
- }
-
- Color c1 = paletteContent.GetContentShortTextColor1(state);
- Color c2 = paletteContent.GetContentShortTextColor2(state);
-
- // Find the top left starting position for drawing lines
- int xStart = cellRect.Left + ((cellRect.Right - cellRect.Left - 4) / 2);
- int yStart = cellRect.Top + ((cellRect.Bottom - cellRect.Top - 3) / 2);
-
- using (Pen darkPen = new Pen(c1),
- lightPen = new Pen(c2))
- {
- context.Graphics.DrawLine(darkPen, xStart, yStart + 3, xStart + 4, yStart + 3);
- context.Graphics.DrawLine(darkPen, xStart + 1, yStart + 2, xStart + 3, yStart + 2);
- context.Graphics.DrawLine(darkPen, xStart + 2, yStart + 2, xStart + 2, yStart + 1);
- context.Graphics.DrawLine(lightPen, xStart + 2, yStart, xStart + 4, yStart + 2);
- context.Graphics.DrawLine(lightPen, xStart + 2, yStart, xStart, yStart + 2);
- }
- }
-
- ///
- /// Draw a numeric down button image appropriate for a input control.
- ///
- /// Render context.
- /// Available drawing rectangle space.
- /// Content palette for getting colors.
- /// State associated with rendering.
- ///
- public override void DrawInputControlNumericDownGlyph(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle cellRect,
- IPaletteContent paletteContent,
- PaletteState state)
- {
- Debug.Assert(context != null);
- Debug.Assert(paletteContent != null);
-
- // Validate parameter references
- if (context == null)
- {
- throw new ArgumentNullException(nameof(context));
- }
-
- if (paletteContent == null)
- {
- throw new ArgumentNullException(nameof(paletteContent));
- }
-
- Color c1 = paletteContent.GetContentShortTextColor1(state);
- Color c2 = paletteContent.GetContentShortTextColor2(state);
-
- // Find the top left starting position for drawing lines
- int xStart = cellRect.Left + ((cellRect.Right - cellRect.Left - 4) / 2);
- int yStart = cellRect.Top + ((cellRect.Bottom - cellRect.Top - 3) / 2);
-
- using (Pen darkPen = new Pen(c1),
- lightPen = new Pen(c2))
- {
- context.Graphics.DrawLine(darkPen, xStart, yStart, xStart + 4, yStart);
- context.Graphics.DrawLine(darkPen, xStart + 1, yStart + 1, xStart + 3, yStart + 1);
- context.Graphics.DrawLine(darkPen, xStart + 2, yStart + 2, xStart + 2, yStart + 1);
- context.Graphics.DrawLine(lightPen, xStart, yStart + 1, xStart + 2, yStart + 3);
- context.Graphics.DrawLine(lightPen, xStart + 2, yStart + 3, xStart + 4, yStart + 1);
- }
- }
-
- ///
- /// Draw a drop down grid appropriate for a input control.
- ///
- /// Render context.
- /// Available drawing rectangle space.
- /// Content palette for getting colors.
- /// State associated with rendering.
- ///
- public override void DrawInputControlDropDownGlyph(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle cellRect,
- IPaletteContent paletteContent,
- PaletteState state)
- {
- Debug.Assert(context != null);
- Debug.Assert(paletteContent != null);
-
- // Validate parameter references
- if (context == null)
- {
- throw new ArgumentNullException(nameof(context));
- }
-
- if (paletteContent == null)
- {
- throw new ArgumentNullException(nameof(paletteContent));
- }
-
- Color c1 = paletteContent.GetContentShortTextColor1(state);
- Color c2 = paletteContent.GetContentShortTextColor2(state);
-
- // Find the top left starting position for drawing lines
- int xStart = cellRect.Left + ((cellRect.Right - cellRect.Left - 4) / 2);
- int yStart = cellRect.Top + ((cellRect.Bottom - cellRect.Top - 3) / 2);
-
- using (Pen darkPen = new Pen(c1),
- lightPen = new Pen(c2))
- {
- context.Graphics.DrawLine(darkPen, xStart, yStart, xStart + 4, yStart);
- context.Graphics.DrawLine(darkPen, xStart + 1, yStart + 1, xStart + 3, yStart + 1);
- context.Graphics.DrawLine(darkPen, xStart + 2, yStart + 2, xStart + 2, yStart + 1);
- context.Graphics.DrawLine(lightPen, xStart, yStart + 1, xStart + 2, yStart + 3);
- context.Graphics.DrawLine(lightPen, xStart + 2, yStart + 3, xStart + 4, yStart + 1);
- }
- }
-
- ///
- /// Perform drawing of a ribbon dialog box launcher glyph.
- ///
- /// Ribbon shape.
- /// Render context.
- /// Display area available for drawing.
- /// General ribbon palette details.
- /// State associated with rendering.
- ///
- public override void DrawRibbonDialogBoxLauncher(PaletteRibbonShape shape,
- RenderContext context,
- Rectangle displayRect,
- IPaletteRibbonGeneral paletteGeneral,
- PaletteState state)
- {
- Debug.Assert(context != null);
- Debug.Assert(paletteGeneral != null);
-
- // Validate parameter references
- if (context == null)
- {
- throw new ArgumentNullException(nameof(context));
- }
-
- if (paletteGeneral == null)
- {
- throw new ArgumentNullException(nameof(paletteGeneral));
- }
-
- switch (shape)
- {
- default:
- case PaletteRibbonShape.Office2007:
- using (Pen darkPen = new Pen(paletteGeneral.GetRibbonGroupDialogDark(state)),
- lightPen = new Pen(paletteGeneral.GetRibbonGroupDialogLight(state)))
- {
- context.Graphics.DrawLine(darkPen, displayRect.Left, displayRect.Top + 5, displayRect.Left, displayRect.Top);
- context.Graphics.DrawLine(darkPen, displayRect.Left, displayRect.Top, displayRect.Left + 5, displayRect.Top);
- context.Graphics.DrawLine(lightPen, displayRect.Left + 1, displayRect.Top + 5, displayRect.Left + 1, displayRect.Top + 1);
- context.Graphics.DrawLine(lightPen, displayRect.Left + 1, displayRect.Top + 1, displayRect.Left + 5, displayRect.Top + 1);
- context.Graphics.DrawLine(lightPen, displayRect.Right - 1, displayRect.Bottom - 5, displayRect.Right - 1, displayRect.Bottom - 1);
- context.Graphics.DrawLine(lightPen, displayRect.Right - 1, displayRect.Bottom - 1, displayRect.Right - 4, displayRect.Bottom - 1);
- context.Graphics.DrawLine(lightPen, displayRect.Right - 1, displayRect.Bottom - 1, displayRect.Right - 4, displayRect.Bottom - 5);
- context.Graphics.DrawLine(darkPen, displayRect.Right - 5, displayRect.Bottom - 2, displayRect.Right - 2, displayRect.Bottom - 2);
- context.Graphics.DrawLine(darkPen, displayRect.Right - 4, displayRect.Bottom - 3, displayRect.Right - 3, displayRect.Bottom - 3);
- context.Graphics.DrawLine(darkPen, displayRect.Right - 2, displayRect.Bottom - 2, displayRect.Right - 2, displayRect.Bottom - 5);
- context.Graphics.DrawLine(darkPen, displayRect.Right - 3, displayRect.Bottom - 3, displayRect.Right - 3, displayRect.Bottom - 4);
- context.Graphics.DrawLine(darkPen, displayRect.Right - 5, displayRect.Bottom - 5, displayRect.Right - 3, displayRect.Bottom - 3);
- }
- break;
- case PaletteRibbonShape.Office2010:
- LinearGradientBrush dialogBrush = new LinearGradientBrush(new RectangleF(displayRect.X - 1, displayRect.Y - 1, displayRect.Width + 2, displayRect.Height + 2),
- paletteGeneral.GetRibbonGroupDialogLight(state),
- paletteGeneral.GetRibbonGroupDialogDark(state),
- 45f);
-
- using (Pen dialogPen = new Pen(dialogBrush))
- {
- context.Graphics.DrawLine(dialogPen, displayRect.Left, displayRect.Top + 5, displayRect.Left, displayRect.Top);
- context.Graphics.DrawLine(dialogPen, displayRect.Left, displayRect.Top, displayRect.Left + 5, displayRect.Top);
- context.Graphics.DrawLine(dialogPen, displayRect.Right - 5, displayRect.Bottom - 2, displayRect.Right - 2, displayRect.Bottom - 2);
- context.Graphics.DrawLine(dialogPen, displayRect.Right - 4, displayRect.Bottom - 3, displayRect.Right - 3, displayRect.Bottom - 3);
- context.Graphics.DrawLine(dialogPen, displayRect.Right - 2, displayRect.Bottom - 2, displayRect.Right - 2, displayRect.Bottom - 5);
- context.Graphics.DrawLine(dialogPen, displayRect.Right - 3, displayRect.Bottom - 3, displayRect.Right - 3, displayRect.Bottom - 4);
- context.Graphics.DrawLine(dialogPen, displayRect.Right - 5, displayRect.Bottom - 5, displayRect.Right - 3, displayRect.Bottom - 3);
- }
- break;
- }
- }
-
- ///
- /// Perform drawing of a ribbon drop arrow glyph.
- ///
- /// Ribbon shape.
- /// Render context.
- /// Display area available for drawing.
- /// General ribbon palette details.
- /// State associated with rendering.
- ///
- public override void DrawRibbonDropArrow(PaletteRibbonShape shape,
- ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle displayRect,
- IPaletteRibbonGeneral paletteGeneral,
- PaletteState state)
- {
- Debug.Assert(context != null);
- Debug.Assert(paletteGeneral != null);
-
- // Validate parameter references
- if (context == null)
- {
- throw new ArgumentNullException(nameof(context));
- }
-
- if (paletteGeneral == null)
- {
- throw new ArgumentNullException(nameof(paletteGeneral));
- }
-
- Color darkColor = (state == PaletteState.Disabled ? paletteGeneral.GetRibbonDisabledDark(state) :
- paletteGeneral.GetRibbonDropArrowDark(state));
-
- Color lightColor = (state == PaletteState.Disabled ? paletteGeneral.GetRibbonDisabledLight(state) :
- paletteGeneral.GetRibbonDropArrowLight(state));
-
- switch (shape)
- {
- default:
- case PaletteRibbonShape.Office2007:
- using (Pen darkPen = new Pen(darkColor),
- lightPen = new Pen(lightColor))
- {
- context.Graphics.DrawLine(darkPen, displayRect.Left, displayRect.Top, displayRect.Left + 4, displayRect.Top);
- context.Graphics.DrawLine(darkPen, displayRect.Left + 1, displayRect.Top + 1, displayRect.Left + 3, displayRect.Top + 1);
- context.Graphics.DrawLine(darkPen, displayRect.Left + 2, displayRect.Top + 1, displayRect.Left + 2, displayRect.Top + 2);
- context.Graphics.DrawLine(lightPen, displayRect.Left, displayRect.Top + 1, displayRect.Left + 2, displayRect.Top + 3);
- context.Graphics.DrawLine(lightPen, displayRect.Left + 2, displayRect.Top + 3, displayRect.Left + 4, displayRect.Top + 1);
- }
- break;
- case PaletteRibbonShape.Office2010:
- using (LinearGradientBrush fillBrush = new LinearGradientBrush(new RectangleF(displayRect.X - 1, displayRect.Y - 1, displayRect.Width + 2, displayRect.Height + 2),
- lightColor, darkColor, 45f))
- {
- context.Graphics.FillPolygon(fillBrush, new Point[]{ new Point(displayRect.Left - 1, displayRect.Top - 1),
- new Point(displayRect.Left + 2, displayRect.Top + 3),
- new Point(displayRect.Left + 5, displayRect.Top) });
- }
- break;
- }
- }
-
- ///
- /// Perform drawing of a ribbon context arrow glyph.
- ///
- /// Ribbon shape.
- /// Render context.
- /// Display area available for drawing.
- /// General ribbon palette details.
- /// State associated with rendering.
- ///
- public override void DrawRibbonContextArrow(PaletteRibbonShape shape,
- ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle displayRect,
- IPaletteRibbonGeneral paletteGeneral,
- PaletteState state)
- {
- Debug.Assert(context != null);
- Debug.Assert(paletteGeneral != null);
-
- // Validate parameter references
- if (context == null)
- {
- throw new ArgumentNullException(nameof(context));
- }
-
- if (paletteGeneral == null)
- {
- throw new ArgumentNullException(nameof(paletteGeneral));
- }
-
- Color c1 = paletteGeneral.GetRibbonQATButtonDark(state);
- Color c2 = paletteGeneral.GetRibbonQATButtonLight(state);
-
- // If disabled then convert to black and white
- if (state == PaletteState.Disabled)
- {
- c1 = CommonHelper.ColorToBlackAndWhite(c1);
- c2 = CommonHelper.ColorToBlackAndWhite(c2);
- }
-
- using (Pen darkPen = new Pen(c1),
- lightPen = new Pen(c2))
- {
- if (shape == PaletteRibbonShape.Office2010)
- {
- context.Graphics.DrawLine(darkPen, displayRect.Left - 1, displayRect.Top, displayRect.Left + 5, displayRect.Top);
- context.Graphics.DrawLine(lightPen, displayRect.Left - 1, displayRect.Top + 1, displayRect.Left + 5, displayRect.Top + 1);
- }
- else
- {
- context.Graphics.DrawLine(darkPen, displayRect.Left, displayRect.Top, displayRect.Left + 4, displayRect.Top);
- context.Graphics.DrawLine(lightPen, displayRect.Left, displayRect.Top + 1, displayRect.Left + 4, displayRect.Top + 1);
- }
-
- context.Graphics.DrawLine(darkPen, displayRect.Left, displayRect.Top + 3, displayRect.Left + 4, displayRect.Top + 3);
- context.Graphics.DrawLine(darkPen, displayRect.Left + 1, displayRect.Top + 4, displayRect.Left + 3, displayRect.Top + 4);
- context.Graphics.DrawLine(darkPen, displayRect.Left + 2, displayRect.Top + 4, displayRect.Left + 2, displayRect.Top + 5);
- context.Graphics.DrawLine(lightPen, displayRect.Left, displayRect.Top + 4, displayRect.Left + 2, displayRect.Top + 6);
- context.Graphics.DrawLine(lightPen, displayRect.Left + 2, displayRect.Top + 6, displayRect.Left + 4, displayRect.Top + 4);
- }
- }
-
- ///
- /// Perform drawing of a ribbon overflow image.
- ///
- /// Ribbon shape.
- /// Render context.
- /// Display area available for drawing.
- /// General ribbon palette details.
- /// State associated with rendering.
- ///
- public override void DrawRibbonOverflow(PaletteRibbonShape shape,
- ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle displayRect,
- IPaletteRibbonGeneral paletteGeneral,
- PaletteState state)
- {
- Debug.Assert(context != null);
- Debug.Assert(paletteGeneral != null);
-
- // Validate parameter references
- if (context == null)
- {
- throw new ArgumentNullException(nameof(context));
- }
-
- if (paletteGeneral == null)
- {
- throw new ArgumentNullException(nameof(paletteGeneral));
- }
-
- Color c1 = paletteGeneral.GetRibbonQATButtonDark(state);
- Color c2 = paletteGeneral.GetRibbonQATButtonLight(state);
-
- // Office 2010 uses the same color for both parts
- if (shape == PaletteRibbonShape.Office2010)
- {
- c2 = c1;
- }
-
- // If disabled then convert to black and white
- if (state == PaletteState.Disabled)
- {
- c1 = CommonHelper.ColorToBlackAndWhite(c1);
- c2 = CommonHelper.ColorToBlackAndWhite(c2);
- }
-
- using (Pen darkPen = new Pen(c1),
- lightPen = new Pen(c2))
- {
- context.Graphics.DrawLine(darkPen, displayRect.Left, displayRect.Top + 1, displayRect.Left, displayRect.Top + 3);
- context.Graphics.DrawLine(darkPen, displayRect.Left + 1, displayRect.Top + 2, displayRect.Left, displayRect.Top + 3);
- context.Graphics.DrawLine(lightPen, displayRect.Left, displayRect.Top, displayRect.Left + 2, displayRect.Top + 2);
- context.Graphics.DrawLine(lightPen, displayRect.Left + 1, displayRect.Top + 3, displayRect.Left, displayRect.Top + 4);
-
- context.Graphics.DrawLine(darkPen, displayRect.Left + 4, displayRect.Top + 1, displayRect.Left + 4, displayRect.Top + 3);
- context.Graphics.DrawLine(darkPen, displayRect.Left + 5, displayRect.Top + 2, displayRect.Left + 4, displayRect.Top + 3);
- context.Graphics.DrawLine(lightPen, displayRect.Left + 4, displayRect.Top, displayRect.Left + 6, displayRect.Top + 2);
- context.Graphics.DrawLine(lightPen, displayRect.Left + 5, displayRect.Top + 3, displayRect.Left + 4, displayRect.Top + 4);
- }
- }
-
- ///
- /// Perform drawing of a ribbon group separator.
- ///
- /// Ribbon shape.
- /// Render context.
- /// Display area available for drawing.
- /// General ribbon palette details.
- /// State associated with rendering.
- ///
- public override void DrawRibbonGroupSeparator(PaletteRibbonShape shape,
- ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle displayRect,
- IPaletteRibbonGeneral paletteGeneral,
- PaletteState state)
- {
- Debug.Assert(context != null);
- Debug.Assert(paletteGeneral != null);
-
- // Validate parameter references
- if (context == null)
- {
- throw new ArgumentNullException(nameof(context));
- }
-
- if (paletteGeneral == null)
- {
- throw new ArgumentNullException(nameof(paletteGeneral));
- }
-
- int x = displayRect.X + ((displayRect.Width - 2) / 2);
- Color darkColor = paletteGeneral.GetRibbonGroupSeparatorDark(state);
- Color lightColor = paletteGeneral.GetRibbonGroupSeparatorLight(state);
-
- switch (shape)
- {
- default:
- case PaletteRibbonShape.Office2007:
- using (Pen darkPen = new Pen(darkColor),
- lightPen = new Pen(lightColor))
- {
- context.Graphics.DrawLine(lightPen, x, displayRect.Top + 2, x, displayRect.Bottom - 3);
- context.Graphics.DrawLine(darkPen, x + 1, displayRect.Top + 2, x + 1, displayRect.Bottom - 3);
- }
- break;
- case PaletteRibbonShape.Office2010:
- using (LinearGradientBrush darkBrush = new LinearGradientBrush(new RectangleF(displayRect.X, displayRect.Y - 1, displayRect.Width, displayRect.Height + 2), Color.FromArgb(72, darkColor), darkColor, 90f),
- lightBrush = new LinearGradientBrush(new RectangleF(displayRect.X - 1, displayRect.Y - 1, displayRect.Width + 2, displayRect.Height + 2), Color.FromArgb(128, lightColor), lightColor, 90f))
- {
- darkBrush.SetSigmaBellShape(0.5f);
- lightBrush.SetSigmaBellShape(0.5f);
-
- using (Pen darkPen = new Pen(darkBrush))
- {
- context.Graphics.FillRectangle(lightBrush, x, displayRect.Top, 3, displayRect.Height);
- context.Graphics.DrawLine(darkPen, x + 1, displayRect.Top, x + 1, displayRect.Bottom - 1);
- }
- }
- break;
- }
- }
-
- ///
- /// Draw a grid sorting direction glyph.
- ///
- /// Render context.
- /// Sorting order of the glyph.
- /// Available drawing rectangle space.
- /// Palette to use for sourcing values.
- /// State associated with rendering.
- /// Should be drawn from right to left.
- /// Remainder space left over for other drawing.
- public override Rectangle DrawGridSortGlyph(ComponentFactory.Krypton.Toolkit.RenderContext context,
- SortOrder sortOrder,
- Rectangle cellRect,
- IPaletteContent paletteContent,
- PaletteState state,
- bool rtl)
- {
- Debug.Assert(context != null);
- Debug.Assert(paletteContent != null);
-
- // Get the appropriate each to draw
- Image sortImage = _gridSortOrder.Images[(sortOrder == SortOrder.Ascending ? 0 : 1)];
-
- // Is there enough room to draw the image?
- if ((sortImage.Width < cellRect.Width) && (sortImage.Height < cellRect.Height))
- {
- // Find the drawing location of the image
- int y = cellRect.Top + ((cellRect.Height - sortImage.Height) / 2);
- int x = (rtl ? cellRect.X : cellRect.Right - sortImage.Width);
-
- // Grab the foreground color to use for the image
- Color imageColor = paletteContent.GetContentShortTextColor1(state);
-
- // Draw the image with remapping the image color to the foreground color
- using (ImageAttributes attribs = new ImageAttributes())
- {
- ColorMap cm = new ColorMap
- {
- OldColor = Color.Black,
- NewColor = CommonHelper.MergeColors(imageColor, 0.75f, Color.Transparent, 0.25f)
- };
- attribs.SetRemapTable(new ColorMap[] { cm }, ColorAdjustType.Bitmap);
-
- context.Graphics.DrawImage(sortImage,
- new Rectangle(x, y, sortImage.Width, sortImage.Height),
- 0, 0, sortImage.Width, sortImage.Height,
- GraphicsUnit.Pixel, attribs);
- }
-
- // Reduce the cell rect by that used up
- cellRect.Width -= sortImage.Width;
-
- // With rtl we need to move across to the right
- if (rtl)
- {
- cellRect.X += sortImage.Width;
- }
- }
-
- return cellRect;
- }
-
- ///
- /// Draw a grid row glyph.
- ///
- /// Render context.
- /// Row glyph.
- /// Available drawing rectangle space.
- /// Palette to use for sourcing values.
- /// State associated with rendering.
- /// Should be drawn from right to left.
- /// Remainder space left over for other drawing.
- public override Rectangle DrawGridRowGlyph(ComponentFactory.Krypton.Toolkit.RenderContext context,
- GridRowGlyph rowGlyph,
- Rectangle cellRect,
- IPaletteContent paletteContent,
- PaletteState state,
- bool rtl)
- {
- Debug.Assert(context != null);
- Debug.Assert(paletteContent != null);
-
- // Get the appropriate each to draw
- Image rowImage = null;
-
- switch (rowGlyph)
- {
- case GridRowGlyph.ArrowStar:
- rowImage = _gridRowIndicators.Images[rtl ? 4 : 0];
- break;
- case GridRowGlyph.Star:
- rowImage = _gridRowIndicators.Images[rtl ? 5 : 1];
- break;
- case GridRowGlyph.Pencil:
- rowImage = _gridRowIndicators.Images[rtl ? 6 : 2];
- break;
- case GridRowGlyph.Arrow:
- rowImage = _gridRowIndicators.Images[rtl ? 7 : 3];
- break;
- }
-
- // Is there enough room to draw the image?
- if ((rowImage != null) &&
- (rowImage.Width < cellRect.Width) &&
- (rowImage.Height < cellRect.Height))
- {
- // Find the drawing location of the image
- int y = cellRect.Top + ((cellRect.Height - rowImage.Height) / 2);
- int x = (rtl ? cellRect.Right - rowImage.Width : cellRect.Left);
-
- // Grab the foreground color to use for the image
- Color imageColor = paletteContent.GetContentShortTextColor1(state);
-
- // Draw the image with remapping the image color to the foreground color
- using (ImageAttributes attribs = new ImageAttributes())
- {
- ColorMap cm = new ColorMap
- {
- OldColor = Color.Black,
- NewColor = CommonHelper.MergeColors(imageColor, 0.75f, Color.Transparent, 0.25f)
- };
- attribs.SetRemapTable(new ColorMap[] { cm }, ColorAdjustType.Bitmap);
-
- context.Graphics.DrawImage(rowImage,
- new Rectangle(x, y, rowImage.Width, rowImage.Height),
- 0, 0, rowImage.Width, rowImage.Height,
- GraphicsUnit.Pixel, attribs);
- }
-
- // Reduce the cell rect by that used up
- cellRect.Width -= rowImage.Width;
-
- // With NOT rtl we need to move across to the right
- if (!rtl)
- {
- cellRect.X += rowImage.Width;
- }
- }
-
- return cellRect;
- }
-
- ///
- /// Draw a grid error glyph.
- ///
- /// Render context.
- /// Available drawing rectangle space.
- /// State associated with rendering.
- /// Should be drawn from right to left.
- /// Remainder space left over for other drawing.
- public override Rectangle DrawGridErrorGlyph(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle cellRect,
- PaletteState state,
- bool rtl)
- {
- Debug.Assert(context != null);
-
- // Get the appropriate each to draw
- Image errorImage = _gridErrorIcon.Images[0];
-
- // Is there enough room to draw the image?
- if ((errorImage.Width < cellRect.Width) && (errorImage.Height < cellRect.Height))
- {
- // Find the drawing location of the image
- int y = cellRect.Top + ((cellRect.Height - errorImage.Height) / 2);
- int x = (rtl ? cellRect.Left : cellRect.Right - errorImage.Width);
-
- if (state == PaletteState.Disabled)
- {
- ControlPaint.DrawImageDisabled(context.Graphics, errorImage, x, y, Color.Empty);
- }
- else
- {
- context.Graphics.DrawImage(errorImage, x, y);
- }
-
- // Reduce the cell rect by that used up
- cellRect.Width -= errorImage.Width;
-
- // With rtl we need to move across to the right
- if (rtl)
- {
- cellRect.X += errorImage.Width;
- }
- }
-
- return cellRect;
- }
-
- ///
- /// Draw a solid area glyph suitable for a drag drop area.
- ///
- /// Render context.
- /// Drawing rectangle space.
- /// Palette source of drawing values.
- public override void DrawDragDropSolidGlyph(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle drawRect,
- IPaletteDragDrop dragDropPalette)
- {
- Debug.Assert(context != null);
- Debug.Assert(dragDropPalette != null);
-
- using (SolidBrush backBrush = new SolidBrush(dragDropPalette.GetDragDropSolidBack()))
- {
- context.Graphics.FillRectangle(backBrush, drawRect);
- }
-
- using (Pen borderPen = new Pen(dragDropPalette.GetDragDropSolidBorder()))
- {
- context.Graphics.DrawRectangle(borderPen, drawRect);
- }
- }
-
- ///
- /// Measure the drag and drop docking glyphs.
- ///
- /// Set of drag docking data.
- /// Palette source of drawing values.
- /// Feedback requested.
- public override void MeasureDragDropDockingGlyph(ComponentFactory.Krypton.Toolkit.RenderDragDockingData dragData,
- IPaletteDragDrop dragDropPalette,
- PaletteDragFeedback feedback)
- {
- Debug.Assert(dragData != null);
- Debug.Assert(dragDropPalette != null);
-
- if (feedback == PaletteDragFeedback.Rounded)
- {
- MeasureDragDockingRounded(dragData, dragDropPalette);
- }
- else
- {
- MeasureDragDockingSquares(dragData, dragDropPalette);
- }
- }
-
- ///
- /// Draw a solid area glyph suitable for a drag drop area.
- ///
- /// Render context.
- /// Set of drag docking data.
- /// Palette source of drawing values.
- /// Feedback requested.
- public override void DrawDragDropDockingGlyph(ComponentFactory.Krypton.Toolkit.RenderContext context,
- ComponentFactory.Krypton.Toolkit.RenderDragDockingData dragData,
- IPaletteDragDrop dragDropPalette,
- PaletteDragFeedback feedback)
- {
- Debug.Assert(context != null);
- Debug.Assert(dragData != null);
- Debug.Assert(dragDropPalette != null);
-
- if (feedback == PaletteDragFeedback.Rounded)
- {
- DrawDragDockingRounded(context, dragData, dragDropPalette);
- }
- else
- {
- DrawDragDockingSquares(context, dragData, dragDropPalette);
- }
- }
- #endregion
-
- #region EvalTransparentPaint
- ///
- /// Evaluate if transparent painting is needed for background palette.
- ///
- /// Background palette to test.
- /// Element state associated with palette.
- /// True if transparent painting required.
- public override bool EvalTransparentPaint(IPaletteBack paletteBack,
- PaletteState state)
- {
- // If the background is not being painted, then has transparency
- if (paletteBack.GetBackDraw(state) == InheritBool.False)
- {
- return true;
- }
- else
- {
- // If the first color has alpha channel then has transparency
- if (paletteBack.GetBackColor1(state).A < 255)
- {
- return true;
- }
- else
- {
- // Does the draw style require use of the second color?
- if (paletteBack.GetBackColorStyle(state) != PaletteColorStyle.Solid)
- {
- // If the second color has alpha channel then has transparency
- if (paletteBack.GetBackColor2(state).A < 255)
- {
- return true;
- }
- }
- }
- }
-
- // Cannot find any transparent areas
- return false;
- }
-
- ///
- /// Evaluate if transparent painting is needed for background or border palettes.
- ///
- /// Background palette to test.
- /// Background palette to test.
- /// Element state associated with palette.
- /// True if transparent painting required.
- public override bool EvalTransparentPaint(IPaletteBack paletteBack,
- IPaletteBorder paletteBorder,
- PaletteState state)
- {
- int rounding = paletteBorder.GetBorderRounding(state);
-
- // If the border takes up some visual space
- if (paletteBorder.GetBorderWidth(state) > 0)
- {
- // If the border is not being painted then it must be transparent
- if (paletteBorder.GetBorderDraw(state) == InheritBool.False)
- {
- return true;
- }
- else
- {
- // If there is rounding causing transparent corners
- if (paletteBorder.GetBorderRounding(state) > 0)
- {
- return true;
- }
- else
- {
- // If the first color has alpha channel then has transparency
- if (paletteBorder.GetBorderColor1(state).A < 255)
- {
- return true;
- }
- else
- {
- // Does the draw style require use of the second color?
- if (paletteBorder.GetBorderColorStyle(state) != PaletteColorStyle.Solid)
- {
- // If the second color has alpha channel then has transparency
- if (paletteBorder.GetBorderColor2(state).A < 255)
- {
- return true;
- }
- }
- }
- }
- }
- }
-
- // The border does not cause transparency, check the background
- return EvalTransparentPaint(paletteBack, state);
- }
-
- ///
- /// Draw the track bar ticks glyph.
- ///
- /// Render context.
- /// Element state.
- /// Source of palette colors.
- /// Drawing rectangle that should contain ticks.
- /// Orientation of the drawing area.
- /// Drawing on the topRight or the bottomLeft.
- /// Size of the position indicator.
- /// First value.
- /// Last value.
- /// How often ticks are drawn.
- public override void DrawTrackTicksGlyph(ComponentFactory.Krypton.Toolkit.RenderContext context,
- PaletteState state,
- IPaletteElementColor elementPalette,
- Rectangle drawRect,
- Orientation orientation,
- bool topRight,
- Size positionSize,
- int minimum,
- int maximum,
- int frequency)
- {
- // Never want a frequency less than 1
- if (frequency <= 0)
- {
- frequency = 1;
- }
-
- float range = maximum - minimum;
- using (Pen tickPen = new Pen(elementPalette.GetElementColor1(state)))
- {
- if (orientation == Orientation.Horizontal)
- {
- // Reduce area by half the position indicator on each side
- int halfPosition = positionSize.Width / 2;
- drawRect.X += halfPosition;
- drawRect.Width -= positionSize.Width;
-
- // Draw a marker for each value between min and max
- float factor = (range == 0) ? float.MinValue : (float)drawRect.Width / range;
- for (int i = minimum, y = 0; i <= maximum; i += frequency, y += frequency)
- {
- float offset = drawRect.X + (factor * y);
- float top;
- float bottom;
- if (!topRight)
- {
- top = drawRect.Y + 2;
- bottom = drawRect.Bottom - 2;
- if ((i == minimum) || (i == maximum))
- {
- top -= 1;
- }
- }
- else
- {
- top = drawRect.Y + 1;
- bottom = drawRect.Bottom - 3;
- if ((i == minimum) || (i == maximum))
- {
- bottom += 1;
- }
- }
-
- context.Graphics.DrawLine(tickPen, offset, top, offset, bottom);
- }
- }
- else
- {
- // Reduce area by half the position indicator on each side
- int halfPosition = positionSize.Height / 2;
- drawRect.Y += halfPosition;
- drawRect.Height -= positionSize.Height;
-
- // Draw a marker for each value between min and max
- float factor = (range == 0) ? float.MinValue : (float)drawRect.Height / range;
- for (int i = minimum, y = 0; i <= maximum; i += frequency, y += frequency)
- {
- float offset = drawRect.Y + (factor * y);
- float left;
- float right;
- if (topRight)
- {
- left = drawRect.X + 2;
- right = drawRect.Right - 2;
- if ((i == minimum) || (i == maximum))
- {
- left -= 1;
- }
- }
- else
- {
- left = drawRect.X + 1;
- right = drawRect.Right - 3;
- if ((i == minimum) || (i == maximum))
- {
- right += 1;
- }
- }
-
- context.Graphics.DrawLine(tickPen, left, offset, right, offset);
- }
- }
- }
- }
-
- ///
- /// Draw the track bar track glyph.
- ///
- /// Render context.
- /// Element state.
- /// Source of palette colors.
- /// Drawing rectangle that should contain the track.
- /// Drawing orientation.
- /// Drawing as a volume control or standard slider.
- public override void DrawTrackGlyph(ComponentFactory.Krypton.Toolkit.RenderContext context,
- PaletteState state,
- IPaletteElementColor elementPalette,
- Rectangle drawRect,
- Orientation orientation,
- bool volumeControl)
- {
- // The position indicator leavesa gap at the left/right ends for horizontal and top/bottom for vertical
- // so we do not draw that last pixel so that when the indicator is at the end the track does not stick out
- if (orientation == Orientation.Horizontal)
- {
- drawRect.Inflate(-1, 0);
- }
- else
- {
- drawRect.Inflate(0, -1);
- }
-
- using (Pen border1Pen = new Pen(elementPalette.GetElementColor1(state)),
- border2Pen = new Pen(elementPalette.GetElementColor2(state)))
- {
- using (SolidBrush insideBrush = new SolidBrush(elementPalette.GetElementColor3(state)))
- {
- if (!volumeControl)
- {
- context.Graphics.FillRectangle(insideBrush, drawRect.X + 1, drawRect.Y + 1, drawRect.Width - 2, drawRect.Height - 2);
-
- context.Graphics.DrawLines(border1Pen, new Point[]{ new Point(drawRect.Right - 1, drawRect.Y),
- new Point(drawRect.X, drawRect.Y),
- new Point(drawRect.X, drawRect.Bottom - 1)});
-
- context.Graphics.DrawLines(border2Pen, new Point[]{ new Point(drawRect.Right - 1, drawRect.Y + 1),
- new Point(drawRect.Right - 1, drawRect.Bottom - 1),
- new Point(drawRect.X + 1, drawRect.Bottom - 1)});
- }
- else
- {
- if (orientation == Orientation.Horizontal)
- {
- using (AntiAlias aa = new AntiAlias(context.Graphics))
- {
- context.Graphics.FillPolygon(insideBrush, new Point[]{ new Point(drawRect.X, drawRect.Bottom - 2),
- new Point(drawRect.Right - 1, drawRect.Y),
- new Point(drawRect.Right - 1, drawRect.Bottom - 1),
- new Point(drawRect.X, drawRect.Bottom - 1),
- new Point(drawRect.X, drawRect.Bottom - 2)});
-
- context.Graphics.DrawLines(border1Pen, new Point[]{ new Point(drawRect.Right - 1, drawRect.Y),
- new Point(drawRect.Right - 1, drawRect.Bottom - 1),
- new Point(drawRect.X, drawRect.Bottom - 1),
- new Point(drawRect.X, drawRect.Bottom - 2),
- new Point(drawRect.Right - 1, drawRect.Y)});
- }
-
- }
- else
- {
- using (AntiAlias aa = new AntiAlias(context.Graphics))
- {
- context.Graphics.FillPolygon(insideBrush, new Point[]{ new Point(drawRect.X + 1, drawRect.Bottom - 1),
- new Point(drawRect.Right - 1, drawRect.Y + 1),
- new Point(drawRect.X, drawRect.Y + 1),
- new Point(drawRect.X, drawRect.Bottom - 1),
- new Point(drawRect.X + 1, drawRect.Bottom - 1)});
-
- context.Graphics.DrawLines(border1Pen, new Point[]{ new Point(drawRect.Right - 1, drawRect.Y + 1),
- new Point(drawRect.X, drawRect.Y + 1),
- new Point(drawRect.X, drawRect.Bottom - 1),
- new Point(drawRect.X + 1, drawRect.Bottom - 1),
- new Point(drawRect.Right - 1, drawRect.Y + 1)});
- }
- }
- }
- }
- }
- }
-
- ///
- /// Draw the track bar position glyph.
- ///
- /// Render context.
- /// Element state.
- /// Source of palette colors.
- /// Drawing rectangle that should contain the track.
- /// Drawing orientation.
- /// Tick marks that surround the position.
- public override void DrawTrackPositionGlyph(ComponentFactory.Krypton.Toolkit.RenderContext context,
- PaletteState state,
- IPaletteElementColor elementPalette,
- Rectangle drawRect,
- Orientation orientation,
- TickStyle tickStyle)
- {
- GraphicsPath outside = null;
- GraphicsPath border = null;
- GraphicsPath inside = null;
-
- if (orientation == Orientation.Horizontal)
- {
- switch (tickStyle)
- {
- case TickStyle.None:
- case TickStyle.Both:
- CreatePositionPathsBoth(drawRect, ref outside, ref border, ref inside);
- break;
- case TickStyle.TopLeft:
- CreatePositionPathsTop(drawRect, ref outside, ref border, ref inside);
- break;
- case TickStyle.BottomRight:
- CreatePositionPathsBottom(drawRect, ref outside, ref border, ref inside);
- break;
- }
- }
- else
- {
- switch (tickStyle)
- {
- case TickStyle.None:
- case TickStyle.Both:
- CreatePositionPathsBoth(drawRect, ref outside, ref border, ref inside);
- break;
- case TickStyle.TopLeft:
- CreatePositionPathsLeft(drawRect, ref outside, ref border, ref inside);
- break;
- case TickStyle.BottomRight:
- CreatePositionPathsRight(drawRect, ref outside, ref border, ref inside);
- break;
- }
- }
-
- if ((outside != null) && (border != null) && (inside != null))
- {
- using (AntiAlias aa = new AntiAlias(context.Graphics))
- {
- using (Pen outsidePen = new Pen(elementPalette.GetElementColor1(state)),
- borderPen = new Pen(elementPalette.GetElementColor2(state)))
- {
- context.Graphics.DrawPath(outsidePen, outside);
-
- using (SolidBrush insideBrush = new SolidBrush(elementPalette.GetElementColor3(state)))
- {
- context.Graphics.FillPath(insideBrush, border);
- }
-
- context.Graphics.DrawPath(borderPen, border);
-
- using (LinearGradientBrush innerBrush = new LinearGradientBrush(inside.GetBounds(),
- elementPalette.GetElementColor4(state),
- elementPalette.GetElementColor5(state),
- 90f))
- {
- context.Graphics.FillPath(innerBrush, inside);
- }
- }
- }
-
- outside.Dispose();
- border.Dispose();
- inside.Dispose();
- }
- }
-
- private void CreatePositionPathsBoth(Rectangle drawRect,
- ref GraphicsPath outside,
- ref GraphicsPath border,
- ref GraphicsPath inside)
- {
- outside = CreatePositionPathsBoth(drawRect);
- drawRect.Inflate(-1, -1);
- border = CreatePositionPathsBoth(drawRect);
-
- inside = new GraphicsPath();
- inside.AddRectangle(new Rectangle(drawRect.X + 2, drawRect.Y + 2, drawRect.Width - 5, drawRect.Height - 5));
- }
-
- private GraphicsPath CreatePositionPathsBoth(Rectangle drawRect)
- {
- GraphicsPath path = new GraphicsPath();
- path.AddLines(new PointF[]{ new PointF(drawRect.X + 0.75f, drawRect.Y),
- new PointF(drawRect.Right - 1.75f, drawRect.Y),
- new PointF(drawRect.Right - 1.0f, drawRect.Y + 0.75f),
- new PointF(drawRect.Right - 1.0f, drawRect.Bottom - 2.0f),
- new PointF(drawRect.Right - 2.0f, drawRect.Bottom - 1.0f),
- new PointF(drawRect.X + 1.0f, drawRect.Bottom - 1.0f),
- new PointF(drawRect.X, drawRect.Bottom - 2.0f),
- new PointF(drawRect.X, drawRect.Y + 0.75f),
- new PointF(drawRect.X + 0.75f, drawRect.Y)});
-
- return path;
- }
-
- private void CreatePositionPathsBottom(Rectangle drawRect,
- ref GraphicsPath outside,
- ref GraphicsPath border,
- ref GraphicsPath inside)
- {
- outside = CreatePositionPathsBottom(drawRect);
- drawRect.Inflate(-1, -1);
- border = CreatePositionPathsBottom(drawRect);
- drawRect.Inflate(-2, -2);
- drawRect.Y += 1;
- drawRect.Height -= 1;
- inside = CreatePositionPathsBottom(drawRect);
- }
-
- private GraphicsPath CreatePositionPathsBottom(Rectangle drawRect)
- {
- float half = ((float)drawRect.Width / 2) - 0.5f;
-
- GraphicsPath path = new GraphicsPath();
- path.AddLines(new PointF[]{ new PointF(drawRect.X + half, drawRect.Y),
- new PointF(drawRect.Right - 1.0f, drawRect.Y + + half),
- new PointF(drawRect.Right - 1.0f, drawRect.Bottom - 2.0f),
- new PointF(drawRect.Right - 2.0f, drawRect.Bottom - 1.0f),
- new PointF(drawRect.X + 1.0f, drawRect.Bottom - 1.0f),
- new PointF(drawRect.X, drawRect.Bottom - 2.0f),
- new PointF(drawRect.X, drawRect.Y + half),
- new PointF(drawRect.X + half, drawRect.Y)});
- return path;
- }
-
- private void CreatePositionPathsTop(Rectangle drawRect,
- ref GraphicsPath outside,
- ref GraphicsPath border,
- ref GraphicsPath inside)
- {
- outside = CreatePositionPathsTop(drawRect);
- drawRect.Inflate(-1, -1);
- border = CreatePositionPathsTop(drawRect);
- drawRect.Inflate(-2, -2);
- drawRect.Height -= 1;
- inside = CreatePositionPathsTop(drawRect);
- }
-
- private GraphicsPath CreatePositionPathsTop(Rectangle drawRect)
- {
- float half = ((float)drawRect.Width / 2) - 0.5f;
-
- GraphicsPath path = new GraphicsPath();
- path.AddLines(new PointF[]{ new PointF(drawRect.X + 0.75f, drawRect.Y),
- new PointF(drawRect.Right - 1.75f, drawRect.Y),
- new PointF(drawRect.Right - 1.0f, drawRect.Y + 0.75f),
- new PointF(drawRect.Right - 1.0f, drawRect.Bottom - half - 1.0f),
- new PointF(drawRect.X + half, drawRect.Bottom - 1.0f),
- new PointF(drawRect.X, drawRect.Bottom - half - 1.0f),
- new PointF(drawRect.X, drawRect.Y + 0.75f),
- new PointF(drawRect.X + 0.75f, drawRect.Y)});
- return path;
- }
-
- private void CreatePositionPathsRight(Rectangle drawRect,
- ref GraphicsPath outside,
- ref GraphicsPath border,
- ref GraphicsPath inside)
- {
- outside = CreatePositionPathsRight(drawRect);
- drawRect.Inflate(-1, -1);
- border = CreatePositionPathsRight(drawRect);
- drawRect.Inflate(-2, -2);
- drawRect.Width -= 1;
- inside = CreatePositionPathsRight(drawRect);
- }
-
- private GraphicsPath CreatePositionPathsRight(Rectangle drawRect)
- {
- float half = ((float)drawRect.Height / 2) - 0.5f;
-
- GraphicsPath path = new GraphicsPath();
- path.AddLines(new PointF[]{ new PointF(drawRect.X + 0.75f, drawRect.Y),
- new PointF(drawRect.Right - half - 1.0f, drawRect.Y),
- new PointF(drawRect.Right - 1.0f, drawRect.Y + half),
- new PointF(drawRect.Right - half - 1.0f, drawRect.Bottom - 1.0f),
- new PointF(drawRect.X + 1.0f, drawRect.Bottom - 1.0f),
- new PointF(drawRect.X, drawRect.Bottom - 2.0f),
- new PointF(drawRect.X, drawRect.Y + 0.75f),
- new PointF(drawRect.X + 0.75f, drawRect.Y)});
- return path;
- }
-
- private void CreatePositionPathsLeft(Rectangle drawRect,
- ref GraphicsPath outside,
- ref GraphicsPath border,
- ref GraphicsPath inside)
- {
- outside = CreatePositionPathsLeft(drawRect);
- drawRect.Inflate(-1, -1);
- border = CreatePositionPathsLeft(drawRect);
- drawRect.Inflate(-2, -2);
- drawRect.X += 1;
- drawRect.Width -= 1;
- inside = CreatePositionPathsLeft(drawRect);
- }
-
- private GraphicsPath CreatePositionPathsLeft(Rectangle drawRect)
- {
- float half = ((float)drawRect.Height / 2) - 0.5f;
-
- GraphicsPath path = new GraphicsPath();
- path.AddLines(new PointF[]{ new PointF(drawRect.Right - 1.75f, drawRect.Y),
- new PointF(drawRect.Right - 1.0f, drawRect.Y + 0.75f),
- new PointF(drawRect.Right - 1.0f, drawRect.Bottom - 2.0f),
- new PointF(drawRect.Right - 2.0f, drawRect.Bottom - 1.0f),
- new PointF(drawRect.X + half, drawRect.Bottom - 1.0f),
- new PointF(drawRect.X, drawRect.Bottom - half - 1.0f),
- new PointF(drawRect.X + half, drawRect.Y),
- new PointF(drawRect.Right - 1.75f, drawRect.Y)});
-
- return path;
- }
- #endregion
-
- #region Implementation Back & Border
- private static GraphicsPath CreateBorderBackPath(bool forBorder,
- bool middle,
- Rectangle rect,
- PaletteDrawBorders borders,
- int borderWidth,
- int borderRounding,
- bool smoothing,
- int variant)
- {
- Rectangle origRect = rect;
-
- GraphicsPath borderPath = new GraphicsPath();
-
- // A zero size rectangle cannot be drawn, so return a null path
- if ((rect.Width > 0) && (rect.Height > 0))
- {
- // Only use a rounding that will fit inside the rect
- int rounding = Math.Min(borderRounding, Math.Min(rect.Width / 2, rect.Height / 2) - borderWidth);
-
- // Shrink the rect by half the width of the pen, because the pen will
- // draw half the distance overlapping each side of the centre anyway.
- // Unless not drawing into the middle in which case give the outside.
- int halfBorderWidthTL = (middle ? borderWidth / 2 : 0);
-
- // Only adjust the edges that are being drawn
- if (CommonHelper.HasTopBorder(borders))
- {
- rect.Y += halfBorderWidthTL;
- rect.Height -= halfBorderWidthTL;
- }
-
- if (CommonHelper.HasLeftBorder(borders))
- {
- rect.X += halfBorderWidthTL;
- rect.Width -= halfBorderWidthTL;
- }
-
- if (CommonHelper.HasBottomBorder(borders))
- {
- rect.Height -= halfBorderWidthTL;
- }
-
- if (CommonHelper.HasRightBorder(borders))
- {
- rect.Width -= halfBorderWidthTL;
- }
-
- // Find the width/height of the arc box
- int arcLength = rounding * 2;
- int arcLength1 = arcLength + 1;
-
- // If drawing all the four borders use a single routine
- if (CommonHelper.HasAllBorders(borders))
- {
- CreateAllBorderBackPath(middle, borderPath, rect, borderWidth, rounding, forBorder, arcLength, arcLength1);
- }
- else
- {
- // Are we calculating just the borders to be drawn?
- if (forBorder)
- {
- // Are we calculating for the outside of the border edge? This is used for a KryptonForm
- // which needs to create a region that is the outside edge of the borders.
- if (!middle)
- {
- // If rounding is used we need to use a path so that corner rounding is honored but
- // because this is going to be used as a region we need to close the path as well.
- if (rounding > 0)
- {
- CreateBorderBackPathOnlyClosed(middle, borders, borderPath, rect, arcLength, variant);
- }
- else
- {
- // Without rounding we just provide the entire area
- borderPath.AddRectangle(rect);
- }
- }
- else
- {
- // We are calculating the middle of the border as the brush will then draw the entire
- // border from the middle outwards.
-
- if (rounding > 0)
- {
- CreateBorderBackPathOnly(middle, borders, borderPath, rect, arcLength, variant);
- }
- else
- {
- CreateBorderBackPathOnly(borders, borderPath, rect, variant);
- }
- }
- }
- else
- {
- // Calculating a complete path for the entire area and not just the specified borders
- // If there is rounding we need to calculate a path that honors the rounding at corners
- if (rounding > 0)
- {
- CreateBorderBackPathComplete(middle, borders, borderPath, rect, arcLength);
- }
- else
- {
- // Without rounding the complete path is always just the entire area
- borderPath.AddRectangle(rect);
- }
- }
- }
- }
-
- return borderPath;
- }
-
- private static void CreateAllBorderBackPath(bool middle,
- GraphicsPath borderPath,
- Rectangle rect,
- int width,
- int rounding,
- bool forBorder,
- int arcLength,
- int arcLength1)
- {
- // If there is no room for any rounding effect...
- if (rounding <= 0)
- {
- // If the width is an odd number then need to reduce by 1 in each dimension
- if (forBorder && middle && ((width % 2) == 1))
- {
- rect.Width -= 1;
- rect.Height -= 1;
- }
-
- // Just add a simple rectangle as a quick way of adding four lines
- borderPath.AddRectangle(rect);
- }
- else
- {
- // We create the path using a floating point rectangle
- RectangleF rectF = new RectangleF(rect.X, rect.Y, rect.Width, rect.Height);
-
- // If trying to get the outside edge then perform some offsetting so that
- // when converted to a region it draws nicely inside the path outline
- if (!middle && ((width % 2) == 1))
- {
- rectF.X -= 0.25f;
- rectF.Y -= 0.25f;
- rectF.Width += 0.75f;
- rectF.Height += 0.75f;
- }
-
- // The border is made of up a quarter of a circle arc, in each corner
- borderPath.AddArc(rectF.Left, rectF.Top, arcLength, arcLength, 180f, 90f);
- borderPath.AddArc(rectF.Right - arcLength1, rectF.Top, arcLength, arcLength, 270f, 90f);
- borderPath.AddArc(rectF.Right - arcLength1, rectF.Bottom - arcLength1, arcLength, arcLength, 0f, 90f);
- borderPath.AddArc(rectF.Left, rectF.Bottom - arcLength1, arcLength, arcLength, 90f, 90f);
-
- // Make the last and first arc join up
- borderPath.CloseFigure();
- }
- }
-
- private static void CreateBorderBackPathOnly(PaletteDrawBorders borders,
- GraphicsPath borderPath,
- Rectangle rect,
- int variant)
- {
- // Reduce the width and height by 1 pixel for drawing into rectangle
- rect.Width -= 1;
- rect.Height -= 1;
-
- // Add only the border for drawing
- switch (borders)
- {
- case PaletteDrawBorders.None:
- break;
- case PaletteDrawBorders.Top:
- borderPath.AddLine(rect.Left - 1, rect.Top, rect.Right + 1, rect.Top);
- break;
- case PaletteDrawBorders.Bottom:
- borderPath.AddLine(rect.Left - 1, rect.Bottom, rect.Right + 1, rect.Bottom);
- break;
- case PaletteDrawBorders.Left:
- borderPath.AddLine(rect.Left, rect.Top - 1, rect.Left, rect.Bottom + 1);
- break;
- case PaletteDrawBorders.Right:
- borderPath.AddLine(rect.Right, rect.Top - 1, rect.Right, rect.Bottom + 1);
- break;
- case PaletteDrawBorders.TopBottom:
- if (variant == 0)
- {
- borderPath.AddLine(rect.Left - 1, rect.Top, rect.Right + 1, rect.Top);
- }
- else
- {
- borderPath.AddLine(rect.Left - 1, rect.Bottom, rect.Right + 1, rect.Bottom);
- }
-
- break;
- case PaletteDrawBorders.LeftRight:
- if (variant == 0)
- {
- borderPath.AddLine(rect.Left, rect.Top - 1, rect.Left, rect.Bottom + 1);
- }
- else
- {
- borderPath.AddLine(rect.Right, rect.Top - 1, rect.Right, rect.Bottom + 1);
- }
-
- break;
- case PaletteDrawBorders.TopLeft:
- borderPath.AddLine(rect.Left, rect.Bottom + 1, rect.Left, rect.Top);
- borderPath.AddLine(rect.Left, rect.Top, rect.Right + 1, rect.Top);
- break;
- case PaletteDrawBorders.TopRight:
- borderPath.AddLine(rect.Left, rect.Top, rect.Right, rect.Top);
- borderPath.AddLine(rect.Right, rect.Top, rect.Right, rect.Bottom + 1);
- break;
- case PaletteDrawBorders.BottomRight:
- borderPath.AddLine(rect.Right, rect.Top - 1, rect.Right, rect.Bottom);
- borderPath.AddLine(rect.Right, rect.Bottom, rect.Left - 1, rect.Bottom);
- break;
- case PaletteDrawBorders.BottomLeft:
- borderPath.AddLine(rect.Right + 1, rect.Bottom, rect.Left, rect.Bottom);
- borderPath.AddLine(rect.Left, rect.Bottom, rect.Left, rect.Top - 1);
- break;
- case PaletteDrawBorders.TopBottomLeft:
- borderPath.AddLine(rect.Right + 1, rect.Bottom, rect.Left, rect.Bottom);
- borderPath.AddLine(rect.Left, rect.Bottom, rect.Left, rect.Top);
- borderPath.AddLine(rect.Left, rect.Top, rect.Right + 1, rect.Top);
- break;
- case PaletteDrawBorders.TopBottomRight:
- borderPath.AddLine(rect.Left - 1, rect.Top, rect.Right, rect.Top);
- borderPath.AddLine(rect.Right, rect.Top, rect.Right, rect.Bottom);
- borderPath.AddLine(rect.Right, rect.Bottom, rect.Left - 1, rect.Bottom);
- break;
- case PaletteDrawBorders.TopLeftRight:
- borderPath.AddLine(rect.Left, rect.Bottom + 1, rect.Left, rect.Top);
- borderPath.AddLine(rect.Left, rect.Top, rect.Right, rect.Top);
- borderPath.AddLine(rect.Right, rect.Top, rect.Right, rect.Bottom + 1);
- break;
- case PaletteDrawBorders.BottomLeftRight:
- borderPath.AddLine(rect.Right, rect.Top - 1, rect.Right, rect.Bottom);
- borderPath.AddLine(rect.Right, rect.Bottom, rect.Left, rect.Bottom);
- borderPath.AddLine(rect.Left, rect.Bottom, rect.Left, rect.Top - 1);
- break;
- }
- }
-
- private static void CreateBorderBackPathOnly(bool middle,
- PaletteDrawBorders borders,
- GraphicsPath borderPath,
- Rectangle rect,
- int arcLength,
- int variant)
- {
- // Reduce the width and height by 1 pixel for drawing into rectangle
- rect.Width -= 1;
- rect.Height -= 1;
-
- // We create the path using a floating point rectangle
- RectangleF rectF = new RectangleF(rect.X, rect.Y, rect.Width, rect.Height);
-
- // If trying to get the outside edge then perform some offsetting so that
- // when converted to a region it draws nicely inside the path outline
- if (!middle)
- {
- rectF.X -= 0.25f;
- rectF.Y -= 0.25f;
- rectF.Width += 0.75f;
- rectF.Height += 0.75f;
- }
-
- // Add only the border for drawing
- switch (borders)
- {
- case PaletteDrawBorders.None:
- break;
- case PaletteDrawBorders.Top:
- borderPath.AddLine(rect.Left - 1, rect.Top, rect.Right + 1, rect.Top);
- break;
- case PaletteDrawBorders.Bottom:
- borderPath.AddLine(rect.Left - 1, rect.Bottom, rect.Right + 1, rect.Bottom);
- break;
- case PaletteDrawBorders.Left:
- borderPath.AddLine(rect.Left, rect.Top - 1, rect.Left, rect.Bottom + 1);
- break;
- case PaletteDrawBorders.Right:
- borderPath.AddLine(rect.Right, rect.Top - 1, rect.Right, rect.Bottom + 1);
- break;
- case PaletteDrawBorders.TopBottom:
- if (variant == 0)
- {
- borderPath.AddLine(rect.Left - 1, rect.Top, rect.Right + 1, rect.Top);
- }
- else
- {
- borderPath.AddLine(rect.Left - 1, rect.Bottom, rect.Right + 1, rect.Bottom);
- }
-
- break;
- case PaletteDrawBorders.LeftRight:
- if (variant == 0)
- {
- borderPath.AddLine(rect.Left, rect.Top - 1, rect.Left, rect.Bottom + 1);
- }
- else
- {
- borderPath.AddLine(rect.Right, rect.Top - 1, rect.Right, rect.Bottom + 1);
- }
-
- break;
- case PaletteDrawBorders.TopLeft:
- borderPath.AddLine(rectF.Left, rectF.Bottom + 1, rectF.Left, rectF.Top + arcLength);
- borderPath.AddArc(rectF.Left, rectF.Top, arcLength, arcLength, 180f, 90f);
- borderPath.AddLine(rectF.Left + arcLength, rectF.Top, rectF.Right + 1, rectF.Top);
- break;
- case PaletteDrawBorders.TopRight:
- borderPath.AddLine(rectF.Left - 1, rectF.Top, rectF.Right - arcLength, rectF.Top);
- borderPath.AddArc(rectF.Right - arcLength, rectF.Top, arcLength, arcLength, -90f, 90f);
- borderPath.AddLine(rectF.Right, rectF.Top + arcLength, rectF.Right, rectF.Bottom + 1);
- break;
- case PaletteDrawBorders.BottomRight:
- borderPath.AddLine(rectF.Right, rectF.Top - 1, rectF.Right, rectF.Bottom - arcLength);
- borderPath.AddArc(rectF.Right - arcLength, rectF.Bottom - arcLength, arcLength, arcLength, 0f, 90f);
- borderPath.AddLine(rectF.Right - arcLength, rectF.Bottom, rectF.Left - 1, rectF.Bottom);
- break;
- case PaletteDrawBorders.BottomLeft:
- borderPath.AddLine(rectF.Right + 1, rectF.Bottom, rectF.Left + arcLength, rectF.Bottom);
- borderPath.AddArc(rectF.Left, rectF.Bottom - arcLength, arcLength, arcLength, 90f, 90f);
- borderPath.AddLine(rectF.Left, rectF.Bottom - arcLength, rectF.Left, rectF.Top - 1);
- break;
- case PaletteDrawBorders.TopBottomLeft:
- borderPath.AddLine(rectF.Right + 1, rectF.Bottom, rectF.Left + arcLength, rectF.Bottom);
- borderPath.AddArc(rectF.Left, rectF.Bottom - arcLength, arcLength, arcLength, 90f, 90f);
- borderPath.AddArc(rectF.Left, rectF.Top, arcLength, arcLength, 180f, 90f);
- borderPath.AddLine(rectF.Left + arcLength, rectF.Top, rectF.Right + 1, rectF.Top);
- break;
- case PaletteDrawBorders.TopBottomRight:
- borderPath.AddLine(rectF.Left - 1, rectF.Top, rectF.Right - arcLength, rectF.Top);
- borderPath.AddArc(rectF.Right - arcLength, rectF.Top, arcLength, arcLength, -90f, 90f);
- borderPath.AddArc(rectF.Right - arcLength, rectF.Bottom - arcLength, arcLength, arcLength, 0f, 90f);
- borderPath.AddLine(rectF.Right - arcLength, rectF.Bottom, rectF.Left - 1, rectF.Bottom);
- break;
- case PaletteDrawBorders.TopLeftRight:
- borderPath.AddLine(rectF.Left, rectF.Bottom + 1, rectF.Left, rectF.Top + arcLength);
- borderPath.AddArc(rectF.Left, rectF.Top, arcLength, arcLength, 180f, 90f);
- borderPath.AddArc(rectF.Right - arcLength, rectF.Top, arcLength, arcLength, -90f, 90f);
- borderPath.AddLine(rectF.Right, rectF.Top + arcLength, rectF.Right, rectF.Bottom + 1);
- break;
- case PaletteDrawBorders.BottomLeftRight:
- borderPath.AddLine(rectF.Right, rectF.Top - 1, rectF.Right, rectF.Bottom - arcLength);
- borderPath.AddArc(rectF.Right - arcLength, rectF.Bottom - arcLength, arcLength, arcLength, 0f, 90f);
- borderPath.AddArc(rectF.Left, rectF.Bottom - arcLength, arcLength, arcLength, 90f, 90f);
- borderPath.AddLine(rectF.Left, rectF.Bottom - arcLength, rectF.Left, rectF.Top - 1);
- break;
- }
- }
-
- private static void CreateBorderBackPathOnlyClosed(bool middle,
- PaletteDrawBorders borders,
- GraphicsPath borderPath,
- Rectangle rect,
- int arcLength,
- int variant)
- {
- // Reduce the width and height by 1 pixel for drawing into rectangle
- rect.Width--;
- rect.Height--;
-
- // We create the path using a floating point rectangle
- RectangleF rectF = new RectangleF(rect.X, rect.Y, rect.Width, rect.Height);
-
- // If trying to get the outside edge then perform some offsetting so that
- // when converted to a region it draws nicely inside the path outline
- if (!middle)
- {
- rectF.X -= 0.25f;
- rectF.Y -= 0.25f;
- rectF.Width += 0.75f;
- rectF.Height += 0.75f;
- }
-
- // Add only the border for drawing
- switch (borders)
- {
- case PaletteDrawBorders.None:
- break;
- case PaletteDrawBorders.Top:
- case PaletteDrawBorders.Bottom:
- case PaletteDrawBorders.Left:
- case PaletteDrawBorders.Right:
- case PaletteDrawBorders.TopBottom:
- case PaletteDrawBorders.LeftRight:
- // When using the entire rectangle we do not need to adjust its size
- rect.Width++;
- rect.Height++;
- borderPath.AddRectangle(rect);
- break;
- case PaletteDrawBorders.TopLeft:
- borderPath.AddLine(rectF.Left, rectF.Bottom + 1, rectF.Left, rectF.Top + arcLength);
- borderPath.AddArc(rectF.Left, rectF.Top, arcLength, arcLength, 180f, 90f);
- borderPath.AddLine(rectF.Left + arcLength, rectF.Top, rectF.Right + 1, rectF.Top);
- borderPath.AddLine(rectF.Right, rectF.Top, rectF.Right, rectF.Bottom);
- break;
- case PaletteDrawBorders.TopRight:
- borderPath.AddLine(rectF.Left - 1, rectF.Top, rectF.Right - arcLength, rectF.Top);
- borderPath.AddArc(rectF.Right - arcLength, rectF.Top, arcLength, arcLength, -90f, 90f);
- borderPath.AddLine(rectF.Right, rectF.Top + arcLength, rectF.Right, rectF.Bottom + 1);
- borderPath.AddLine(rectF.Right, rectF.Bottom, rectF.Left, rectF.Bottom);
- break;
- case PaletteDrawBorders.BottomRight:
- borderPath.AddLine(rectF.Right, rectF.Top - 1, rectF.Right, rectF.Bottom - arcLength);
- borderPath.AddArc(rectF.Right - arcLength, rectF.Bottom - arcLength, arcLength, arcLength, 0f, 90f);
- borderPath.AddLine(rectF.Right - arcLength, rectF.Bottom, rectF.Left - 1, rectF.Bottom);
- borderPath.AddLine(rectF.Left, rectF.Bottom, rectF.Left, rectF.Top);
- break;
- case PaletteDrawBorders.BottomLeft:
- borderPath.AddLine(rectF.Right + 1, rectF.Bottom, rectF.Left + arcLength, rectF.Bottom);
- borderPath.AddArc(rectF.Left, rectF.Bottom - arcLength, arcLength, arcLength, 90f, 90f);
- borderPath.AddLine(rectF.Left, rectF.Bottom - arcLength, rectF.Left, rectF.Top - 1);
- borderPath.AddLine(rectF.Left, rectF.Top, rectF.Right, rectF.Top);
- break;
- case PaletteDrawBorders.TopBottomLeft:
- borderPath.AddLine(rectF.Right + 1, rectF.Bottom, rectF.Left + arcLength, rectF.Bottom);
- borderPath.AddArc(rectF.Left, rectF.Bottom - arcLength, arcLength, arcLength, 90f, 90f);
- borderPath.AddArc(rectF.Left, rectF.Top, arcLength, arcLength, 180f, 90f);
- borderPath.AddLine(rectF.Left + arcLength, rectF.Top, rectF.Right + 1, rectF.Top);
- break;
- case PaletteDrawBorders.TopBottomRight:
- borderPath.AddLine(rectF.Left - 1, rectF.Top, rectF.Right - arcLength, rectF.Top);
- borderPath.AddArc(rectF.Right - arcLength, rectF.Top, arcLength, arcLength, -90f, 90f);
- borderPath.AddArc(rectF.Right - arcLength, rectF.Bottom - arcLength, arcLength, arcLength, 0f, 90f);
- borderPath.AddLine(rectF.Right - arcLength, rectF.Bottom, rectF.Left - 1, rectF.Bottom);
- break;
- case PaletteDrawBorders.TopLeftRight:
- borderPath.AddLine(rectF.Left, rectF.Bottom + 1, rectF.Left, rectF.Top + arcLength);
- borderPath.AddArc(rectF.Left, rectF.Top, arcLength, arcLength, 180f, 90f);
- borderPath.AddArc(rectF.Right - arcLength, rectF.Top, arcLength, arcLength, -90f, 90f);
- borderPath.AddLine(rectF.Right, rectF.Top + arcLength, rectF.Right, rectF.Bottom + 1);
- break;
- case PaletteDrawBorders.BottomLeftRight:
- borderPath.AddLine(rectF.Right, rectF.Top - 1, rectF.Right, rectF.Bottom - arcLength);
- borderPath.AddArc(rectF.Right - arcLength, rectF.Bottom - arcLength, arcLength, arcLength, 0f, 90f);
- borderPath.AddArc(rectF.Left, rectF.Bottom - arcLength, arcLength, arcLength, 90f, 90f);
- borderPath.AddLine(rectF.Left, rectF.Bottom - arcLength, rectF.Left, rectF.Top - 1);
- break;
- }
- }
-
- private static void CreateBorderBackPathComplete(bool middle,
- PaletteDrawBorders borders,
- GraphicsPath borderPath,
- Rectangle rect,
- int arcLength)
- {
- // We create the path using a floating point rectangle
- RectangleF rectF = new RectangleF(rect.X, rect.Y, rect.Width, rect.Height);
-
- // If trying to get the outside edge then perform some offsetting so that
- // when converted to a region it draws nicely inside the path outline
- if (!middle)
- {
- rectF.X -= 0.25f;
- rectF.Y -= 0.25f;
- rectF.Width += 0.75f;
- rectF.Height += 0.75f;
- }
- // Define area that covers the border and the inside
- switch (borders)
- {
- case PaletteDrawBorders.None:
- case PaletteDrawBorders.Top:
- case PaletteDrawBorders.Bottom:
- case PaletteDrawBorders.Left:
- case PaletteDrawBorders.Right:
- case PaletteDrawBorders.TopBottom:
- case PaletteDrawBorders.LeftRight:
- // Just add a simple rectangle as a quick way of adding four lines
- borderPath.AddRectangle(rect);
- break;
- case PaletteDrawBorders.TopLeft:
- borderPath.AddLine(rectF.Left, rectF.Bottom, rectF.Left, rectF.Top + arcLength);
- borderPath.AddArc(rectF.Left, rectF.Top, arcLength, arcLength, 180f, 90f);
- borderPath.AddLine(rectF.Left + arcLength, rectF.Top, rectF.Right, rectF.Top);
- borderPath.AddLine(rectF.Right, rectF.Top, rectF.Right, rectF.Bottom);
- borderPath.AddLine(rectF.Right, rectF.Bottom, rectF.Left, rectF.Bottom);
- break;
- case PaletteDrawBorders.TopRight:
- borderPath.AddLine(rectF.Left, rectF.Top, rectF.Right - arcLength, rectF.Top);
- borderPath.AddArc(rectF.Right - arcLength, rectF.Top, arcLength, arcLength, -90f, 90f);
- borderPath.AddLine(rectF.Right, rectF.Top + arcLength, rectF.Right, rectF.Bottom);
- borderPath.AddLine(rectF.Right, rectF.Bottom, rectF.Left, rectF.Bottom);
- borderPath.AddLine(rectF.Left, rectF.Bottom, rectF.Left, rectF.Top);
- break;
- case PaletteDrawBorders.BottomRight:
- // Reduce the width and height by 1 pixel for drawing into rectFangle
- rectF.Width -= 1;
- rectF.Height -= 1;
-
- borderPath.AddLine(rectF.Right, rectF.Top, rectF.Right, rectF.Bottom - arcLength);
- borderPath.AddArc(rectF.Right - arcLength, rectF.Bottom - arcLength, arcLength, arcLength, 0f, 90f);
- borderPath.AddLine(rectF.Right - arcLength, rectF.Bottom, rectF.Left, rectF.Bottom);
- borderPath.AddLine(rectF.Left, rectF.Bottom, rectF.Left, rectF.Top);
- borderPath.AddLine(rectF.Left, rectF.Top, rectF.Right, rectF.Top);
- break;
- case PaletteDrawBorders.BottomLeft:
- // Reduce the width and height by 1 pixel for drawing into rectangle
- rectF.X++;
- rectF.Width -= 1;
- rectF.Height -= 1;
-
- borderPath.AddLine(rectF.Right, rectF.Bottom, rectF.Left + arcLength, rectF.Bottom);
- borderPath.AddArc(rectF.Left, rectF.Bottom - arcLength, arcLength, arcLength, 90f, 90f);
- borderPath.AddLine(rectF.Left, rectF.Bottom - arcLength, rectF.Left, rectF.Top);
- borderPath.AddLine(rectF.Left, rectF.Top, rectF.Right, rectF.Top);
- borderPath.AddLine(rectF.Right, rectF.Top, rectF.Right, rectF.Bottom);
- break;
- case PaletteDrawBorders.TopBottomLeft:
- borderPath.AddLine(rectF.Right, rectF.Bottom, rectF.Left + arcLength, rectF.Bottom);
- borderPath.AddArc(rectF.Left, rectF.Bottom - arcLength, arcLength, arcLength, 90f, 90f);
- borderPath.AddArc(rectF.Left, rectF.Top, arcLength, arcLength, 180f, 90f);
- borderPath.AddLine(rectF.Left + arcLength, rectF.Top, rectF.Right, rectF.Top);
- borderPath.AddLine(rectF.Right, rectF.Top, rectF.Right, rectF.Bottom);
- break;
- case PaletteDrawBorders.TopBottomRight:
- // Reduce the width and height by 1 pixel for drawing into rectangle
- rectF.Width -= 1;
- rectF.Height -= 1;
-
- borderPath.AddLine(rectF.Left, rectF.Top, rectF.Right - arcLength, rectF.Top);
- borderPath.AddArc(rectF.Right - arcLength, rectF.Top, arcLength, arcLength, -90f, 90f);
- borderPath.AddArc(rectF.Right - arcLength, rectF.Bottom - arcLength, arcLength, arcLength, 0f, 90f);
- borderPath.AddLine(rectF.Right - arcLength, rectF.Bottom, rectF.Left, rectF.Bottom);
- borderPath.AddLine(rectF.Left, rectF.Bottom, rectF.Left, rectF.Top);
- break;
- case PaletteDrawBorders.TopLeftRight:
- borderPath.AddLine(rectF.Left, rectF.Bottom, rectF.Left, rectF.Top + arcLength);
- borderPath.AddArc(rectF.Left, rectF.Top, arcLength, arcLength, 180f, 90f);
- borderPath.AddArc(rectF.Right - arcLength, rectF.Top, arcLength, arcLength, -90f, 90f);
- borderPath.AddLine(rectF.Right, rectF.Top + arcLength, rectF.Right, rectF.Bottom);
- borderPath.AddLine(rectF.Right, rectF.Bottom, rectF.Left, rectF.Bottom);
- break;
- case PaletteDrawBorders.BottomLeftRight:
- // Reduce the width and height by 1 pixel for drawing into rectangle
- rectF.X++;
- rectF.Width -= 1;
- rectF.Height -= 1;
-
- borderPath.AddLine(rectF.Right, rectF.Top, rectF.Right, rectF.Bottom - arcLength);
- borderPath.AddArc(rectF.Right - arcLength, rectF.Bottom - arcLength, arcLength, arcLength, 0f, 90f);
- borderPath.AddArc(rectF.Left, rectF.Bottom - arcLength, arcLength, arcLength, 90f, 90f);
- borderPath.AddLine(rectF.Left, rectF.Top, rectF.Right, rectF.Top);
- break;
- }
- }
-
- private static GraphicsPath CreateTabBorderBackPath(RightToLeft rtl,
- PaletteState state,
- bool forBorder,
- Rectangle rect,
- int borderWidth,
- TabBorderStyle tabBorderStyle,
- VisualOrientation orientation,
- bool smoothing)
- {
- GraphicsPath borderPath = new GraphicsPath();
-
- // A zero size rectangle cannot be drawn, so return a null path
- if ((rect.Width > 0) && (rect.Height > 0))
- {
- // Shrink the rect by half the width of the pen, because the pen will
- // draw half the distance overlapping each side of the centre anyway.
- int halfBorderWidth = borderWidth / 2;
-
- // Adjust rectangle for all except the bottom edges
- rect.Width -= (halfBorderWidth * 2);
- rect.Height -= halfBorderWidth;
- rect.X += halfBorderWidth;
- rect.Y += halfBorderWidth;
-
- // Populate the graphics path for the border style
- CreateTabBorderPath((rtl == RightToLeft.Yes), state, forBorder,
- borderPath, rect, tabBorderStyle, orientation);
- }
-
- return borderPath;
- }
-
- private static void CreateTabBorderPath(bool rtl,
- PaletteState state,
- bool forBorder,
- GraphicsPath borderPath,
- Rectangle rect,
- TabBorderStyle tabBorderStyle,
- VisualOrientation orientation)
- {
- // Correct drawing by reducing drawing rectangle
- switch (orientation)
- {
- case VisualOrientation.Top:
- rect.Width--;
- break;
- case VisualOrientation.Bottom:
- rect.Y--;
- rect.Width--;
- break;
- case VisualOrientation.Left:
- rect.Height--;
- break;
- case VisualOrientation.Right:
- rect.X--;
- rect.Height--;
- break;
- }
-
- // Add only the border for drawing
- switch (tabBorderStyle)
- {
- case TabBorderStyle.DockEqual:
- case TabBorderStyle.SquareEqualSmall:
- case TabBorderStyle.SquareEqualMedium:
- case TabBorderStyle.SquareEqualLarge:
- AddSquarePath(borderPath, orientation, rect, forBorder);
- break;
- case TabBorderStyle.DockOutsize:
- case TabBorderStyle.SquareOutsizeSmall:
- case TabBorderStyle.SquareOutsizeMedium:
- case TabBorderStyle.SquareOutsizeLarge:
- rect = AdjustOutsizeTab(state, rect, orientation);
- AddSquarePath(borderPath, orientation, rect, forBorder);
- break;
- case TabBorderStyle.RoundedEqualSmall:
- case TabBorderStyle.RoundedEqualMedium:
- case TabBorderStyle.RoundedEqualLarge:
- AddRoundedPath(borderPath, orientation, rect, forBorder);
- break;
- case TabBorderStyle.RoundedOutsizeSmall:
- case TabBorderStyle.RoundedOutsizeMedium:
- case TabBorderStyle.RoundedOutsizeLarge:
- rect = AdjustOutsizeTab(state, rect, orientation);
- AddRoundedPath(borderPath, orientation, rect, forBorder);
- break;
- case TabBorderStyle.SlantEqualNear:
- case TabBorderStyle.SlantOutsizeNear:
- if (tabBorderStyle == TabBorderStyle.SlantOutsizeNear)
- {
- rect = AdjustOutsizeTab(state, rect, orientation);
- }
-
- if (rtl && ((orientation == VisualOrientation.Top) || (orientation == VisualOrientation.Bottom)))
- {
- AddSlantFarPath(borderPath, orientation, rect, forBorder);
- }
- else
- {
- AddSlantNearPath(borderPath, orientation, rect, forBorder);
- }
-
- break;
- case TabBorderStyle.SlantEqualFar:
- case TabBorderStyle.SlantOutsizeFar:
- if (tabBorderStyle == TabBorderStyle.SlantOutsizeFar)
- {
- rect = AdjustOutsizeTab(state, rect, orientation);
- }
-
- if (rtl && ((orientation == VisualOrientation.Top) || (orientation == VisualOrientation.Bottom)))
- {
- AddSlantNearPath(borderPath, orientation, rect, forBorder);
- }
- else
- {
- AddSlantFarPath(borderPath, orientation, rect, forBorder);
- }
-
- break;
- case TabBorderStyle.SlantEqualBoth:
- case TabBorderStyle.SlantOutsizeBoth:
- if (tabBorderStyle == TabBorderStyle.SlantOutsizeBoth)
- {
- rect = AdjustOutsizeTab(state, rect, orientation);
- }
-
- AddSlantBothPath(borderPath, orientation, rect, forBorder);
- break;
- case TabBorderStyle.OneNote:
- // Is the current tab selected?
- bool selected = (state == PaletteState.CheckedNormal) ||
- (state == PaletteState.CheckedPressed) ||
- (state == PaletteState.CheckedTracking);
-
- // The right padding depends on the selected state
- int rp = (selected ? SPACING_TAB_ONE_NOTE_RPS : SPACING_TAB_ONE_NOTE_RPI);
-
- // If not selected then need to make the tab shorter
- if (!selected)
- {
- rect = AdjustOneNoteTab(rect, orientation);
- }
-
- if (rtl && ((orientation == VisualOrientation.Top) || (orientation == VisualOrientation.Bottom)))
- {
- AddOneNoteReversePath(borderPath, orientation, rect, forBorder, rp);
- }
- else
- {
- AddOneNotePath(borderPath, orientation, rect, forBorder, rp);
- }
-
- break;
- case TabBorderStyle.SmoothEqual:
- case TabBorderStyle.SmoothOutsize:
- // Adjust the outsize tab variant
- if (tabBorderStyle == TabBorderStyle.SmoothOutsize)
- {
- rect = AdjustSmoothTab(state, rect, orientation);
- }
-
- AddSmoothPath(borderPath, orientation, rect, forBorder);
- break;
- default:
- // Should never happen!
- Debug.Assert(false);
- break;
- }
- }
-
- private static Rectangle AdjustOutsizeTab(PaletteState state,
- Rectangle rect,
- VisualOrientation orientation)
- {
- // We alter the size of the tab drawn depending on the state
- switch (state)
- {
- case PaletteState.CheckedNormal:
- case PaletteState.CheckedPressed:
- case PaletteState.CheckedTracking:
- break;
- default:
- // Reduce the tab except on the connected edge
- switch (orientation)
- {
- case VisualOrientation.Top:
- rect.Height -= 2;
- rect.Width -= 4;
- rect.X += 2;
- rect.Y += 2;
- break;
- case VisualOrientation.Bottom:
- rect.Height -= 2;
- rect.Width -= 4;
- rect.X += 2;
- break;
- case VisualOrientation.Left:
- rect.Height -= 4;
- rect.Width -= 2;
- rect.X += 2;
- rect.Y += 2;
- break;
- case VisualOrientation.Right:
- rect.Height -= 4;
- rect.Width -= 2;
- rect.Y += 2;
- break;
- }
- break;
- }
-
- return rect;
- }
-
- private static Rectangle AdjustOneNoteTab(Rectangle rect,
- VisualOrientation orientation)
- {
- // Reduce the height of the tab
- switch (orientation)
- {
- case VisualOrientation.Top:
- rect.Height -= SPACING_TAB_ONE_NOTE_TPI;
- rect.Y += SPACING_TAB_ONE_NOTE_TPI;
- break;
- case VisualOrientation.Bottom:
- rect.Height -= SPACING_TAB_ONE_NOTE_TPI;
- break;
- case VisualOrientation.Left:
- rect.Width -= SPACING_TAB_ONE_NOTE_TPI;
- rect.X += SPACING_TAB_ONE_NOTE_TPI;
- break;
- case VisualOrientation.Right:
- rect.Width -= SPACING_TAB_ONE_NOTE_TPI;
- break;
- }
-
- return rect;
- }
-
- private static Rectangle AdjustSmoothTab(PaletteState state,
- Rectangle rect,
- VisualOrientation orientation)
- {
- // We alter the size of the tab drawn depending on the state
- switch (state)
- {
- case PaletteState.CheckedNormal:
- case PaletteState.CheckedPressed:
- case PaletteState.CheckedTracking:
- break;
- default:
- // Reduce the tab except on the connected edge
- switch (orientation)
- {
- case VisualOrientation.Top:
- rect.Height -= 4;
- rect.Width -= 8;
- rect.X += 4;
- rect.Y += 4;
- break;
- case VisualOrientation.Bottom:
- rect.Height -= 4;
- rect.Width -= 8;
- rect.X += 4;
- break;
- case VisualOrientation.Left:
- rect.Height -= 8;
- rect.Width -= 4;
- rect.X += 4;
- rect.Y += 4;
- break;
- case VisualOrientation.Right:
- rect.Height -= 8;
- rect.Width -= 4;
- rect.Y += 4;
- break;
- }
- break;
- }
-
- return rect;
- }
-
- private static void AddSquarePath(GraphicsPath borderPath,
- VisualOrientation orientation,
- Rectangle rect,
- bool forBorder)
- {
- switch (orientation)
- {
- case VisualOrientation.Top:
- if (!forBorder)
- {
- borderPath.AddLine(rect.Right, rect.Bottom, rect.Left, rect.Bottom);
- }
-
- borderPath.AddLine(rect.Left, rect.Bottom, rect.Left, rect.Top);
- borderPath.AddLine(rect.Left, rect.Top, rect.Right, rect.Top);
- borderPath.AddLine(rect.Right, rect.Top, rect.Right, rect.Bottom);
- break;
- case VisualOrientation.Bottom:
- if (!forBorder)
- {
- borderPath.AddLine(rect.Right, rect.Top, rect.Left, rect.Top);
- }
-
- borderPath.AddLine(rect.Left, rect.Top, rect.Left, rect.Bottom);
- borderPath.AddLine(rect.Left, rect.Bottom, rect.Right, rect.Bottom);
- borderPath.AddLine(rect.Right, rect.Bottom, rect.Right, rect.Top);
- break;
- case VisualOrientation.Left:
- if (!forBorder)
- {
- borderPath.AddLine(rect.Right, rect.Top, rect.Right, rect.Bottom);
- }
-
- borderPath.AddLine(rect.Right, rect.Bottom, rect.Left, rect.Bottom);
- borderPath.AddLine(rect.Left, rect.Bottom, rect.Left, rect.Top);
- borderPath.AddLine(rect.Left, rect.Top, rect.Right, rect.Top);
- break;
- case VisualOrientation.Right:
- if (!forBorder)
- {
- borderPath.AddLine(rect.Left, rect.Top, rect.Left, rect.Bottom);
- }
-
- borderPath.AddLine(rect.Left, rect.Bottom, rect.Right, rect.Bottom);
- borderPath.AddLine(rect.Right, rect.Bottom, rect.Right, rect.Top);
- borderPath.AddLine(rect.Right, rect.Top, rect.Left, rect.Top);
- break;
- }
- }
-
- private static void AddRoundedPath(GraphicsPath borderPath,
- VisualOrientation orientation,
- Rectangle rect,
- bool forBorder)
- {
- // Cache the distance to make the corner rounded
- int x = SPACING_TAB_ROUNDED_CORNER;
-
- switch (orientation)
- {
- case VisualOrientation.Top:
- if (!forBorder)
- {
- borderPath.AddLine(rect.Right, rect.Bottom, rect.Left, rect.Bottom);
- }
-
- borderPath.AddLine(rect.Left, rect.Bottom, rect.Left, rect.Top + x);
- borderPath.AddLine(rect.Left, rect.Top + x, rect.Left + x, rect.Top);
- borderPath.AddLine(rect.Left + x, rect.Top, rect.Right - x, rect.Top);
- borderPath.AddLine(rect.Right - x, rect.Top, rect.Right, rect.Top + x);
- borderPath.AddLine(rect.Right, rect.Top + x, rect.Right, rect.Bottom);
- break;
- case VisualOrientation.Bottom:
- if (!forBorder)
- {
- borderPath.AddLine(rect.Right, rect.Top, rect.Left, rect.Top);
- }
-
- borderPath.AddLine(rect.Left, rect.Top, rect.Left, rect.Bottom - x);
- borderPath.AddLine(rect.Left, rect.Bottom - x, rect.Left + x, rect.Bottom);
- borderPath.AddLine(rect.Left + x, rect.Bottom, rect.Right - x, rect.Bottom);
- borderPath.AddLine(rect.Right - x, rect.Bottom, rect.Right, rect.Bottom - x);
- borderPath.AddLine(rect.Right, rect.Bottom - x, rect.Right, rect.Top);
- break;
- case VisualOrientation.Left:
- if (!forBorder)
- {
- borderPath.AddLine(rect.Right, rect.Top, rect.Right, rect.Bottom);
- }
-
- borderPath.AddLine(rect.Right, rect.Bottom, rect.Left + x, rect.Bottom);
- borderPath.AddLine(rect.Left + x, rect.Bottom, rect.Left, rect.Bottom - x);
- borderPath.AddLine(rect.Left, rect.Bottom - x, rect.Left, rect.Top + x);
- borderPath.AddLine(rect.Left, rect.Top + x, rect.Left + x, rect.Top);
- borderPath.AddLine(rect.Left + x, rect.Top, rect.Right, rect.Top);
- break;
- case VisualOrientation.Right:
- if (!forBorder)
- {
- borderPath.AddLine(rect.Left, rect.Top, rect.Left, rect.Bottom);
- }
-
- borderPath.AddLine(rect.Left, rect.Bottom, rect.Right - x, rect.Bottom);
- borderPath.AddLine(rect.Right - x, rect.Bottom, rect.Right, rect.Bottom - x);
- borderPath.AddLine(rect.Right, rect.Bottom - x, rect.Right, rect.Top + x);
- borderPath.AddLine(rect.Right, rect.Top + x, rect.Right - x, rect.Top);
- borderPath.AddLine(rect.Right - x, rect.Top, rect.Left, rect.Top);
- break;
- }
- }
-
- private static void AddSlantNearPath(GraphicsPath borderPath,
- VisualOrientation orientation,
- Rectangle rect,
- bool forBorder)
- {
- // Cache the distance to use for the slant
- int x = SPACING_TAB_SLANT_PADDING;
- int xW = Math.Min(x, rect.Width);
- int xH = Math.Min(x, rect.Height);
-
- switch (orientation)
- {
- case VisualOrientation.Top:
- if (!forBorder)
- {
- borderPath.AddLine(rect.Right, rect.Bottom, rect.Left, rect.Bottom);
- }
-
- borderPath.AddLine(rect.Left - 1, rect.Bottom, rect.Left + xW, rect.Top);
- borderPath.AddLine(rect.Left + xW, rect.Top, rect.Right, rect.Top);
- borderPath.AddLine(rect.Right, rect.Top, rect.Right, rect.Bottom);
- break;
- case VisualOrientation.Bottom:
- if (!forBorder)
- {
- borderPath.AddLine(rect.Right, rect.Top, rect.Left, rect.Top);
- }
-
- borderPath.AddLine(rect.Left - 1, rect.Top, rect.Left + xW, rect.Bottom);
- borderPath.AddLine(rect.Left + xW, rect.Bottom, rect.Right, rect.Bottom);
- borderPath.AddLine(rect.Right, rect.Bottom, rect.Right, rect.Top);
- break;
- case VisualOrientation.Left:
- if (!forBorder)
- {
- borderPath.AddLine(rect.Right, rect.Top, rect.Right, rect.Bottom);
- }
-
- borderPath.AddLine(rect.Right, rect.Bottom, rect.Left, rect.Bottom - xH);
- borderPath.AddLine(rect.Left, rect.Bottom - xH, rect.Left, rect.Top);
- borderPath.AddLine(rect.Left, rect.Top, rect.Right, rect.Top);
- break;
- case VisualOrientation.Right:
- if (!forBorder)
- {
- borderPath.AddLine(rect.Left, rect.Top, rect.Left, rect.Bottom);
- }
-
- borderPath.AddLine(rect.Left, rect.Bottom, rect.Right, rect.Bottom - xH);
- borderPath.AddLine(rect.Right, rect.Bottom - xH, rect.Right, rect.Top);
- borderPath.AddLine(rect.Right, rect.Top, rect.Left, rect.Top);
- break;
- }
- }
-
- private static void AddSlantFarPath(GraphicsPath borderPath,
- VisualOrientation orientation,
- Rectangle rect,
- bool forBorder)
- {
- // Cache the distance to use for the slant
- int x = SPACING_TAB_SLANT_PADDING;
- int xW = Math.Min(x, rect.Width);
- int xH = Math.Min(x, rect.Height);
-
- switch (orientation)
- {
- case VisualOrientation.Top:
- if (!forBorder)
- {
- borderPath.AddLine(rect.Right, rect.Bottom, rect.Left, rect.Bottom);
- }
-
- borderPath.AddLine(rect.Left, rect.Bottom, rect.Left, rect.Top);
- borderPath.AddLine(rect.Left, rect.Top, rect.Right - xW, rect.Top);
- borderPath.AddLine(rect.Right - xW, rect.Top, rect.Right, rect.Bottom);
- break;
- case VisualOrientation.Bottom:
- if (!forBorder)
- {
- borderPath.AddLine(rect.Right, rect.Top, rect.Left, rect.Top);
- }
-
- borderPath.AddLine(rect.Left, rect.Top, rect.Left, rect.Bottom);
- borderPath.AddLine(rect.Left, rect.Bottom, rect.Right - xW, rect.Bottom);
- borderPath.AddLine(rect.Right - xW, rect.Bottom, rect.Right, rect.Top);
- break;
- case VisualOrientation.Left:
- if (!forBorder)
- {
- borderPath.AddLine(rect.Right, rect.Top, rect.Right, rect.Bottom);
- }
-
- borderPath.AddLine(rect.Right, rect.Bottom, rect.Left, rect.Bottom);
- borderPath.AddLine(rect.Left, rect.Bottom, rect.Left, rect.Top + xH);
- borderPath.AddLine(rect.Left, rect.Top + xH, rect.Right, rect.Top - 1);
- break;
- case VisualOrientation.Right:
- if (!forBorder)
- {
- borderPath.AddLine(rect.Left, rect.Top, rect.Left, rect.Bottom);
- }
-
- borderPath.AddLine(rect.Left, rect.Bottom, rect.Right, rect.Bottom);
- borderPath.AddLine(rect.Right, rect.Bottom, rect.Right, rect.Top + xH);
- borderPath.AddLine(rect.Right, rect.Top + xH, rect.Left, rect.Top - 1);
- break;
- }
- }
-
- private static void AddSlantBothPath(GraphicsPath borderPath,
- VisualOrientation orientation,
- Rectangle rect,
- bool forBorder)
- {
- // Cache the distance to use for the slant
- int x = SPACING_TAB_SLANT_PADDING;
- int xW = Math.Min(x, rect.Width / 2);
- int xH = Math.Min(x, rect.Height / 2);
-
- switch (orientation)
- {
- case VisualOrientation.Top:
- if (!forBorder)
- {
- borderPath.AddLine(rect.Right, rect.Bottom, rect.Left, rect.Bottom);
- }
-
- borderPath.AddLine(rect.Left - 1, rect.Bottom, rect.Left + xW, rect.Top);
- borderPath.AddLine(rect.Left + xW, rect.Top, rect.Right - xW, rect.Top);
- borderPath.AddLine(rect.Right - xW, rect.Top, rect.Right, rect.Bottom);
- break;
- case VisualOrientation.Bottom:
- if (!forBorder)
- {
- borderPath.AddLine(rect.Right, rect.Top, rect.Left, rect.Top);
- }
-
- borderPath.AddLine(rect.Left - 1, rect.Top, rect.Left + xW, rect.Bottom);
- borderPath.AddLine(rect.Left + xW, rect.Bottom, rect.Right - xW, rect.Bottom);
- borderPath.AddLine(rect.Right - xW, rect.Bottom, rect.Right, rect.Top);
- break;
- case VisualOrientation.Left:
- if (!forBorder)
- {
- borderPath.AddLine(rect.Right, rect.Top, rect.Right, rect.Bottom);
- }
-
- borderPath.AddLine(rect.Right, rect.Bottom, rect.Left, rect.Bottom - xH);
- borderPath.AddLine(rect.Left, rect.Bottom - xH, rect.Left, rect.Top + xH);
- borderPath.AddLine(rect.Left, rect.Top + xH, rect.Right, rect.Top - 1);
- break;
- case VisualOrientation.Right:
- if (!forBorder)
- {
- borderPath.AddLine(rect.Left, rect.Top, rect.Left, rect.Bottom);
- }
-
- borderPath.AddLine(rect.Left, rect.Bottom, rect.Right, rect.Bottom - xH);
- borderPath.AddLine(rect.Right, rect.Bottom - xH, rect.Right, rect.Top + xH);
- borderPath.AddLine(rect.Right, rect.Top + xH, rect.Left, rect.Top - 1);
- break;
- }
- }
-
- private static void AddOneNotePath(GraphicsPath borderPath,
- VisualOrientation orientation,
- Rectangle rect,
- bool forBorder,
- int rp)
- {
- int x = Math.Min(Math.Min(9, rect.Width / 2), rect.Height / 2);
- int rpW = Math.Min(rp, rect.Width / 2);
- int rpH = Math.Min(rp, rect.Height / 2);
-
- switch (orientation)
- {
- case VisualOrientation.Top:
- if (!forBorder)
- {
- borderPath.AddLine(rect.Right, rect.Bottom, rect.Left, rect.Bottom);
- }
-
- borderPath.AddLine(rect.Left, rect.Bottom, rect.Left, rect.Bottom - 1);
- borderPath.AddArc(rect.Left, rect.Top, x, x, 180f, 90f);
- borderPath.AddLine(rect.Right - rpW, rect.Top, rect.Right, rect.Bottom);
- break;
- case VisualOrientation.Bottom:
- if (!forBorder)
- {
- borderPath.AddLine(rect.Right, rect.Top, rect.Left, rect.Top);
- }
-
- borderPath.AddLine(rect.Left, rect.Top, rect.Left, rect.Top + 1);
- borderPath.AddArc(rect.Left, rect.Bottom - x, x, x, 180f, -90f);
- borderPath.AddLine(rect.Right - rpW, rect.Bottom, rect.Right, rect.Top);
- break;
- case VisualOrientation.Left:
- if (!forBorder)
- {
- borderPath.AddLine(rect.Right, rect.Bottom, rect.Right, rect.Top);
- }
-
- borderPath.AddLine(rect.Right, rect.Top, rect.Right - 1, rect.Top);
- borderPath.AddArc(rect.Left, rect.Top, x, x, -90f, -90f);
- borderPath.AddLine(rect.Left, rect.Bottom - rpH, rect.Right, rect.Bottom);
- break;
- case VisualOrientation.Right:
- if (!forBorder)
- {
- borderPath.AddLine(rect.Left, rect.Bottom, rect.Left, rect.Top);
- }
-
- borderPath.AddLine(rect.Left, rect.Top, rect.Left + 1, rect.Top);
- borderPath.AddArc(rect.Right - x, rect.Top, x, x, -90f, 90f);
- borderPath.AddLine(rect.Right, rect.Bottom - rpH, rect.Left, rect.Bottom);
- break;
- }
- }
-
- private static void AddOneNoteReversePath(GraphicsPath borderPath,
- VisualOrientation orientation,
- Rectangle rect,
- bool forBorder,
- int rp)
- {
- int x = Math.Min(Math.Min(9, rect.Width / 2), rect.Height / 2);
- int rpW = Math.Min(rp, rect.Width / 2);
-
- switch (orientation)
- {
- case VisualOrientation.Top:
- if (!forBorder)
- {
- borderPath.AddLine(rect.Left, rect.Bottom, rect.Right, rect.Bottom);
- }
-
- borderPath.AddLine(rect.Right, rect.Bottom, rect.Right, rect.Bottom - 1);
- borderPath.AddArc(rect.Right - x, rect.Top, x, x, 0f, -90f);
- borderPath.AddLine(rect.Left + rpW, rect.Top, rect.Left, rect.Bottom);
- break;
- case VisualOrientation.Bottom:
- if (!forBorder)
- {
- borderPath.AddLine(rect.Left, rect.Top, rect.Right, rect.Top);
- }
-
- borderPath.AddLine(rect.Right, rect.Top, rect.Right, rect.Top + 1);
- borderPath.AddArc(rect.Right - x, rect.Bottom - x, x, x, 0f, 90f);
- borderPath.AddLine(rect.Left + rpW, rect.Bottom, rect.Left, rect.Top);
- break;
- }
- }
-
- private static void AddSmoothPath(GraphicsPath borderPath,
- VisualOrientation orientation,
- Rectangle rect,
- bool forBorder)
- {
- // The tension of the lines depends on the width/height
- int minLength = Math.Min(rect.Width, rect.Height);
- int calcLength = Math.Min(minLength, 50);
- float tension = Math.Max(0.5f - ((0.5f / 50) * calcLength), 0.05f);
- int indentW = Math.Min(5, rect.Width / 10);
- int indentH = Math.Min(5, rect.Height / 10);
-
- switch (orientation)
- {
- case VisualOrientation.Top:
- // If there is not enough room for the rounded style then use the rounded
- if (rect.Width < 14)
- {
- AddRoundedPath(borderPath, orientation, rect, forBorder);
- }
- else
- {
- if (!forBorder)
- {
- borderPath.AddLine(rect.Right, rect.Bottom, rect.Left, rect.Bottom);
- }
-
- // Find way points along the width
- int x2T = rect.Width / 2;
- int x6T = rect.Width / 6;
-
- borderPath.AddCurve(new Point[]{new Point(rect.Left, rect.Bottom),
- new Point(rect.Left + indentW, rect.Top + 5),
- new Point(rect.Left + x6T, rect.Top + 2),
- new Point(rect.Left + x2T, rect.Top),
- new Point(rect.Right - x6T, rect.Top + 2),
- new Point(rect.Right - indentW, rect.Top + 5),
- new Point(rect.Right, rect.Bottom)}, tension);
- }
- break;
- case VisualOrientation.Bottom:
- // If there is not enough room for the rounded style then use the rounded
- if (rect.Width < 14)
- {
- AddRoundedPath(borderPath, orientation, rect, forBorder);
- }
- else
- {
- if (!forBorder)
- {
- borderPath.AddLine(rect.Right, rect.Top, rect.Left, rect.Top);
- }
-
- // Find way points along the width
- int x2B = rect.Width / 2;
- int x6B = rect.Width / 6;
-
- borderPath.AddCurve(new Point[]{new Point(rect.Left, rect.Top),
- new Point(rect.Left + indentW, rect.Bottom - 5),
- new Point(rect.Left + x6B, rect.Bottom - 2),
- new Point(rect.Left + x2B, rect.Bottom),
- new Point(rect.Right - x6B, rect.Bottom - 2),
- new Point(rect.Right - indentW, rect.Bottom - 5),
- new Point(rect.Right, rect.Top)}, tension);
- }
- break;
- case VisualOrientation.Left:
- // If there is not enough room for the rounded style then use the rounded
- if (rect.Height < 14)
- {
- AddRoundedPath(borderPath, orientation, rect, forBorder);
- }
- else
- {
- if (!forBorder)
- {
- borderPath.AddLine(rect.Right, rect.Top, rect.Right, rect.Bottom);
- }
-
- // Find way points along the width
- int y2L = rect.Height / 2;
- int y6L = rect.Height / 6;
-
- borderPath.AddCurve(new Point[]{new Point(rect.Right, rect.Bottom),
- new Point(rect.Left + 5, rect.Bottom - indentH),
- new Point(rect.Left + 2, rect.Bottom - y6L),
- new Point(rect.Left, rect.Bottom - y2L),
- new Point(rect.Left + 2, rect.Top + y6L),
- new Point(rect.Left + 5, rect.Top + indentH),
- new Point(rect.Right, rect.Top)}, tension);
- }
- break;
- case VisualOrientation.Right:
- // If there is not enough room for the rounded style then use the rounded
- if (rect.Height < 14)
- {
- AddRoundedPath(borderPath, orientation, rect, forBorder);
- }
- else
- {
- if (!forBorder)
- {
- borderPath.AddLine(rect.Left, rect.Top, rect.Left, rect.Bottom);
- }
-
- // Find way points along the width
- int y2R = rect.Height / 2;
- int y6R = rect.Height / 6;
-
- borderPath.AddCurve(new Point[]{new Point(rect.Left, rect.Bottom),
- new Point(rect.Right - 5, rect.Bottom - indentH),
- new Point(rect.Right - 2, rect.Bottom - y6R),
- new Point(rect.Right, rect.Bottom - y2R),
- new Point(rect.Right - 2, rect.Top + y6R),
- new Point(rect.Right - 5, rect.Top + indentH),
- new Point(rect.Left, rect.Top)}, tension);
- }
- break;
- }
- }
-
- private static bool ShouldDrawImage(Image image)
- {
- return (image != null);
- }
-
- private static Brush CreateColorBrush(Rectangle rect,
- Color color1,
- Color color2,
- PaletteColorStyle gradientStyle,
- float angle,
- VisualOrientation orientation)
- {
- // Should never provide the inherit value
- Debug.Assert(gradientStyle != PaletteColorStyle.Inherit);
-
- // If the gradient style is a solid colour
- if (gradientStyle == PaletteColorStyle.Solid)
- {
- return new SolidBrush(color1);
- }
- else
- {
- // Adjust angle for the orientation
- switch (orientation)
- {
- case VisualOrientation.Left:
- angle -= 90;
- break;
- case VisualOrientation.Right:
- angle += 90;
- break;
- case VisualOrientation.Bottom:
- angle += 180;
- break;
- }
-
- // For OneNote we always use white as the first color
- if (gradientStyle == PaletteColorStyle.OneNote)
- {
- color1 = Color.White;
- }
-
- // Otherwise we always create a linear brush using provided colors and angle
- LinearGradientBrush brush = new LinearGradientBrush(rect, color1, color2, angle);
-
- switch (gradientStyle)
- {
- case PaletteColorStyle.Sigma:
- brush.SetSigmaBellShape(0.5f);
- break;
- case PaletteColorStyle.Rounded:
- brush.SetSigmaBellShape(1f, 1f);
- break;
- case PaletteColorStyle.Switch25:
- brush.Blend = _switch25Blend;
- break;
- case PaletteColorStyle.Switch33:
- brush.Blend = _switch33Blend;
- break;
- case PaletteColorStyle.Switch50:
- brush.Blend = _switch50Blend;
- break;
- case PaletteColorStyle.Switch90:
- brush.Blend = _switch90Blend;
- break;
- case PaletteColorStyle.Linear25:
- brush.Blend = _linear25Blend;
- break;
- case PaletteColorStyle.Linear33:
- brush.Blend = _linear33Blend;
- break;
- case PaletteColorStyle.Linear40:
- brush.Blend = _linear40Blend;
- break;
- case PaletteColorStyle.Linear50:
- brush.Blend = _linear50Blend;
- break;
- case PaletteColorStyle.HalfCut:
- brush.Blend = _halfCutBlend;
- break;
- case PaletteColorStyle.QuarterPhase:
- brush.Blend = _quarterPhaseBlend;
- break;
- case PaletteColorStyle.OneNote:
- brush.Blend = _oneNoteBlend;
- break;
- case PaletteColorStyle.Rounding2:
- brush.Blend = _rounding2Blend;
- break;
- case PaletteColorStyle.Rounding3:
- brush.Blend = _rounding3Blend;
- break;
- case PaletteColorStyle.Rounding4:
- brush.Blend = _rounding4Blend;
- break;
- case PaletteColorStyle.Rounding5:
- brush.Blend = _rounding5Blend;
- break;
- }
-
- return brush;
- }
- }
-
- private static Brush CreateImageBrush(Rectangle rect,
- Image image,
- PaletteImageStyle imageStyle)
- {
- // Create brush based on the provided image
- TextureBrush brush = new TextureBrush(image);
-
- // Create appropriate wrapping mode from image style
- switch (imageStyle)
- {
- case PaletteImageStyle.TopLeft:
- brush.WrapMode = WrapMode.Clamp;
- brush.TranslateTransform(rect.Left, rect.Top);
- break;
- case PaletteImageStyle.TopMiddle:
- brush.WrapMode = WrapMode.Clamp;
- brush.TranslateTransform(rect.Left + ((rect.Width - image.Width) / 2), rect.Top);
- break;
- case PaletteImageStyle.TopRight:
- brush.WrapMode = WrapMode.Clamp;
- brush.TranslateTransform(rect.Right - image.Width, rect.Top);
- break;
- case PaletteImageStyle.CenterLeft:
- brush.WrapMode = WrapMode.Clamp;
- brush.TranslateTransform(rect.Left, rect.Top + ((rect.Height - image.Height) / 2));
- break;
- case PaletteImageStyle.CenterMiddle:
- brush.WrapMode = WrapMode.Clamp;
- brush.TranslateTransform(rect.Left + ((rect.Width - image.Width) / 2), rect.Top + ((rect.Height - image.Height) / 2));
- break;
- case PaletteImageStyle.CenterRight:
- brush.WrapMode = WrapMode.Clamp;
- brush.TranslateTransform(rect.Right - image.Width, rect.Top + ((rect.Height - image.Height) / 2));
- break;
- case PaletteImageStyle.BottomLeft:
- brush.WrapMode = WrapMode.Clamp;
- brush.TranslateTransform(rect.Left, rect.Bottom - image.Height);
- break;
- case PaletteImageStyle.BottomMiddle:
- brush.WrapMode = WrapMode.Clamp;
- brush.TranslateTransform(rect.Left + ((rect.Width - image.Width) / 2), rect.Bottom - image.Height);
- break;
- case PaletteImageStyle.BottomRight:
- brush.WrapMode = WrapMode.Clamp;
- brush.TranslateTransform(rect.Right - image.Width, rect.Bottom - image.Height);
- break;
- case PaletteImageStyle.Stretch:
- brush.WrapMode = WrapMode.Clamp;
- brush.TranslateTransform(rect.Left, rect.Top);
- brush.ScaleTransform((float)rect.Width / (float)image.Width, (float)rect.Height / (float)image.Height);
- break;
- case PaletteImageStyle.Tile:
- brush.WrapMode = WrapMode.Tile;
- brush.TranslateTransform(rect.Left, rect.Top);
- break;
- case PaletteImageStyle.TileFlipX:
- brush.WrapMode = WrapMode.TileFlipX;
- brush.TranslateTransform(rect.Left, rect.Top);
- break;
- case PaletteImageStyle.TileFlipY:
- brush.WrapMode = WrapMode.TileFlipY;
- brush.TranslateTransform(rect.Left, rect.Top);
- break;
- case PaletteImageStyle.TileFlipXY:
- brush.WrapMode = WrapMode.TileFlipXY;
- brush.TranslateTransform(rect.Left, rect.Top);
- break;
- default:
- // Should never happen!
- Debug.Assert(false);
- throw new ArgumentOutOfRangeException(nameof(imageStyle));
- }
-
- return brush;
- }
-
- private void DrawBackSolidInside(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle gradientRect,
- Color backColor1,
- Color backColor2,
- GraphicsPath path)
- {
- // Clip to prevent drawing outside the path
- using (Clipping clip = new Clipping(context.Graphics, path))
- {
- // Get the rectangle that encloses the path
- RectangleF rectF = path.GetBounds();
-
- // Convert to a pixel aligned rectangle
- Rectangle rect;
-
- // Do we have any non-integeer numbers to convert
- if ((Math.Round(rectF.X) != rectF.X) ||
- (Math.Round(rectF.Y) != rectF.Y) ||
- (Math.Round(rectF.Width) != rectF.Width) ||
- (Math.Round(rectF.Height) != rectF.Height))
- {
- int x = (int)Math.Round(rectF.X);
- int y = (int)Math.Round(rectF.Y);
- int width = (int)Math.Round(rectF.Width + 1 + (rectF.X - x));
- int height = (int)Math.Round(rectF.Height + 1 + (rectF.Y - y));
- rect = new Rectangle(x, y, width, height);
- }
- else
- {
- rect = new Rectangle((int)rectF.X, (int)rectF.Y, (int)rectF.Width, (int)rectF.Height);
- }
-
- using (Brush backBrush1 = CreateColorBrush(gradientRect, backColor1, backColor1, PaletteColorStyle.Solid, 0f, VisualOrientation.Top),
- backBrush2 = CreateColorBrush(gradientRect, backColor2, backColor2, PaletteColorStyle.Solid, 0f, VisualOrientation.Top))
- {
- // Draw the first color over the entire area
- context.Graphics.FillRectangle(backBrush1, rect);
-
- // Draw the second color on the inside of the area
- rect.Inflate(-2, -2);
- context.Graphics.FillRectangle(backBrush2, rect);
-
- // Draw the first color inside the rest of the area
- rect.Inflate(-1, -1);
- context.Graphics.FillRectangle(backBrush1, rect);
- }
- }
- }
-
- private void DrawBackOneNote(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle gradientRect,
- Color backColor1,
- Color backColor2,
- PaletteColorStyle backColorStyle,
- float backColorAngle,
- VisualOrientation orientation,
- GraphicsPath path)
- {
- // Draw entire background in first color
- using (Brush backBrush = CreateColorBrush(gradientRect,
- backColor1,
- backColor1,
- backColorStyle,
- backColorAngle,
- orientation))
- {
- context.Graphics.FillPath(backBrush, path);
- }
-
- // Make a copy of the original path, so we can change it
- GraphicsPath insetPath = (GraphicsPath)path.Clone();
-
- // Offset by 1.5 pixels so the background shows around two of
- // the edges of the background we are about to draw
- switch (orientation)
- {
- case VisualOrientation.Top:
- insetPath.Transform(new Matrix(1, 0, 0, 1, 1.5f, 1.5f));
- break;
- case VisualOrientation.Bottom:
- case VisualOrientation.Left:
- insetPath.Transform(new Matrix(1, 0, 0, 1, 1.5f, -1.5f));
- break;
- case VisualOrientation.Right:
- insetPath.Transform(new Matrix(1, 0, 0, 1, -1.5f, 1.5f));
- break;
- }
-
- using (Clipping clip = new Clipping(context.Graphics, path))
- {
- // Draw the second color as the offset background
- using (Brush backBrush = CreateColorBrush(gradientRect,
- backColor2,
- backColor2,
- backColorStyle,
- backColorAngle,
- orientation))
- {
- context.Graphics.FillPath(backBrush, insetPath);
- }
- }
-
- // Dispose of created resources
- insetPath.Dispose();
- }
-
- private void DrawBackSolidLine(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- Color backColor1,
- Color backColor2,
- PaletteColorStyle style,
- GraphicsPath path)
- {
- using (Clipping clip = new Clipping(context.Graphics, path))
- {
- // Draw entire background in second color
- using (SolidBrush brushColor2 = new SolidBrush(backColor2))
- {
- context.Graphics.FillRectangle(brushColor2, rect);
- }
-
- // Reduce area by edge(s) we want to leave alone
- switch (style)
- {
- case PaletteColorStyle.SolidTopLine:
- rect.Y++;
- rect.Height--;
- break;
- case PaletteColorStyle.SolidBottomLine:
- rect.Height--;
- break;
- case PaletteColorStyle.SolidLeftLine:
- rect.X++;
- rect.Width--;
- break;
- case PaletteColorStyle.SolidRightLine:
- rect.Width--;
- break;
- case PaletteColorStyle.SolidAllLine:
- rect.X++;
- rect.Y++;
- rect.Width -= 2;
- rect.Height -= 2;
- break;
- }
-
- // Draw the second color as a solid block
- using (SolidBrush brushColor2 = new SolidBrush(backColor1))
- {
- context.Graphics.FillRectangle(brushColor2, rect);
- }
- }
- }
-
- private void DrawBackRoundedTopLeftWhite(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- Rectangle gradientRect,
- Color backColor1,
- Color backColor2,
- PaletteColorStyle backColorStyle,
- float backColorAngle,
- VisualOrientation orientation,
- GraphicsPath path)
- {
- using (Clipping clip = new Clipping(context.Graphics, path))
- {
- // Draw entire background in white
- context.Graphics.FillRectangle(Brushes.White, rect);
-
- // Offset the drawing rectangle for the top and left
- rect.X++;
- rect.Y++;
-
- // Size is smaller in both directions because of offseting
- rect.Width--;
- rect.Height--;
-
- // Draw the second color as the offset background
- using (Brush backBrush = CreateColorBrush(gradientRect,
- backColor1,
- backColor2,
- PaletteColorStyle.Rounded,
- backColorAngle,
- orientation))
- {
- context.Graphics.FillRectangle(backBrush, rect);
- }
- }
- }
-
- private void DrawBackRoundedTopLight(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- Rectangle gradientRect,
- Color backColor1,
- Color backColor2,
- PaletteColorStyle backColorStyle,
- float backColorAngle,
- VisualOrientation orientation,
- GraphicsPath path)
- {
- using (Clipping clip = new Clipping(context.Graphics, path))
- {
- // Draw entire background in white
- using (SolidBrush lightBrush = new SolidBrush(ControlPaint.LightLight(backColor1)))
- {
- context.Graphics.FillRectangle(lightBrush, rect);
- }
-
- // Offset the drawing rectangle depending on the orientation
- switch (orientation)
- {
- case VisualOrientation.Top:
- rect.Y++;
- rect.Height--;
- break;
- case VisualOrientation.Bottom:
- rect.Height--;
- break;
- case VisualOrientation.Left:
- rect.X++;
- rect.Width--;
- break;
- case VisualOrientation.Right:
- rect.Width--;
- break;
- }
-
- // Draw the second color as the offset background
- using (Brush backBrush = CreateColorBrush(gradientRect,
- backColor1,
- backColor2,
- PaletteColorStyle.Rounded,
- backColorAngle,
- orientation))
- {
- context.Graphics.FillRectangle(backBrush, rect);
- }
- }
- }
-
- private void DrawBackRounded4(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- Rectangle gradientRect,
- Color backColor1,
- Color backColor2,
- PaletteColorStyle backColorStyle,
- float backColorAngle,
- VisualOrientation orientation,
- GraphicsPath path)
- {
- using (Clipping clip = new Clipping(context.Graphics, path))
- {
- // Use standard helper routine to create appropriate color brush
- using (Brush backBrush = CreateColorBrush(gradientRect, backColor1, backColor2,
- backColorStyle, backColorAngle, orientation))
- {
- context.Graphics.FillPath(backBrush, path);
- }
-
- using (Pen linePen = new Pen(backColor1))
- {
- // Adjust angle for the orientation
- switch (orientation)
- {
- case VisualOrientation.Left:
- context.Graphics.DrawLine(linePen, rect.Right - 1, rect.Top, rect.Right - 1, rect.Bottom - 1);
- break;
- case VisualOrientation.Right:
- context.Graphics.DrawLine(linePen, rect.Left, rect.Top, rect.Left, rect.Bottom - 1);
- break;
- case VisualOrientation.Bottom:
- context.Graphics.DrawLine(linePen, rect.Left, rect.Top, rect.Right - 1, rect.Top);
- break;
- case VisualOrientation.Top:
- context.Graphics.DrawLine(linePen, rect.Left, rect.Bottom - 1, rect.Right - 1, rect.Bottom - 1);
- break;
- }
- }
- }
- }
-
- private void DrawBackRounding5(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- Rectangle gradientRect,
- Color backColor1,
- Color backColor2,
- PaletteColorStyle backColorStyle,
- float backColorAngle,
- VisualOrientation orientation,
- GraphicsPath path)
- {
- // We want to ignore the ourside pixel edge, so inflate inwards
- rect.Inflate(-1, -1);
-
- // Prevent drawing over that ourside edge
- using (Clipping clip = new Clipping(context.Graphics, rect))
- {
- // Use standard helper routine to create appropriate color brush
- using (Brush backBrush = CreateColorBrush(gradientRect, backColor1, backColor2,
- PaletteColorStyle.Rounding5, backColorAngle,
- orientation))
- {
- context.Graphics.FillPath(backBrush, path);
- }
- }
- }
-
- private void DrawBackLinearShadow(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- Rectangle gradientRect,
- Color backColor1,
- Color backColor2,
- PaletteColorStyle backColorStyle,
- float backColorAngle,
- VisualOrientation orientation,
- GraphicsPath path)
- {
- // Prevent drawing over that ourside edge
- using (Clipping clip = new Clipping(context.Graphics, rect))
- {
- // Use standard helper routine to create appropriate color brush
- using (Brush backBrush = CreateColorBrush(gradientRect, backColor1, backColor2,
- PaletteColorStyle.Linear, backColorAngle,
- orientation))
- {
- context.Graphics.FillPath(backBrush, path);
- }
-
- // Use path gradient to give the outside of the area a shadow effect
- using (PathGradientBrush borderBrush = new PathGradientBrush(path))
- {
- borderBrush.Blend = _linearShadowBlend;
- borderBrush.CenterColor = backColor1;
- borderBrush.SurroundColors = new Color[] { backColor2 };
- context.Graphics.FillPath(borderBrush, path);
- }
- }
- }
- #endregion
-
- #region Implementation Content
-
- private static Padding ContentPaddingForButtonForm(Padding original,
- ViewLayoutContext context,
- int allocatedHeight)
- {
- // Get the krypton form that contains this control
- KryptonForm kryptonForm = OwningKryptonForm(context.TopControl);
-
- // Not interested if not inside a krypton form
- if (kryptonForm != null)
- {
- // Get the padding just for the chrome borders
- Padding chromeBorders = kryptonForm.RealWindowBorders;
-
- // How much border space to allocate per button edge
- int buttonBorder = (chromeBorders.Top - allocatedHeight - 10) / 2;
-
- if (buttonBorder > 0)
- {
- return new Padding(buttonBorder);
- }
- else
- {
- return Padding.Empty;
- }
- }
-
- return original;
- }
-
- private static Font ContentFontForButtonForm(ViewLayoutContext context,
- Font font)
- {
- // Get the krypton form that contains this control
- KryptonForm kryptonForm = OwningKryptonForm(context.TopControl);
-
- // Not interested if not inside a krypton form
- if (kryptonForm != null)
- {
- // Get the padding just for the chrome borders
- Padding chromeBorders = kryptonForm.RealWindowBorders;
-
- // How much space is available for the font
- int fontSpace = chromeBorders.Top - 6;
-
- // If not enough room for the font then create a new smaller font
- if ((font.Height > fontSpace) && (fontSpace > 5))
- {
- // Find the point size from the pixel height required
- float point = (72 / context.Graphics.DpiY) * (fontSpace / 1.333f);
-
- // No point having a font smaller than 3 points
- if (point > 3)
- {
- font = new Font(font.FontFamily, point, font.Style);
- }
- }
- }
-
- return font;
- }
-
- private static KryptonForm OwningKryptonForm(Control c)
- {
- // Climb chain looking for the Krypton Form instance
- while ((c != null) && !(c is KryptonForm))
- {
- c = c.Parent;
- }
-
- return c as KryptonForm;
- }
-
- private static void AllocateImageSpace(StandardContentMemento memento,
- IPaletteContent paletteContent,
- IContentValues contentValues,
- PaletteState state,
- Rectangle displayRect,
- RightToLeft rtl,
- ref Size[,] allocation)
- {
- // By default, we cannot draw the image
- memento.DrawImage = false;
-
- // Get the image details
- memento.Image = contentValues.GetImage(state);
- memento.ImageTransparentColor = contentValues.GetImageTransparentColor(state);
-
- // Is there any image to be drawn?
- if (memento.Image != null)
- {
- try
- {
- // Cache the size of the image
- memento.ImageRect.Size = memento.Image.Size;
-
- // Check for enough space to show all of the image
- if ((displayRect.Width >= memento.ImageRect.Width) &&
- (displayRect.Height >= memento.ImageRect.Height))
- {
- // Convert from alignment enums to integers
- int alignHIndex = RightToLeftIndex(rtl, paletteContent.GetContentImageH(state));
- int alignVIndex = (int)paletteContent.GetContentImageV(state);
-
- // Bump the allocated space in the destination grid cell
- allocation[alignHIndex, alignVIndex].Width += memento.ImageRect.Width;
- allocation[alignHIndex, alignVIndex].Height += memento.ImageRect.Height;
-
- // Yes, we do want to draw the image/icon
- memento.DrawImage = true;
- }
- }
- catch
- {
- // Image is not valid, so do not use it!
- memento.Image = null;
- memento.DrawImage = false;
- }
- }
- }
-
- private static void AllocateShortTextSpace(ViewLayoutContext context,
- Graphics g,
- StandardContentMemento memento,
- IPaletteContent paletteContent,
- IContentValues contentValues,
- PaletteState state,
- Rectangle displayRect,
- RightToLeft rtl,
- int spacingGap,
- ref Size[,] allocation,
- bool composition,
- bool glowing)
- {
- // By default, we cannot draw the text
- memento.DrawShortText = false;
-
- // Get the defined text for display
- string shortText = contentValues.GetShortText();
-
- // Is there any text to be drawn?
- if ((shortText != null) && (shortText.Length > 0))
- {
- // If the text is not allowed to span multiple lines
- if (paletteContent.GetContentShortTextMultiLine(state) == InheritBool.False)
- {
- // Replace any carriage returns and newlines with just spaces
- shortText = shortText.Replace("\r\n", " ");
- shortText = shortText.Replace("\n", " ");
- shortText = shortText.Replace("\r", " ");
- }
-
- // Convert from alignment enums to integers
- int alignHIndex = RightToLeftIndex(rtl, paletteContent.GetContentShortTextH(state));
- int alignVIndex = (int)paletteContent.GetContentShortTextV(state);
-
- // Cache the rendering hint used
- memento.ShortTextHint = CommonHelper.PaletteTextHintToRenderingHint(paletteContent.GetContentShortTextHint(state));
- memento.ShortTextTrimming = paletteContent.GetContentShortTextTrim(state);
-
- bool fontChanged = false;
- Font textFont = paletteContent.GetContentShortTextFont(state);
-
- // Get the appropriate font to use in the caption area
- if (paletteContent.GetContentStyle() == PaletteContentStyle.HeaderForm)
- {
- Font captionFont = ContentFontForButtonForm(context, textFont);
- fontChanged = (captionFont != textFont);
- textFont = captionFont;
- }
-
- // Get a pixel accurate measure of text drawing space needed
- memento.ShortTextMemento = AccurateText.MeasureString(g,
- rtl,
- shortText,
- textFont,
- memento.ShortTextTrimming,
- paletteContent.GetContentShortTextMultiLineH(state),
- paletteContent.GetContentShortTextPrefix(state),
- memento.ShortTextHint,
- composition,
- glowing,
- fontChanged);
-
- // Space required for short text starts with the text width itself
- Size requiredSpace = memento.ShortTextMemento.Size;
-
- // Find the space available given our required alignment
- if (AllocateAlignmentSpace(alignHIndex, alignVIndex,
- allocation, displayRect,
- spacingGap, memento.ShortTextTrimming,
- ref requiredSpace,
- memento.ShortTextMemento.Format.FormatFlags.HasFlag(StringFormatFlags.NoClip))
- )
- {
- // Allocate the actual space used up
- // Cache the actual draw size of the text
- memento.ShortTextRect.Size = requiredSpace;
-
- // Mark the memento to draw the short text
- memento.DrawShortText = true;
- }
- }
- }
-
- private static void AllocateLongTextSpace(ViewLayoutContext context,
- Graphics g,
- StandardContentMemento memento,
- IPaletteContent paletteContent,
- IContentValues contentValues,
- PaletteState state,
- Rectangle displayRect,
- RightToLeft rtl,
- int spacingGap,
- ref Size[,] allocation,
- bool composition,
- bool glowing)
- {
- // By default, we cannot draw the text
- memento.DrawLongText = false;
-
- // Get the defined text for display
- string longText = contentValues.GetLongText();
-
- // Is there any text to be drawn?
- if ((longText != null) && (longText.Length > 0))
- {
- // If the text is not allowed to span multiple lines
- if (paletteContent.GetContentLongTextMultiLine(state) == InheritBool.False)
- {
- // Replace any carriage returns and newlines with just spaces
- longText = longText.Replace("\r\n", " ");
- longText = longText.Replace("\n", " ");
- longText = longText.Replace("\r", " ");
- }
-
- // Convert from alignment enums to integers
- int alignHIndex = RightToLeftIndex(rtl, paletteContent.GetContentLongTextH(state));
- int alignVIndex = (int)paletteContent.GetContentLongTextV(state);
-
- // Cache the rendering hint used
- memento.LongTextHint = CommonHelper.PaletteTextHintToRenderingHint(paletteContent.GetContentLongTextHint(state));
- memento.LongTextTrimming = paletteContent.GetContentLongTextTrim(state);
-
- bool fontChanged = false;
- Font textFont = paletteContent.GetContentLongTextFont(state);
-
- // Get the appropriate font to use in the caption area
- if (paletteContent.GetContentStyle() == PaletteContentStyle.HeaderForm)
- {
- Font captionFont = ContentFontForButtonForm(context, textFont);
- fontChanged = (captionFont != textFont);
- textFont = captionFont;
- }
-
- // Get a pixel accurate measure of text drawing space needed
- memento.LongTextMemento = AccurateText.MeasureString(g,
- rtl,
- longText,
- textFont,
- memento.LongTextTrimming,
- paletteContent.GetContentLongTextMultiLineH(state),
- paletteContent.GetContentLongTextPrefix(state),
- memento.LongTextHint,
- composition,
- glowing,
- fontChanged);
-
- // Space required for long text starts with the text width itself
- Size requiredSpace = memento.LongTextMemento.Size;
-
- // Find the space available given our required alignment
- if (AllocateAlignmentSpace(alignHIndex, alignVIndex,
- allocation, displayRect,
- spacingGap, memento.LongTextTrimming,
- ref requiredSpace,
- memento.ShortTextMemento.Format.FormatFlags.HasFlag(StringFormatFlags.NoClip))
- )
- {
- // Cache the actual draw size of the text
- memento.LongTextRect.Size = requiredSpace;
-
- // Mark the memento to draw the long text
- memento.DrawLongText = true;
- }
- }
- }
-
- private static int RightToLeftIndex(RightToLeft rtl, PaletteRelativeAlign align)
- {
- switch (align)
- {
- case PaletteRelativeAlign.Near:
- return (rtl == RightToLeft.Yes ? 2 : 0);
- case PaletteRelativeAlign.Center:
- return 1;
- case PaletteRelativeAlign.Far:
- return (rtl == RightToLeft.Yes ? 0 : 2);
- default:
- // Should never happen!
- Debug.Assert(false);
- throw new ArgumentOutOfRangeException(nameof(align));
- }
- }
-
- private static int AllocatedTotalWidth(Size[,] allocation,
- int colIndex,
- int rowIndex,
- int spacingGap)
- {
- // Find the width of each column
- int[] colWidths = AllocatedColumnWidths(allocation, rowIndex);
-
- // Add each column width together
- int totalWidth = colWidths[0] + colWidths[1] + colWidths[2];
-
- // If the target column for allocation is empty then an extra
- // spacing gap will be required so add it to the total width,
- // unless there is nothing at all allocated
- if ((totalWidth > 0) && (colIndex >= 0) && (colWidths[colIndex] == 0))
- {
- totalWidth += spacingGap;
- }
-
- // Add any required spacing gaps between columns
- if ((colWidths[0] > 0) && (colWidths[1] > 0))
- {
- totalWidth += spacingGap;
- }
-
- if ((colWidths[1] > 0) && (colWidths[2] > 0))
- {
- totalWidth += spacingGap;
- }
-
- if ((colWidths[0] > 0) && (colWidths[1] == 0) && (colWidths[2] > 0))
- {
- totalWidth += spacingGap;
- }
-
- return totalWidth;
- }
-
- private static int AllocatedTotalHeight(Size[,] allocation)
- {
- int[] rowHeights = AllocatedRowHeights(allocation);
- return rowHeights[0] + rowHeights[1] + rowHeights[2];
- }
-
- private static int[] AllocatedColumnWidths(Size[,] allocation, int rowIndex)
- {
- int[] colWidths = { 0, 0, 0 };
-
- for (int col = 0; col < 3; col++)
- {
- if (rowIndex == -1)
- {
- for (int row = 0; row < 3; row++)
- {
- // Store the widest cell in each column
- if (allocation[col, row].Width > colWidths[col])
- {
- colWidths[col] = allocation[col, row].Width;
- }
- }
- }
- else
- {
- // Store the widest cell in each column
- if (allocation[col, rowIndex].Width > colWidths[col])
- {
- colWidths[col] = allocation[col, rowIndex].Width;
- }
- }
- }
-
- return colWidths;
- }
-
- private static int[] AllocatedRowHeights(Size[,] allocation)
- {
- int[] rowHeights = { 0, 0, 0 };
-
- for (int row = 0; row < 3; row++)
- {
- for (int col = 0; col < 3; col++)
- {
- // Store the widest cell in each column
- if (allocation[col, row].Height > rowHeights[row])
- {
- rowHeights[row] = allocation[col, row].Height;
- }
- }
- }
-
- return rowHeights;
- }
-
- private static bool AllocateAlignmentSpace(int alignHIndex,
- int alignVIndex,
- Size[,] allocation,
- Rectangle displayRect,
- int spacingGap,
- PaletteTextTrim trim,
- ref Size requiredSize,
- bool noClipIsSet
- )
- {
- // Cache the current target value
- Size cacheSize = allocation[alignHIndex, alignVIndex];
-
- // Track the width needed to show the item
- bool applyGap = false;
- int allocateWidth = requiredSize.Width;
-
- // If there is already something in the cell
- if (allocation[alignHIndex, alignVIndex].Width > 0)
- {
- // Then add the spacing gap to the required size width
- allocateWidth += spacingGap;
- applyGap = true;
- }
-
- // Find the current allocated total width
- int totalWidth = AllocatedTotalWidth(allocation, alignHIndex, alignVIndex, spacingGap);
-
- // How much space is available for allocation?
- int freeSpace = displayRect.Width - totalWidth;
-
- // If not enough room then we failed
- if (freeSpace < allocateWidth)
- {
- // Should we try and trim the text into the space?
- if (trim != PaletteTextTrim.Hide)
- {
- // If there is some room available after taking
- // into account the need for a spacing gap
- if ((allocateWidth == requiredSize.Width) ||
- ((allocateWidth > requiredSize.Width) && applyGap))
- {
- // Allocate just the available space
- allocateWidth = freeSpace;
-
- // Reduce the reported size back to the caller
- if (applyGap)
- {
- requiredSize.Width = allocateWidth - spacingGap;
- }
- else
- {
- requiredSize.Width = allocateWidth;
- }
- }
- else
- {
- return false;
- }
- }
- else
- {
- return false;
- }
- }
-
- // There is enough space for all the content, so add into the cell width
- allocation[alignHIndex, alignVIndex].Width += allocateWidth;
-
- // If the required height is greater than the current cell height
- if (requiredSize.Height > allocation[alignHIndex, alignVIndex].Height)
- {
- // Then use the required height instead
- allocation[alignHIndex, alignVIndex].Height = requiredSize.Height;
- }
-
- // Find the allocated total height as a result
- int totalHeight = AllocatedTotalHeight(allocation);
-
- // If not enough height then we failed
- if (totalHeight > displayRect.Height)
- {
- if (noClipIsSet)
- {
- allocation[alignHIndex, alignVIndex].Height = displayRect.Height;
- }
- else
- {
- // Restore the original cell
- allocation[alignHIndex, alignVIndex] = cacheSize;
- return false;
- }
- }
-
- return true;
- }
-
- private static void ApplyExcessSpace(int excess, ref int[] cells)
- {
- // If there is already some space in the center
- if (cells[1] > 0)
- {
- // Then all the excess to the centre
- cells[1] += excess;
- }
- else if (cells[2] == 0)
- {
- // Only the near cell is used, so give all excess to it
- cells[0] += excess;
- }
- else if (cells[0] == 0)
- {
- // Only the far cell is used, so give all excess to it
- cells[2] += excess;
- }
- else
- {
- int half = excess / 2;
-
- // Space in the near and the far, so give half to each
- cells[0] += half;
- cells[2] += (excess - half);
- }
- }
-
- private static void PositionAlignContent(StandardContentMemento memento,
- IPaletteContent paletteContent,
- PaletteState state,
- RightToLeft rtl,
- PaletteRelativeAlign alignH,
- PaletteRelativeAlign alignV,
- int cellX,
- int cellY,
- int cellWidth,
- int cellHeight,
- int spacingGap)
- {
- // Create client rectangle covering cell size
- Rectangle cellRect = new Rectangle(cellX, cellY, cellWidth, cellHeight);
-
- PaletteRelativeAlign drawHImage = paletteContent.GetContentImageH(state);
- PaletteRelativeAlign drawVImage = paletteContent.GetContentImageV(state);
- PaletteRelativeAlign drawHShort = paletteContent.GetContentShortTextH(state);
- PaletteRelativeAlign drawVShort = paletteContent.GetContentShortTextV(state);
- PaletteRelativeAlign drawHLong = paletteContent.GetContentLongTextH(state);
- PaletteRelativeAlign drawVLong = paletteContent.GetContentLongTextV(state);
-
- PaletteRelativeAlign posHImage = drawHImage;
- PaletteRelativeAlign posHShort = drawHShort;
- PaletteRelativeAlign posHLong = drawHLong;
-
- // If positioning in the center, then need extra processing
- if (alignH == PaletteRelativeAlign.Center)
- {
- // Find number of content and width of those in this cell
- int totalWidth = 0;
- int totalItems = 0;
-
- if (memento.DrawImage && (drawHImage == alignH) && (drawVImage == alignV))
- {
- totalWidth += memento.ImageRect.Width;
- totalItems++;
- }
-
- if (memento.DrawShortText && (drawHShort == alignH) && (drawVShort == alignV))
- {
- totalWidth += memento.ShortTextRect.Width;
- totalItems++;
- }
-
- if (memento.DrawLongText && (drawHLong == alignH) && (drawVLong == alignV))
- {
- totalWidth += memento.LongTextRect.Width;
- totalItems++;
- }
-
- // If more than one item is to be positioned
- if (totalItems > 1)
- {
- // Add on required number of spacing gaps
- totalWidth += (totalItems - 1) * spacingGap;
-
- // Then center the space for the content
- int halfWidth = (cellRect.Width - totalWidth) / 2;
- cellRect.Width -= (halfWidth * 2);
- cellRect.X += halfWidth;
-
- // Ensure all content are placed near, so they fit exactly
- posHImage = posHShort = posHLong = PaletteRelativeAlign.Near;
- }
- }
-
- // Do we need to position the image?
- if (memento.DrawImage && (drawHImage == alignH) && (drawVImage == alignV))
- {
- memento.ImageRect.Location = PositionCellContent(rtl, posHImage, drawVImage, memento.ImageRect.Size, spacingGap, ref cellRect);
- }
-
- // Do we need to position the short text?
- if (memento.DrawShortText && (drawHShort == alignH) && (drawVShort == alignV))
- {
- memento.ShortTextRect.Location = PositionCellContent(rtl, posHShort, drawVShort, memento.ShortTextRect.Size, spacingGap, ref cellRect);
- }
-
- // Do we need to position the long text?
- if (memento.DrawLongText && (drawHLong == alignH) && (drawVLong == alignV))
- {
- memento.LongTextRect.Location = PositionCellContent(rtl, posHLong, drawVLong, memento.LongTextRect.Size, spacingGap, ref cellRect);
- }
- }
-
- private static Point PositionCellContent(RightToLeft rtl,
- PaletteRelativeAlign drawH,
- PaletteRelativeAlign drawV,
- Size contentSize,
- int spacingGap,
- ref Rectangle cellRect)
- {
- Point location = Point.Empty;
-
- // If drawing from right to left...
- if (rtl == RightToLeft.Yes)
- {
- // Then invert the near and far positioning
- if (drawH == PaletteRelativeAlign.Near)
- {
- drawH = PaletteRelativeAlign.Far;
- }
- else if (drawH == PaletteRelativeAlign.Far)
- {
- drawH = PaletteRelativeAlign.Near;
- }
- }
-
- switch (drawH)
- {
- case PaletteRelativeAlign.Near:
- location.X = cellRect.Left;
- cellRect.X += (contentSize.Width + spacingGap);
- cellRect.Width -= (contentSize.Width + spacingGap);
- break;
- case PaletteRelativeAlign.Center:
- int halfHorz = (cellRect.Width - contentSize.Width) / 2;
- location.X = cellRect.Left + halfHorz;
- break;
- case PaletteRelativeAlign.Far:
- location.X = cellRect.Right - contentSize.Width;
- cellRect.Width -= (contentSize.Width + spacingGap);
- break;
- }
-
- switch (drawV)
- {
- case PaletteRelativeAlign.Near:
- location.Y = cellRect.Top;
- break;
- case PaletteRelativeAlign.Center:
- int halfVert = (cellRect.Height - contentSize.Height) / 2;
- location.Y = cellRect.Top + halfVert;
- break;
- case PaletteRelativeAlign.Far:
- location.Y = cellRect.Bottom - contentSize.Height;
- break;
- }
-
- return location;
- }
- #endregion
-
- #region Implementation Glyph
- private static CheckBoxState DiscoverCheckBoxState(bool enabled,
- CheckState checkState,
- bool tracking,
- bool pressed)
- {
- switch (checkState)
- {
- default:
- case CheckState.Unchecked:
- if (!enabled)
- {
- return CheckBoxState.UncheckedDisabled;
- }
- else if (pressed)
- {
- return CheckBoxState.UncheckedPressed;
- }
- else if (tracking)
- {
- return CheckBoxState.UncheckedHot;
- }
- else
- {
- return CheckBoxState.UncheckedNormal;
- }
-
- case CheckState.Checked:
- if (!enabled)
- {
- return CheckBoxState.CheckedDisabled;
- }
- else if (pressed)
- {
- return CheckBoxState.CheckedPressed;
- }
- else if (tracking)
- {
- return CheckBoxState.CheckedHot;
- }
- else
- {
- return CheckBoxState.CheckedNormal;
- }
-
- case CheckState.Indeterminate:
- if (!enabled)
- {
- return CheckBoxState.MixedDisabled;
- }
- else if (pressed)
- {
- return CheckBoxState.MixedPressed;
- }
- else if (tracking)
- {
- return CheckBoxState.MixedHot;
- }
- else
- {
- return CheckBoxState.MixedNormal;
- }
- }
- }
-
- RadioButtonState DiscoverRadioButtonState(bool enabled,
- bool checkState,
- bool tracking,
- bool pressed)
- {
- if (checkState)
- {
- if (!enabled)
- {
- return RadioButtonState.CheckedDisabled;
- }
- else if (pressed)
- {
- return RadioButtonState.CheckedPressed;
- }
- else if (tracking)
- {
- return RadioButtonState.CheckedHot;
- }
- else
- {
- return RadioButtonState.CheckedNormal;
- }
- }
- else
- {
- if (!enabled)
- {
- return RadioButtonState.UncheckedDisabled;
- }
- else if (pressed)
- {
- return RadioButtonState.UncheckedPressed;
- }
- else if (tracking)
- {
- return RadioButtonState.UncheckedHot;
- }
- else
- {
- return RadioButtonState.UncheckedNormal;
- }
- }
- }
-
- private void MeasureDragDockingSquares(ComponentFactory.Krypton.Toolkit.RenderDragDockingData dragData,
- IPaletteDragDrop dragDropPalette)
- {
- dragData.DockWindowSize = new Size(88, 88);
-
- if (dragData.ShowMiddle)
- {
- dragData.RectLeft = new Rectangle(0, 29, 29, 29);
- dragData.RectRight = new Rectangle(59, 29, 29, 29);
- dragData.RectTop = new Rectangle(29, 0, 29, 29);
- dragData.RectBottom = new Rectangle(29, 59, 29, 29);
- dragData.RectMiddle = new Rectangle(23, 23, 40, 40);
- }
- else
- {
- dragData.RectLeft = new Rectangle(0, 29, 32, 29);
- dragData.RectRight = new Rectangle(56, 29, 32, 29);
- dragData.RectTop = new Rectangle(29, 0, 29, 32);
- dragData.RectBottom = new Rectangle(29, 56, 29, 31);
- }
- }
-
- private void MeasureDragDockingRounded(ComponentFactory.Krypton.Toolkit.RenderDragDockingData dragData,
- IPaletteDragDrop dragDropPalette)
- {
- dragData.DockWindowSize = new Size(103, 103);
- dragData.RectLeft = new Rectangle(0, 36, 32, 31);
- dragData.RectRight = new Rectangle(71, 36, 32, 31);
- dragData.RectTop = new Rectangle(36, 0, 31, 32);
- dragData.RectBottom = new Rectangle(36, 71, 31, 32);
- dragData.RectMiddle = new Rectangle(36, 36, 31, 31);
- }
-
- private void DrawDragDockingRounded(ComponentFactory.Krypton.Toolkit.RenderContext context,
- ComponentFactory.Krypton.Toolkit.RenderDragDockingData dragData,
- IPaletteDragDrop dragDropPalette)
- {
- Color back = dragDropPalette.GetDragDropDockBack();
- Color border = dragDropPalette.GetDragDropDockBorder();
- Color active = dragDropPalette.GetDragDropDockActive();
- Color inactive = dragDropPalette.GetDragDropDockInactive();
-
- DrawDragDockingRoundedBackground(context, back, border, dragData);
- if (dragData.ShowLeft)
- {
- DrawDragDockingRoundedLeft(context, back, border, active, inactive, dragData);
- }
-
- if (dragData.ShowRight)
- {
- DrawDragDockingRoundedRight(context, back, border, active, inactive, dragData);
- }
-
- if (dragData.ShowTop)
- {
- DrawDragDockingRoundedTop(context, back, border, active, inactive, dragData);
- }
-
- if (dragData.ShowBottom)
- {
- DrawDragDockingRoundedBottom(context, back, border, active, inactive, dragData);
- }
-
- if (dragData.ShowMiddle)
- {
- DrawDragDockingRoundedMiddle(context, back, border, active, inactive, dragData);
- }
- }
-
- private void DrawDragDockingRoundedBackground(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Color inside,
- Color border,
- ComponentFactory.Krypton.Toolkit.RenderDragDockingData dragData)
- {
- if (dragData.ShowBack)
- {
- DrawDragDockingRoundedRect(context, inside, border, new Rectangle(16, 16, 73, 73), 11);
- }
- }
-
- private void DrawDragDockingRoundedLeft(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Color inside, Color border,
- Color active, Color inactive,
- ComponentFactory.Krypton.Toolkit.RenderDragDockingData dragData)
- {
- DrawDragDockingRoundedRect(context, (dragData.ActiveLeft ? active : inside), (dragData.ActiveLeft ? active : border), dragData.RectLeft, 3);
- DrawDragDockingArrow(context, active, dragData.RectLeft, VisualOrientation.Left);
- }
-
- private void DrawDragDockingRoundedRight(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Color inside, Color border,
- Color active, Color inactive,
- ComponentFactory.Krypton.Toolkit.RenderDragDockingData dragData)
- {
- DrawDragDockingRoundedRect(context, (dragData.ActiveRight ? active : inside), (dragData.ActiveRight ? active : border), dragData.RectRight, 3);
- DrawDragDockingArrow(context, active, dragData.RectRight, VisualOrientation.Right);
- }
-
- private void DrawDragDockingRoundedTop(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Color inside, Color border,
- Color active, Color inactive,
- ComponentFactory.Krypton.Toolkit.RenderDragDockingData dragData)
- {
- DrawDragDockingRoundedRect(context, (dragData.ActiveTop ? active : inside), (dragData.ActiveTop ? active : border), dragData.RectTop, 3);
- DrawDragDockingArrow(context, active, dragData.RectTop, VisualOrientation.Top);
- }
-
- private void DrawDragDockingRoundedBottom(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Color inside, Color border,
- Color active, Color inactive,
- ComponentFactory.Krypton.Toolkit.RenderDragDockingData dragData)
- {
- DrawDragDockingRoundedRect(context, (dragData.ActiveBottom ? active : inside), (dragData.ActiveBottom ? active : border), dragData.RectBottom, 3);
- DrawDragDockingArrow(context, active, dragData.RectBottom, VisualOrientation.Bottom);
- }
-
- private void DrawDragDockingRoundedMiddle(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Color inside, Color border,
- Color active, Color inactive,
- ComponentFactory.Krypton.Toolkit.RenderDragDockingData dragData)
- {
- Color borderColor = (dragData.ActiveMiddle ? active : border);
- Color insideColor = (dragData.ActiveMiddle ? active : inside);
- using (AntiAlias aa = new AntiAlias(context.Graphics))
- {
- using (GraphicsPath borderPath = new GraphicsPath(),
- insidePath = new GraphicsPath())
- {
- // Generate the graphics paths for the border and the inside area which is just inside the border
- Rectangle rect = dragData.RectMiddle;
- Rectangle rectInside = new Rectangle(rect.X + 2, rect.Y + 2, rect.Width - 4, rect.Height - 4);
- DrawDragDockingMiddleLines(borderPath, dragData.RectMiddle, 13);
- DrawDragDockingMiddleLines(insidePath, rectInside, 9);
-
- // Fill the entire border area
- using (SolidBrush borderBrush = new SolidBrush(Color.FromArgb(196, Color.White)))
- {
- context.Graphics.FillPath(borderBrush, borderPath);
- }
-
- // Fill with gradient the area inside the border
- RectangleF rectBoundsF = new RectangleF(rect.X - 1, rect.Y - 1, rect.Width + 2, rect.Height + 2);
- using (LinearGradientBrush insideBrush = new LinearGradientBrush(rectBoundsF, Color.FromArgb(196, Color.White), insideColor, 90))
- {
- insideBrush.Blend = _dragRoundedInsideBlend;
- context.Graphics.FillPath(insideBrush, insidePath);
- }
-
- using (Pen borderPen = new Pen(borderColor))
- {
- // Finally draw the actual border
- context.Graphics.DrawPath(borderPen, borderPath);
-
- // Draw the two extra tabs
- context.Graphics.DrawLine(borderPen, new Point(rect.Right - 2, rect.Bottom - 3), new Point(rect.Right - 2, rect.Bottom - 2));
- context.Graphics.DrawLine(borderPen, new Point(rect.Right - 10, rect.Bottom - 3), new Point(rect.Right - 10, rect.Bottom - 2));
- context.Graphics.DrawLine(borderPen, new Point(rect.Right - 3, rect.Bottom - 1), new Point(rect.X + 9, rect.Bottom - 1));
- }
- }
- }
- }
-
- private void DrawDragDockingMiddleLines(GraphicsPath path, Rectangle rect, int tabExtend)
- {
- path.AddLines(new Point[] { new Point(rect.X, rect.Bottom - 2),
- new Point(rect.X, rect.Y + 1),
- new Point(rect.X + 1, rect.Y),
- new Point(rect.Right - 1, rect.Y),
- new Point(rect.Right, rect.Y + 1),
- new Point(rect.Right, rect.Bottom - 6),
- new Point(rect.Right - 2, rect.Bottom - 4),
- new Point(rect.X + tabExtend, rect.Bottom - 4),
- new Point(rect.X + tabExtend, rect.Bottom - 2),
- new Point((rect.X + tabExtend) - 1, rect.Bottom - 1),
- new Point(rect.X + 1, rect.Bottom - 1),
- new Point(rect.X, rect.Bottom - 2)});
- }
-
- private void DrawDragDockingRoundedRect(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Color inside,
- Color border,
- Rectangle drawRect,
- int rounding)
- {
- using (AntiAlias aa = new AntiAlias(context.Graphics))
- {
- RectangleF rectBoundsF = new RectangleF(drawRect.X - 1, drawRect.Y - 1, drawRect.Width + 2, drawRect.Height + 1);
- Rectangle rectInside = new Rectangle(drawRect.X + 2, drawRect.Y + 2, drawRect.Width - 4, drawRect.Height - 4);
- using (GraphicsPath borderPath = CreateBorderBackPath(true, true, drawRect, PaletteDrawBorders.All, 1, rounding, true, 0),
- insidePath = CreateBorderBackPath(true, true, rectInside, PaletteDrawBorders.All, 1, rounding - 1, true, 0))
- {
- using (SolidBrush borderBrush = new SolidBrush(Color.FromArgb(196, Color.White)))
- {
- context.Graphics.FillPath(borderBrush, borderPath);
- }
-
- using (LinearGradientBrush insideBrush = new LinearGradientBrush(rectBoundsF, Color.FromArgb(196, Color.White), inside, 90))
- {
- insideBrush.Blend = _dragRoundedInsideBlend;
- context.Graphics.FillPath(insideBrush, insidePath);
- }
-
- using (Pen borderPen = new Pen(border))
- {
- context.Graphics.DrawPath(borderPen, borderPath);
- }
- }
- }
- }
-
- private void DrawDragDockingArrow(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Color active,
- Rectangle rect,
- VisualOrientation orientation)
- {
- using (GraphicsPath innerPath = new GraphicsPath())
- {
- float angle = 0f;
- switch (orientation)
- {
- case VisualOrientation.Left:
- rect = new Rectangle(rect.Right - DRAG_ARROW_HEIGHT - DRAG_ARROW_GAP,
- rect.Y + ((rect.Height - DRAG_ARROW_WIDTH) / 2),
- DRAG_ARROW_HEIGHT, DRAG_ARROW_WIDTH);
-
- innerPath.AddLines(new Point[] { new Point(rect.X + 1, rect.Top + 6),
- new Point(rect.Right - 1, rect.Top + 1),
- new Point(rect.Right - 1, rect.Bottom - 2)});
- break;
- case VisualOrientation.Right:
- rect = new Rectangle(rect.Left + DRAG_ARROW_GAP,
- rect.Y + ((rect.Height - DRAG_ARROW_WIDTH) / 2),
- DRAG_ARROW_HEIGHT, DRAG_ARROW_WIDTH);
-
- innerPath.AddLines(new Point[] { new Point(rect.X + 1, rect.Top + 1),
- new Point(rect.X + 1, rect.Bottom - 2),
- new Point(rect.Right - 1, rect.Top + 6) });
- angle = 180f;
- break;
- case VisualOrientation.Top:
- rect = new Rectangle(rect.X + ((rect.Width - DRAG_ARROW_WIDTH) / 2),
- rect.Bottom - DRAG_ARROW_HEIGHT - DRAG_ARROW_GAP - 1,
- DRAG_ARROW_WIDTH, DRAG_ARROW_HEIGHT);
-
- innerPath.AddLines(new Point[] { new Point(rect.X + 1, rect.Bottom),
- new Point(rect.Right - 1, rect.Bottom),
- new Point(rect.X + 6, rect.Top + 1) });
- angle = 90f;
- break;
- case VisualOrientation.Bottom:
- rect = new Rectangle(rect.X + ((rect.Width - DRAG_ARROW_WIDTH) / 2),
- rect.Top + DRAG_ARROW_GAP,
- DRAG_ARROW_WIDTH, DRAG_ARROW_HEIGHT);
-
- innerPath.AddLines(new Point[] { new Point(rect.X + 2, rect.Top + 1),
- new Point(rect.Right - 2, rect.Top + 1),
- new Point(rect.X + 6, rect.Bottom - 1) });
- angle = 270f;
- break;
- }
-
- // Draw background in white top highlight the arrow
- using (AntiAlias aa = new AntiAlias(context.Graphics))
- {
- context.Graphics.FillPath(Brushes.White, innerPath);
- }
-
- // Draw the actual arrow itself
- using (LinearGradientBrush innerBrush = new LinearGradientBrush(rect, ControlPaint.Dark(active), ControlPaint.Light(active), angle))
- {
- context.Graphics.FillPath(innerBrush, innerPath);
- }
- }
- }
-
- private void DrawDragDockingSquares(ComponentFactory.Krypton.Toolkit.RenderContext context,
- ComponentFactory.Krypton.Toolkit.RenderDragDockingData dragData,
- IPaletteDragDrop dragDropPalette)
- {
- Color back = dragDropPalette.GetDragDropDockBack();
- Color border = dragDropPalette.GetDragDropDockBorder();
- Color active = dragDropPalette.GetDragDropDockActive();
- Color inactive = dragDropPalette.GetDragDropDockInactive();
-
- DrawDragDockingSquaresBackground(context.Graphics, back, border, dragData);
- if (dragData.ShowLeft)
- {
- DrawDragDockingSquaresLeft(context.Graphics, active, inactive, dragData);
- }
-
- if (dragData.ShowRight)
- {
- DrawDragDockingSquaresRight(context.Graphics, active, inactive, dragData);
- }
-
- if (dragData.ShowTop)
- {
- DrawDragDockingSquaresTop(context.Graphics, active, inactive, dragData);
- }
-
- if (dragData.ShowBottom)
- {
- DrawDragDockingSquaresBottom(context.Graphics, active, inactive, dragData);
- }
-
- if (dragData.ShowMiddle)
- {
- DrawDragDockingSquaresMiddle(context.Graphics, active, inactive, dragData);
- }
- }
-
- private void DrawDragDockingSquaresBackground(Graphics g,
- Color inside,
- Color border,
- ComponentFactory.Krypton.Toolkit.RenderDragDockingData dragData)
- {
- Color start = Color.FromArgb(190, 190, 190);
- using (Pen borderPen = new Pen(border))
- {
- using (SolidBrush insideBrush = new SolidBrush(inside))
- {
- using (LinearGradientBrush gradientLL = new LinearGradientBrush(new Rectangle(-1, -1, 5, 5), start, inside, 0f),
- gradientTL = new LinearGradientBrush(new Rectangle(-1, 23, 5, 5), start, inside, 90f),
- gradientCC = new LinearGradientBrush(new Rectangle(24, 25, 5, 5), start, inside, 45f),
- gradientLT = new LinearGradientBrush(new Rectangle(28, -1, 5, 5), start, inside, 0f),
- gradientML = new LinearGradientBrush(new Rectangle(22, -1, 5, 5), start, inside, 0f),
- gradientMT = new LinearGradientBrush(new Rectangle(-1, 22, 5, 5), start, inside, 90f),
- gradientTT = new LinearGradientBrush(new Rectangle(-1, -1, 5, 5), start, inside, 90f))
- {
- // Draw all the background cross?
- if (dragData.ShowBack)
- {
- // Create points for a polygon
- Point[] pts = {new Point(0, 29), new Point(23, 29),
- new Point(29, 23), new Point(29, 0),
- new Point(57, 0), new Point(57, 23),
- new Point(63, 29), new Point(87, 29),
- new Point(87, 57), new Point(63, 57),
- new Point(57, 63), new Point(57, 87),
- new Point(29, 87), new Point(29, 63),
- new Point(23, 57), new Point(0, 57)};
-
- // Fill this area with a solid colour
- g.FillPolygon(insideBrush, pts);
-
- // Draw shadow at some of the box edges
- g.FillPolygon(gradientLL, new Point[] { new Point(1, 57), new Point(1, 30), new Point(4, 33), new Point(4, 57) });
- g.FillPolygon(gradientTL, new Point[] { new Point(1, 30), new Point(25, 30), new Point(27, 33), new Point(3, 33) });
- g.FillPolygon(gradientCC, new Point[] { new Point(23, 30), new Point(30, 23), new Point(33, 26), new Point(26, 33) });
- g.FillPolygon(gradientLT, new Point[] { new Point(30, 1), new Point(30, 24), new Point(33, 26), new Point(33, 4) });
- g.FillPolygon(gradientTT, new Point[] { new Point(30, 1), new Point(57, 1), new Point(57, 4), new Point(33, 4) });
- g.FillPolygon(gradientLT, new Point[] { new Point(30, 63), new Point(30, 87), new Point(33, 87), new Point(33, 66) });
- g.FillPolygon(gradientTL, new Point[] { new Point(63, 30), new Point(87, 30), new Point(87, 33), new Point(66, 33) });
-
- // Draw outline in darker colour
- g.DrawPolygon(borderPen, pts);
- }
- else if (dragData.ShowLeft && dragData.ShowRight)
- {
- // Create points for a polygon
- Point[] pts = {new Point(0, 29), new Point(23, 29),
- new Point(29, 23), new Point(57, 23),
- new Point(63, 29), new Point(87, 29),
- new Point(87, 57), new Point(63, 57),
- new Point(57, 63), new Point(29, 63),
- new Point(23, 57), new Point(0, 57)};
-
- // Fill this area with a solid colour
- g.FillPolygon(insideBrush, pts);
-
- // Draw shadow at some of the box edges
- g.FillPolygon(gradientLL, new Point[] { new Point(1, 57), new Point(1, 30), new Point(4, 33), new Point(4, 57) });
- g.FillPolygon(gradientTL, new Point[] { new Point(1, 30), new Point(25, 30), new Point(27, 33), new Point(3, 33) });
- g.FillPolygon(gradientCC, new Point[] { new Point(23, 30), new Point(30, 23), new Point(33, 26), new Point(26, 33) });
- g.FillPolygon(gradientMT, new Point[] { new Point(30, 24), new Point(57, 24), new Point(60, 27), new Point(33, 27) });
- g.FillPolygon(gradientTL, new Point[] { new Point(63, 30), new Point(87, 30), new Point(87, 33), new Point(66, 33) });
-
- // Draw outline in darker colour
- g.DrawPolygon(borderPen, pts);
- }
- else if (dragData.ShowLeft)
- {
- // Only draw the background for the left square
- g.FillRectangle(insideBrush, 0, 29, 31, 28);
- g.DrawRectangle(borderPen, 0, 29, 31, 28);
- }
- else if (dragData.ShowRight)
- {
- // Only draw the background for the right square
- g.FillRectangle(insideBrush, 56, 29, 31, 28);
- g.DrawRectangle(borderPen, 56, 29, 31, 28);
- }
- else if (dragData.ShowTop && dragData.ShowBottom)
- {
- // Create points for a polygon
- Point[] pts = {new Point(23, 29), new Point(29, 23),
- new Point(29, 0), new Point(57, 0),
- new Point(57, 23), new Point(63, 29),
- new Point(63, 57), new Point(57, 63),
- new Point(57, 87), new Point(29, 87),
- new Point(29, 63), new Point(23, 57)};
-
- // Fill this area with a solid colour
- g.FillPolygon(insideBrush, pts);
-
- g.FillPolygon(gradientLT, new Point[] { new Point(30, 1), new Point(30, 24), new Point(33, 26), new Point(33, 4) });
- g.FillPolygon(gradientTT, new Point[] { new Point(30, 1), new Point(57, 1), new Point(57, 4), new Point(33, 4) });
- g.FillPolygon(gradientCC, new Point[] { new Point(23, 30), new Point(30, 23), new Point(33, 26), new Point(26, 33) });
- g.FillPolygon(gradientML, new Point[] { new Point(24, 57), new Point(24, 30), new Point(27, 33), new Point(27, 60) });
- g.FillPolygon(gradientLT, new Point[] { new Point(30, 63), new Point(30, 87), new Point(33, 87), new Point(33, 66) });
-
- // Draw outline in darker colour
- g.DrawPolygon(borderPen, pts);
- }
- else if (dragData.ShowTop)
- {
- // Only draw the background for the top square
- g.FillRectangle(insideBrush, 29, 0, 28, 31);
- g.DrawRectangle(borderPen, 29, 0, 28, 31);
- }
- else if (dragData.ShowBottom)
- {
- // Only draw the background for the bottom square
- g.FillRectangle(insideBrush, 29, 56, 28, 31);
- g.DrawRectangle(borderPen, 29, 56, 28, 31);
- }
- else if (dragData.ShowMiddle)
- {
- // Only draw the background for the middle square
- Point[] pts = {new Point(23, 29), new Point(29, 23),
- new Point(57, 23), new Point(63, 29),
- new Point(63, 57), new Point(57, 63),
- new Point(29, 63), new Point(23, 57)};
-
- g.FillPolygon(insideBrush, pts);
- g.DrawPolygon(borderPen, pts);
- }
- }
- }
- }
- }
-
- private void DrawDragDockingSquaresLeft(Graphics g,
- Color activeColor,
- Color inactiveColor,
- ComponentFactory.Krypton.Toolkit.RenderDragDockingData dragData)
- {
- Color borderColour = ControlPaint.Dark(activeColor);
-
- // Draw border around the window square
- using (Pen borderPen = new Pen(borderColour),
- dashPen = new Pen(borderColour),
- shadow1Pen = new Pen(_190),
- shadow2Pen = new Pen(_218))
- {
- // Draw the caption area at top of window
- using (LinearGradientBrush middleBrush = new LinearGradientBrush(new Rectangle(4, 33, 23, 1), ControlPaint.LightLight(inactiveColor), activeColor, 0f),
- bottomBrush = new LinearGradientBrush(new Rectangle(4, 34, 23, 1), ControlPaint.Light(activeColor), activeColor, 0f),
- positionBrush = new LinearGradientBrush(new Rectangle(4, 35, 11, 1), Color.FromArgb(160, inactiveColor), Color.FromArgb(64, inactiveColor), 0f),
- arrowBrush = new LinearGradientBrush(new Rectangle(18, 40, 5, 8), borderColour, Color.FromArgb(175, borderColour), 0f))
- {
- // Draw border
- g.DrawLine(borderPen, 4, 33, 4, 53);
- g.DrawLine(borderPen, 27, 33, 27, 53);
- g.DrawLine(borderPen, 4, 53, 27, 53);
- g.DrawLine(borderPen, 4, 33, 27, 33);
-
- // Draw shadows around right and bottom edges
- g.DrawLine(shadow1Pen, 5, 54, 28, 54);
- g.DrawLine(shadow1Pen, 28, 34, 28, 54);
- g.DrawLine(shadow2Pen, 6, 55, 29, 55);
- g.DrawLine(shadow2Pen, 29, 35, 29, 55);
-
- // Draw the caption area
- g.FillRectangle(middleBrush, 5, 34, 22, 1);
- g.FillRectangle(bottomBrush, 5, 35, 22, 1);
-
- // Draw client area
- g.FillRectangle(SystemBrushes.Window, 5, 36, 22, 17);
-
- // Draw docking edge indicator
- g.FillRectangle(positionBrush, 5, 36, 11, 17);
-
- // Draw a dashed line down the middle
- dashPen.DashStyle = DashStyle.Dot;
- g.DrawLine(dashPen, 15, 37, 15, 52);
-
- // Draw the direction arrow
- g.FillPolygon(arrowBrush, new Point[] { new Point(19, 44), new Point(23, 40), new Point(23, 48), new Point(19, 44) });
-
- // If active, then draw highlighted border
- if (dragData.ActiveLeft)
- {
- g.DrawLine(borderPen, 0, 29, 23, 29);
- g.DrawLine(borderPen, 0, 57, 23, 57);
- g.DrawLine(borderPen, 0, 29, 0, 57);
- }
- }
- }
- }
-
- private void DrawDragDockingSquaresRight(Graphics g,
- Color activeColor,
- Color inactiveColor,
- ComponentFactory.Krypton.Toolkit.RenderDragDockingData dragData)
- {
- Color borderColour = ControlPaint.Dark(activeColor);
-
- // Draw border around the window square
- using (Pen borderPen = new Pen(borderColour),
- dashPen = new Pen(borderColour),
- shadow1Pen = new Pen(_190),
- shadow2Pen = new Pen(_218))
- {
- // Draw the caption area at top of window
- using (LinearGradientBrush middleBrush = new LinearGradientBrush(new Rectangle(60, 33, 23, 1), ControlPaint.LightLight(inactiveColor), activeColor, 0f),
- bottomBrush = new LinearGradientBrush(new Rectangle(60, 34, 23, 1), ControlPaint.Light(activeColor), activeColor, 0f),
- positionBrush = new LinearGradientBrush(new Rectangle(71, 35, 11, 1), Color.FromArgb(160, inactiveColor), Color.FromArgb(64, inactiveColor), 180f),
- arrowBrush = new LinearGradientBrush(new Rectangle(68, 40, 5, 8), borderColour, Color.FromArgb(175, borderColour), 180f))
- {
- // Draw border
- g.DrawLine(borderPen, 60, 33, 60, 53);
- g.DrawLine(borderPen, 83, 33, 83, 53);
- g.DrawLine(borderPen, 60, 53, 83, 53);
- g.DrawLine(borderPen, 60, 33, 83, 33);
-
- // Draw shadows around right and bottom edges
- g.DrawLine(shadow1Pen, 61, 54, 84, 54);
- g.DrawLine(shadow1Pen, 84, 34, 84, 54);
- g.DrawLine(shadow2Pen, 62, 55, 85, 55);
- g.DrawLine(shadow2Pen, 85, 35, 85, 55);
-
- // Draw the caption area
- g.FillRectangle(middleBrush, 61, 34, 22, 1);
- g.FillRectangle(bottomBrush, 61, 35, 22, 1);
-
- // Draw client area
- g.FillRectangle(SystemBrushes.Window, 61, 36, 22, 17);
-
- // Draw docking edge indicator
- g.FillRectangle(positionBrush, 72, 36, 11, 17);
-
- // Draw a dashed line down the middle
- dashPen.DashStyle = DashStyle.Dot;
- g.DrawLine(dashPen, 72, 37, 72, 52);
-
- // Draw the direction arrow
- g.FillPolygon(arrowBrush, new Point[] { new Point(69, 44), new Point(65, 40), new Point(65, 48), new Point(69, 44) });
-
- // If active, then draw highlighted border
- if (dragData.ActiveRight)
- {
- g.DrawLine(borderPen, 87, 29, 63, 29);
- g.DrawLine(borderPen, 87, 57, 63, 57);
- g.DrawLine(borderPen, 87, 29, 87, 57);
- }
- }
- }
- }
-
- private void DrawDragDockingSquaresTop(Graphics g,
- Color activeColor,
- Color inactiveColor,
- ComponentFactory.Krypton.Toolkit.RenderDragDockingData dragData)
- {
- Color borderColour = ControlPaint.Dark(activeColor);
-
- // Draw border around the window square
- using (Pen borderPen = new Pen(borderColour),
- dashPen = new Pen(borderColour),
- shadow1Pen = new Pen(_190),
- shadow2Pen = new Pen(_218))
- {
- // Draw the caption area at top of window
- using (LinearGradientBrush middleBrush = new LinearGradientBrush(new Rectangle(33, 5, 20, 1), ControlPaint.LightLight(inactiveColor), activeColor, 0f),
- bottomBrush = new LinearGradientBrush(new Rectangle(33, 6, 20, 1), ControlPaint.Light(activeColor), activeColor, 0f),
- positionBrush = new LinearGradientBrush(new Rectangle(34, 6, 19, 10), Color.FromArgb(160, inactiveColor), Color.FromArgb(64, inactiveColor), 90f),
- arrowBrush = new LinearGradientBrush(new Rectangle(39, 40, 8, 4), borderColour, Color.FromArgb(175, borderColour), 90f))
- {
- // Draw border
- g.DrawLine(borderPen, 33, 4, 53, 4);
- g.DrawLine(borderPen, 53, 4, 53, 27);
- g.DrawLine(borderPen, 53, 27, 33, 27);
- g.DrawLine(borderPen, 33, 27, 33, 4);
-
- // Draw shadows around right and bottom edges
- g.DrawLine(shadow1Pen, 34, 28, 54, 28);
- g.DrawLine(shadow1Pen, 54, 5, 54, 28);
- g.DrawLine(shadow2Pen, 35, 29, 55, 29);
- g.DrawLine(shadow2Pen, 55, 6, 55, 29);
-
- // Draw the caption area
- g.FillRectangle(middleBrush, 34, 5, 19, 1);
- g.FillRectangle(bottomBrush, 34, 6, 19, 1);
-
- // Draw client area
- g.FillRectangle(SystemBrushes.Window, 34, 7, 19, 20);
-
- // Draw docking edge indicator
- g.FillRectangle(positionBrush, 34, 7, 19, 9);
-
- // Draw a dashed line down the middle
- dashPen.DashStyle = DashStyle.Dot;
- g.DrawLine(dashPen, 35, 15, 53, 15);
-
- // Draw the direction arrow
- g.FillPolygon(arrowBrush, new Point[] { new Point(43, 18), new Point(47, 23), new Point(39, 23), new Point(43, 18) });
-
- // If active, then draw highlighted border
- if (dragData.ActiveTop)
- {
- g.DrawLine(borderPen, 29, 0, 29, 23);
- g.DrawLine(borderPen, 57, 0, 57, 23);
- g.DrawLine(borderPen, 29, 0, 57, 0);
- }
- }
- }
- }
-
- private void DrawDragDockingSquaresBottom(Graphics g,
- Color activeColor,
- Color inactiveColor,
- ComponentFactory.Krypton.Toolkit.RenderDragDockingData dragData)
- {
- Color borderColour = ControlPaint.Dark(activeColor);
-
- // Draw border around the window square
- using (Pen borderPen = new Pen(borderColour),
- dashPen = new Pen(borderColour),
- shadow1Pen = new Pen(_190),
- shadow2Pen = new Pen(_218))
- {
- // Draw the caption area at top of window
- using (LinearGradientBrush middleBrush = new LinearGradientBrush(new Rectangle(33, 61, 20, 1), ControlPaint.LightLight(inactiveColor), activeColor, 0f),
- bottomBrush = new LinearGradientBrush(new Rectangle(33, 62, 20, 1), ControlPaint.Light(activeColor), activeColor, 0f),
- positionBrush = new LinearGradientBrush(new Rectangle(34, 72, 19, 11), Color.FromArgb(160, inactiveColor), Color.FromArgb(64, inactiveColor), 270f),
- arrowBrush = new LinearGradientBrush(new Rectangle(39, 66, 8, 4), borderColour, Color.FromArgb(175, borderColour), 270f))
- {
- // Draw border
- g.DrawLine(borderPen, 33, 60, 53, 60);
- g.DrawLine(borderPen, 53, 60, 53, 83);
- g.DrawLine(borderPen, 53, 83, 33, 83);
- g.DrawLine(borderPen, 33, 83, 33, 60);
-
- // Draw shadows around right and bottom edges
- g.DrawLine(shadow1Pen, 34, 84, 54, 84);
- g.DrawLine(shadow1Pen, 54, 61, 54, 84);
- g.DrawLine(shadow2Pen, 35, 85, 55, 85);
- g.DrawLine(shadow2Pen, 55, 61, 55, 85);
-
- // Draw the caption area
- g.FillRectangle(middleBrush, 34, 61, 19, 1);
- g.FillRectangle(bottomBrush, 34, 62, 19, 1);
-
- // Draw client area
- g.FillRectangle(SystemBrushes.Window, 34, 63, 19, 20);
-
- // Draw docking edge indicator
- g.FillRectangle(positionBrush, 34, 73, 19, 10);
-
- // Draw a dashed line down the middle
- dashPen.DashStyle = DashStyle.Dot;
- g.DrawLine(dashPen, 35, 73, 53, 73);
-
- // Draw the direction arrow
- g.FillPolygon(arrowBrush, new Point[] { new Point(43, 71), new Point(47, 67), new Point(40, 67), new Point(43, 71) });
-
- // If active, then draw highlighted border
- if (dragData.ActiveBottom)
- {
- g.DrawLine(borderPen, 29, 63, 29, 87);
- g.DrawLine(borderPen, 57, 63, 57, 87);
- g.DrawLine(borderPen, 29, 87, 57, 87);
- }
- }
- }
- }
-
- private void DrawDragDockingSquaresMiddle(Graphics g,
- Color activeColor,
- Color inactiveColor,
- ComponentFactory.Krypton.Toolkit.RenderDragDockingData dragData)
- {
- Color borderColour = ControlPaint.Dark(activeColor);
-
- // Draw border around the window square
- using (Pen borderPen = new Pen(borderColour),
- dashPen = new Pen(borderColour),
- shadow1Pen = new Pen(_190),
- shadow2Pen = new Pen(_218))
- {
- // Draw the caption area at top of window
- using (LinearGradientBrush middleBrush = new LinearGradientBrush(new Rectangle(32, 34, 21, 1), ControlPaint.LightLight(inactiveColor), activeColor, 0f),
- bottomBrush = new LinearGradientBrush(new Rectangle(32, 35, 21, 1), ControlPaint.Light(activeColor), activeColor, 0f))
- {
- // Draw border
- g.DrawLine(borderPen, 32, 32, 54, 32);
- g.DrawLine(borderPen, 32, 32, 32, 53);
- g.DrawLine(borderPen, 32, 53, 33, 54);
- g.DrawLine(borderPen, 33, 54, 41, 54);
- g.DrawLine(borderPen, 41, 54, 42, 52);
- g.DrawLine(borderPen, 42, 52, 42, 50);
- g.DrawLine(borderPen, 42, 50, 54, 50);
- g.DrawLine(borderPen, 54, 32, 54, 53);
- g.DrawLine(borderPen, 54, 53, 53, 54);
- g.DrawLine(borderPen, 53, 54, 49, 54);
- g.DrawLine(borderPen, 49, 54, 48, 53);
- g.DrawLine(borderPen, 48, 53, 48, 50);
- g.DrawLine(borderPen, 48, 53, 47, 54);
- g.DrawLine(borderPen, 47, 54, 43, 54);
- g.DrawLine(borderPen, 43, 54, 42, 53);
-
- // Draw the caption area
- g.FillRectangle(middleBrush, 33, 33, 21, 1);
- g.FillRectangle(bottomBrush, 33, 34, 21, 1);
-
- // Draw the client area
- g.FillRectangle(SystemBrushes.Window, 33, 35, 21, 15);
- g.FillRectangle(SystemBrushes.Window, 33, 50, 9, 3);
- g.FillRectangle(SystemBrushes.Window, 33, 53, 9, 1);
- g.FillRectangle(SystemBrushes.Window, 43, 51, 5, 3);
- g.FillRectangle(SystemBrushes.Window, 49, 51, 5, 3);
-
- // Fill the inner indicator area
- using (SolidBrush innerBrush = new SolidBrush(Color.FromArgb(64, inactiveColor)))
- {
- g.FillRectangle(innerBrush, 34, 36, 19, 13);
- g.FillRectangle(innerBrush, 34, 49, 7, 3);
- g.FillRectangle(innerBrush, 35, 52, 5, 1);
- }
-
- // Draw outline of the indicator area
- dashPen.DashStyle = DashStyle.Dot;
- g.DrawLine(dashPen, 34, 37, 34, 52);
- g.DrawLine(dashPen, 35, 52, 40, 52);
- g.DrawLine(dashPen, 40, 51, 40, 49);
- g.DrawLine(dashPen, 40, 51, 40, 48);
- g.DrawLine(dashPen, 41, 48, 53, 48);
- g.DrawLine(dashPen, 52, 47, 52, 36);
- g.DrawLine(dashPen, 35, 36, 52, 36);
-
- // Draw right han side shadow
- g.DrawLine(shadow1Pen, 55, 33, 55, 53);
- g.DrawLine(shadow2Pen, 56, 34, 56, 53);
- g.DrawLine(shadow1Pen, 33, 55, 53, 55);
- g.DrawLine(shadow1Pen, 53, 55, 55, 53);
- g.DrawLine(shadow2Pen, 34, 56, 53, 56);
- g.DrawLine(shadow2Pen, 53, 56, 56, 53);
- }
-
- // If active, then draw highlighted border
- if (dragData.ActiveMiddle)
- {
- g.DrawLine(borderPen, 23, 29, 29, 23);
- g.DrawLine(borderPen, 57, 23, 63, 29);
- g.DrawLine(borderPen, 63, 57, 57, 63);
- g.DrawLine(borderPen, 23, 57, 29, 63);
- }
- }
- }
- #endregion
-
- #region Implementation Ribbon
- ///
- /// Internal rendering method.
- ///
- protected virtual IDisposable DrawRibbonGroupAreaBorder1And2(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- PaletteState state,
- IPaletteRibbonBack palette,
- bool limited,
- bool fading,
- IDisposable memento)
- {
- if ((rect.Width > 0) && (rect.Height > 0))
- {
- Color c1 = palette.GetRibbonBackColor1(state);
- Color c2 = palette.GetRibbonBackColor2(state);
- Color c3 = palette.GetRibbonBackColor3(state);
- Color c4 = palette.GetRibbonBackColor4(state);
- Color c5 = palette.GetRibbonBackColor5(state);
-
- if (fading)
- {
- c5 = Color.FromArgb(146, c5);
- }
-
- bool generate = true;
- MementoRibbonGroupAreaBorder cache;
-
- // Access a cache instance and decide if cache resources need generating
- if (!(memento is MementoRibbonGroupAreaBorder))
- {
- memento?.Dispose();
-
- cache = new MementoRibbonGroupAreaBorder(rect, c1, c2, c3, c4, c5);
- memento = cache;
- }
- else
- {
- cache = (MementoRibbonGroupAreaBorder)memento;
- generate = !cache.UseCachedValues(rect, c1, c2, c3, c4, c5);
- }
-
- // Do we need to generate the contents of the cache?
- if (generate)
- {
- // Dispose of existing values
- cache.Dispose();
-
- GraphicsPath outsidePath = new GraphicsPath();
- GraphicsPath insidePathN = new GraphicsPath();
- GraphicsPath insidePathL = new GraphicsPath();
- GraphicsPath shadowPath = new GraphicsPath();
-
- // Create path for the entire border
- outsidePath.AddLine(rect.Left + 2, rect.Top, rect.Right - 3, rect.Top);
- outsidePath.AddLine(rect.Right - 3, rect.Top, rect.Right - 1, rect.Top + 2);
- outsidePath.AddLine(rect.Right - 1, rect.Top + 2, rect.Right - 1, rect.Bottom - 3);
- outsidePath.AddLine(rect.Right - 1, rect.Bottom - 3, rect.Right - 3, rect.Bottom - 1);
- outsidePath.AddLine(rect.Right - 3, rect.Bottom - 1, rect.Left + 2, rect.Bottom - 1);
- outsidePath.AddLine(rect.Left + 2, rect.Bottom - 1, rect.Left, rect.Bottom - 3);
- outsidePath.AddLine(rect.Left, rect.Bottom - 3, rect.Left, rect.Top + 2);
- outsidePath.AddLine(rect.Left, rect.Top + 2, rect.Left + 2, rect.Top);
-
- // Create the path for the inside highlight
- insidePathL.AddLine(rect.Left + 2, rect.Bottom - 2, rect.Right - 3, rect.Bottom - 2);
- insidePathN.AddLine(rect.Left + 1, rect.Top + 3, rect.Left + 1, rect.Bottom - 3);
- insidePathN.AddLine(rect.Left + 1, rect.Bottom - 3, rect.Left + 2, rect.Bottom - 2);
- insidePathN.AddLine(rect.Left + 2, rect.Bottom - 2, rect.Right - 3, rect.Bottom - 2);
- insidePathN.AddLine(rect.Right - 3, rect.Bottom - 2, rect.Right - 2, rect.Bottom - 3);
- insidePathN.AddLine(rect.Right - 2, rect.Bottom - 3, rect.Right - 2, rect.Top + 3);
-
- // Create the path for the outside shadow
- shadowPath.AddLine(rect.Left, rect.Bottom - 2, rect.Left + 2, rect.Bottom);
- shadowPath.AddLine(rect.Left + 2, rect.Bottom, rect.Right - 3, rect.Bottom);
- shadowPath.AddLine(rect.Right - 4, rect.Bottom, rect.Right, rect.Bottom - 3);
- shadowPath.AddLine(rect.Right, rect.Bottom - 3, rect.Right, rect.Top + 3);
-
- LinearGradientBrush insideBrush = new LinearGradientBrush(rect, Color.Transparent, c2, 95f);
- cache.insidePen = new Pen(insideBrush);
-
- Rectangle rectGradient = new Rectangle(rect.Left - 1, rect.Top, rect.Width + 2, rect.Height + 1);
- LinearGradientBrush shadowBrushN = new LinearGradientBrush(rectGradient, _darken8, _darken38, 90f);
- LinearGradientBrush shadowBrushL = new LinearGradientBrush(rectGradient, _darken8, _darken18, 90f);
- cache.shadowPenN = new Pen(shadowBrushN);
- cache.shadowPenL = new Pen(shadowBrushL);
-
- cache.insidePathN = insidePathN;
- cache.insidePathL = insidePathL;
- cache.fillBrush = new LinearGradientBrush(rect, c3, c4, 90f)
- {
- Blend = _ribbonGroup1Blend
- };
- cache.fillTopBrush = new LinearGradientBrush(rect, c5, Color.Transparent, 90f)
- {
- Blend = _ribbonGroup2Blend
- };
- cache.outsidePath = outsidePath;
- cache.shadowPath = shadowPath;
- cache.outsidePen = new Pen(c1);
- }
-
- // Fill the inside area with a linear gradient
- context.Graphics.FillPath(cache.fillBrush, cache.outsidePath);
-
- // Clip drawing to the outside border
- using (Clipping clip = new Clipping(context.Graphics, cache.outsidePath))
- {
- context.Graphics.FillPath(cache.fillTopBrush, cache.outsidePath);
- }
-
- using (AntiAlias aa = new AntiAlias(context.Graphics))
- {
- // Draw the outside of the entire border line
- context.Graphics.DrawPath(cache.outsidePen, cache.outsidePath);
-
- // Draw the highlighting inside border
- context.Graphics.DrawPath(cache.insidePen, (limited ? cache.insidePathL : cache.insidePathN));
- }
-
- Pen shadowMedium = (limited ? _lightShadowPen : _medium2ShadowPen);
- Pen shadowDark = (limited ? _medium2ShadowPen : _darkShadowPen);
- context.Graphics.DrawPath(limited ? cache.shadowPenL : cache.shadowPenN, cache.shadowPath);
- context.Graphics.DrawLine(shadowMedium, rect.Left, rect.Bottom, rect.Left, rect.Bottom - 1);
- context.Graphics.DrawLine(shadowMedium, rect.Left, rect.Bottom - 1, rect.Left + 1, rect.Bottom);
- context.Graphics.DrawLine(shadowDark, rect.Right, rect.Bottom - 2, rect.Right - 2, rect.Bottom);
- context.Graphics.DrawLine(shadowMedium, rect.Right, rect.Bottom - 1, rect.Right - 1, rect.Bottom);
- }
-
- return memento;
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual IDisposable DrawRibbonGroupAreaBorder3And4(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- PaletteState state,
- IPaletteRibbonBack palette,
- IDisposable memento,
- bool gradientTop)
- {
- if ((rect.Width > 0) && (rect.Height > 0))
- {
- Color c1 = palette.GetRibbonBackColor1(state);
- Color c2 = palette.GetRibbonBackColor2(state);
- Color c3 = palette.GetRibbonBackColor3(state);
- Color c4 = palette.GetRibbonBackColor4(state);
- Color c5 = palette.GetRibbonBackColor5(state);
-
- bool generate = true;
- MementoRibbonGroupAreaBorder3 cache;
-
- // Access a cache instance and decide if cache resources need generating
- if (!(memento is MementoRibbonGroupAreaBorder3))
- {
- memento?.Dispose();
-
- cache = new MementoRibbonGroupAreaBorder3(rect, c1, c2, c3, c4, c5);
- memento = cache;
- }
- else
- {
- cache = (MementoRibbonGroupAreaBorder3)memento;
- generate = !cache.UseCachedValues(rect, c1, c2, c3, c4, c5);
- }
-
- // Do we need to generate the contents of the cache?
- if (generate)
- {
- // Dispose of existing values
- cache.Dispose();
-
- Rectangle innerRect = rect;
- innerRect.Height -= 3;
- int halfHeight = innerRect.Height / 2;
- cache.borderRect = innerRect;
- cache.borderPoints = new Point[] { new Point(innerRect.X, rect.Y), new Point(innerRect.X, innerRect.Bottom), new Point(innerRect.Right, innerRect.Bottom), new Point(innerRect.Right, innerRect.Top) };
- cache.backRect1 = new Rectangle(innerRect.X, innerRect.Y, rect.Width, halfHeight);
- cache.backRect2 = new Rectangle(innerRect.X, innerRect.Y + halfHeight, innerRect.Width, innerRect.Height - halfHeight);
- cache.backBrush1 = new LinearGradientBrush(new RectangleF(cache.backRect1.X - 1, cache.backRect1.Y - 1, cache.backRect1.Width + 2, cache.backRect1.Height + 1), c3, c4, 90f);
- cache.backBrush2 = new LinearGradientBrush(new RectangleF(cache.backRect2.X - 1, cache.backRect2.Y - 1, cache.backRect2.Width + 2, cache.backRect2.Height + 1), c4, c5, 90f);
- cache.backBrush3 = new SolidBrush(c5);
- cache.gradientBorderBrush = new LinearGradientBrush(new RectangleF(cache.backRect1.X - 1, cache.backRect1.Y - 1, cache.backRect1.Width + 2, 3), c1, c2, 0f)
- {
- Blend = _ribbonGroupArea3
- };
- cache.gradientBorderPen = (gradientTop ? new Pen(cache.gradientBorderBrush) : new Pen(c1));
- cache.solidBorderPen = new Pen(c2);
- cache.shadowPen1 = new Pen(CommonHelper.MergeColors(c5, 0.4f, c1, 0.6f));
- cache.shadowPen2 = new Pen(CommonHelper.MergeColors(c5, 0.25f, c1, 0.75f));
- cache.shadowPen3 = new Pen(CommonHelper.MergeColors(c5, 0.1f, c1, 0.9f));
- }
-
- // Draw solid background for entire area
- context.Graphics.FillRectangle(cache.backBrush3, rect);
-
- // Fill area inside the border with a gradient effect
- context.Graphics.FillRectangle(cache.backBrush1, cache.backRect1);
- context.Graphics.FillRectangle(cache.backBrush2, cache.backRect2);
-
- // Draw the solid border around the edge
- context.Graphics.DrawLine(cache.gradientBorderPen, cache.borderRect.X, cache.borderRect.Y, cache.borderRect.Right, cache.borderRect.Y);
- context.Graphics.DrawLines(cache.solidBorderPen, cache.borderPoints);
-
- // Draw shadow lines at bottom
- context.Graphics.DrawLine(cache.shadowPen3, rect.X, rect.Bottom - 2, rect.Right, rect.Bottom - 2);
- context.Graphics.DrawLine(cache.shadowPen2, rect.X, rect.Bottom - 1, rect.Right, rect.Bottom - 1);
- context.Graphics.DrawLine(cache.shadowPen1, rect.X, rect.Bottom, rect.Right, rect.Bottom);
- }
-
- return memento;
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual IDisposable DrawRibbonGroupAreaBorderContext(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- PaletteState state,
- IPaletteRibbonBack palette,
- IDisposable memento)
- {
- if ((rect.Width > 0) && (rect.Height > 0))
- {
- Color c1 = palette.GetRibbonBackColor1(state);
- Color c2 = palette.GetRibbonBackColor2(state);
- Color c3 = palette.GetRibbonBackColor3(state);
-
- bool generate = true;
- MementoRibbonGroupAreaBorderContext cache;
-
- // Access a cache instance and decide if cache resources need generating
- if (!(memento is MementoRibbonGroupAreaBorderContext))
- {
- memento?.Dispose();
-
- cache = new MementoRibbonGroupAreaBorderContext(rect, c1, c2, c3);
- memento = cache;
- }
- else
- {
- cache = (MementoRibbonGroupAreaBorderContext)memento;
- generate = !cache.UseCachedValues(rect, c1, c2, c3);
- }
-
- // Do we need to generate the contents of the cache?
- if (generate)
- {
- // Dispose of existing values
- cache.Dispose();
-
- GraphicsPath outsidePath = new GraphicsPath();
- GraphicsPath insidePath = new GraphicsPath();
- GraphicsPath shadowPath = new GraphicsPath();
-
- // Create path for the entire border
- outsidePath.AddLine(rect.Left + 2, rect.Top, rect.Right - 3, rect.Top);
- outsidePath.AddLine(rect.Right - 3, rect.Top, rect.Right - 1, rect.Top + 2);
- outsidePath.AddLine(rect.Right - 1, rect.Top + 2, rect.Right - 1, rect.Bottom - 3);
- outsidePath.AddLine(rect.Right - 1, rect.Bottom - 3, rect.Right - 3, rect.Bottom - 1);
- outsidePath.AddLine(rect.Right - 3, rect.Bottom - 1, rect.Left + 2, rect.Bottom - 1);
- outsidePath.AddLine(rect.Left + 2, rect.Bottom - 1, rect.Left, rect.Bottom - 3);
- outsidePath.AddLine(rect.Left, rect.Bottom - 3, rect.Left, rect.Top + 2);
- outsidePath.AddLine(rect.Left, rect.Top + 2, rect.Left + 2, rect.Top);
-
- // Create the path for the inside highlight
- insidePath.AddLine(rect.Left + 1, rect.Top + 3, rect.Left + 1, rect.Bottom - 3);
- insidePath.AddLine(rect.Left + 1, rect.Bottom - 3, rect.Left + 2, rect.Bottom - 2);
- insidePath.AddLine(rect.Left + 2, rect.Bottom - 2, rect.Right - 3, rect.Bottom - 2);
- insidePath.AddLine(rect.Right - 3, rect.Bottom - 2, rect.Right - 2, rect.Bottom - 3);
- insidePath.AddLine(rect.Right - 2, rect.Bottom - 3, rect.Right - 2, rect.Top + 3);
-
- // Create the path for the outside shadow
- shadowPath.AddLine(rect.Left, rect.Bottom - 2, rect.Left + 2, rect.Bottom);
- shadowPath.AddLine(rect.Left + 2, rect.Bottom, rect.Right - 3, rect.Bottom);
- shadowPath.AddLine(rect.Right - 4, rect.Bottom, rect.Right, rect.Bottom - 3);
- shadowPath.AddLine(rect.Right, rect.Bottom - 3, rect.Right, rect.Top + 3);
-
- LinearGradientBrush insideBrush = new LinearGradientBrush(rect, Color.Transparent, c2, 95f);
- cache.insidePen = new Pen(insideBrush);
-
- Rectangle rectGradient = new Rectangle(rect.Left - 1, rect.Top, rect.Width + 2, rect.Height + 1);
- LinearGradientBrush shadowBrush = new LinearGradientBrush(rectGradient, _darken8, _darken38, 90f);
- cache.shadowPen = new Pen(shadowBrush);
-
- cache.fillBrush = new LinearGradientBrush(rect, Color.White, _242, 90f)
- {
- Blend = _ribbonGroup3Blend
- };
- cache.fillTopBrush = new LinearGradientBrush(rect, Color.FromArgb(75, c3), Color.Transparent, 90f)
- {
- Blend = _ribbonGroup4Blend
- };
- cache.outsidePath = outsidePath;
- cache.insidePath = insidePath;
- cache.shadowPath = shadowPath;
- cache.outsidePen = new Pen(c1);
- }
-
- // Fill the inside area with a linear gradient
- context.Graphics.FillPath(cache.fillBrush, cache.outsidePath);
-
- // Clip drawing to the outside border
- using (Clipping clip = new Clipping(context.Graphics, cache.outsidePath))
- {
- context.Graphics.FillPath(cache.fillTopBrush, cache.outsidePath);
- }
-
- using (AntiAlias aa = new AntiAlias(context.Graphics))
- {
- // Draw the outside of the entire border line
- context.Graphics.DrawPath(cache.outsidePen, cache.outsidePath);
-
- // Draw the highlighting inside border
- context.Graphics.DrawPath(cache.insidePen, cache.insidePath);
- }
-
- // Draw the shadow outside the bottom and right edges
- context.Graphics.DrawPath(cache.shadowPen, cache.shadowPath);
- context.Graphics.DrawLine(_medium2ShadowPen, rect.Left, rect.Bottom, rect.Left, rect.Bottom - 1);
- context.Graphics.DrawLine(_medium2ShadowPen, rect.Left, rect.Bottom - 1, rect.Left + 1, rect.Bottom);
- context.Graphics.DrawLine(_darkShadowPen, rect.Right, rect.Bottom - 2, rect.Right - 2, rect.Bottom);
- context.Graphics.DrawLine(_medium2ShadowPen, rect.Right, rect.Bottom - 1, rect.Right - 1, rect.Bottom);
- }
-
- return memento;
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual IDisposable DrawRibbonTabTracking2007(PaletteRibbonShape shape,
- ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- PaletteState state,
- IPaletteRibbonBack palette,
- VisualOrientation orientation,
- IDisposable memento)
- {
- if ((rect.Width > 0) && (rect.Height > 0))
- {
- Color c1 = palette.GetRibbonBackColor1(state);
- Color c2 = palette.GetRibbonBackColor2(state);
-
- bool generate = true;
- MementoRibbonTabTracking2007 cache;
-
- // Access a cache instance and decide if cache resources need generating
- if (!(memento is MementoRibbonTabTracking2007))
- {
- memento?.Dispose();
-
- cache = new MementoRibbonTabTracking2007(rect, c1, c2, orientation);
- memento = cache;
- }
- else
- {
- cache = (MementoRibbonTabTracking2007)memento;
- generate = !cache.UseCachedValues(rect, c1, c2, orientation);
- }
-
- // Do we need to generate the contents of the cache?
- if (generate)
- {
- // Dispose of existing values
- cache.Dispose();
-
- switch (orientation)
- {
- case VisualOrientation.Top:
- DrawRibbonTabTrackingTop2007(rect, c1, c2, cache);
- break;
- case VisualOrientation.Left:
- DrawRibbonTabTrackingLeft2007(rect, c1, c2, cache);
- break;
- case VisualOrientation.Right:
- DrawRibbonTabTrackingRight2007(rect, c1, c2, cache);
- break;
- case VisualOrientation.Bottom:
- DrawRibbonTabTrackingBottom2007(rect, c1, c2, cache);
- break;
- }
- }
-
- // Draw the left and right sides with light version of tracking color
- context.Graphics.FillRectangle(cache.half1LeftBrush, cache.half1Rect);
- context.Graphics.FillRectangle(cache.half1RightBrush, cache.half1Rect);
-
- // Draw over with glassy effect
- context.Graphics.FillRectangle(cache.half1LightBrush, cache.half1Rect);
-
- //// Use a solid fill for the bottom half
- context.Graphics.FillRectangle(cache.half2Brush, cache.half2Rect);
-
- // Cannot draw a path that contains a zero sized element
- if ((cache.ellipseRect.Width > 0) && (cache.ellipseRect.Height > 0))
- {
- // Draw twice to get a deeper color effect, once is to pale
- context.Graphics.FillRectangle(cache.ellipseBrush, cache.half2RectF);
- context.Graphics.FillRectangle(cache.ellipseBrush, cache.half2RectF);
- }
-
- // Draw the actual border
- using (AntiAlias aa = new AntiAlias(context.Graphics))
- {
- context.Graphics.DrawPath(cache.outsidePen, cache.outsidePath);
- }
-
- switch (orientation)
- {
- case VisualOrientation.Top:
- DrawRibbonTabTrackingTopDraw2007(rect, cache, context.Graphics);
- break;
- case VisualOrientation.Left:
- DrawRibbonTabTrackingLeftDraw2007(rect, cache, context.Graphics);
- break;
- case VisualOrientation.Right:
- DrawRibbonTabTrackingRightDraw2007(rect, cache, context.Graphics);
- break;
- case VisualOrientation.Bottom:
- DrawRibbonTabTrackingBottomDraw2007(rect, cache, context.Graphics);
- break;
- }
-
- context.Graphics.DrawPath(cache.topPen, cache.topPath);
- }
-
- return memento;
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual void DrawRibbonTabTrackingTop2007(Rectangle rect,
- Color c1, Color c2,
- MementoRibbonTabTracking2007 cache)
- {
- // Create path for a curved border around the tab
- GraphicsPath outsidePath = new GraphicsPath();
- outsidePath.AddLine(rect.Left + 1, rect.Bottom - 2, rect.Left + 1, rect.Top + 1.5f);
- outsidePath.AddLine(rect.Left + 1, rect.Top + 1.5f, rect.Left + 3, rect.Top);
- outsidePath.AddLine(rect.Left + 3, rect.Top, rect.Right - 4, rect.Top);
- outsidePath.AddLine(rect.Right - 4, rect.Top, rect.Right - 2, rect.Top + 1.5f);
- outsidePath.AddLine(rect.Right - 2, rect.Top + 1.5f, rect.Right - 2, rect.Bottom - 2);
-
- // Create path for the top hightlight line
- GraphicsPath topPath = new GraphicsPath();
- topPath.AddLine(rect.Left + 3, rect.Top + 2, rect.Left + 4, rect.Top + 1);
- topPath.AddLine(rect.Left + 4, rect.Top + 1, rect.Right - 5, rect.Top + 1);
- topPath.AddLine(rect.Right - 5, rect.Top + 1, rect.Right - 4, rect.Top + 2);
-
- // Create the top and bottom half rectangles
- int full = rect.Height - 3;
- int half1 = full / 2;
- int half2 = full - half1;
- cache.half1Rect = new Rectangle(rect.Left + 3, rect.Top + 2, rect.Width - 6, half1);
- cache.half2Rect = new Rectangle(rect.Left + 3, rect.Top + 2 + half1, rect.Width - 6, half2);
- Rectangle fullRect = new Rectangle(rect.Left + 3, rect.Top + 2, rect.Width - 6, half1 + half2);
- RectangleF half1RectF = new RectangleF(cache.half1Rect.Left - 1, cache.half1Rect.Top - 0.5f, cache.half1Rect.Width + 2, cache.half1Rect.Height + 1);
- cache.half2RectF = new RectangleF(cache.half2Rect.Left - 1, cache.half2Rect.Top - 0.5f, cache.half2Rect.Width + 2, cache.half2Rect.Height + 1);
-
- cache.half1LeftBrush = new LinearGradientBrush(half1RectF, Color.FromArgb(85, c2), Color.Transparent, 0f)
- {
- Blend = _ribbonTabTopBlend
- };
- cache.half1RightBrush = new LinearGradientBrush(half1RectF, Color.FromArgb(85, c2), Color.Transparent, 180f)
- {
- Blend = _ribbonTabTopBlend
- };
- cache.half1LightBrush = new LinearGradientBrush(half1RectF, Color.FromArgb(28, Color.White), Color.FromArgb(125, Color.White), 90f);
- cache.half2Brush = new SolidBrush(Color.FromArgb(85, c2));
-
- // Create ellipse information for lightening the bottom half
- cache.ellipseRect = new RectangleF(fullRect.Left - (fullRect.Width / 8), fullRect.Top, fullRect.Width * 1.25f, fullRect.Height);
-
- // Cannot draw a path that contains a zero sized element
- GraphicsPath ellipsePath = new GraphicsPath();
- if ((cache.ellipseRect.Width > 0) && (cache.ellipseRect.Height > 0))
- {
- ellipsePath.AddEllipse(cache.ellipseRect);
- cache.ellipseBrush = new PathGradientBrush(ellipsePath)
- {
- CenterColor = Color.FromArgb(92, Color.White)
- };
- PointF centerPoint = new PointF(cache.ellipseRect.Left + (cache.ellipseRect.Width / 2), cache.ellipseRect.Top + (cache.ellipseRect.Height / 2));
- cache.ellipseBrush.CenterPoint = centerPoint;
- cache.ellipseBrush.SurroundColors = new Color[] { Color.Transparent };
- }
-
- RectangleF vertRectF = new RectangleF(rect.Left - 1, rect.Top + 2, rect.Width + 2, rect.Height - 2);
- RectangleF horzRectF = new RectangleF(rect.Left + 1, rect.Top, rect.Width - 2, rect.Height);
- cache.outsideBrush = new LinearGradientBrush(vertRectF, Color.Transparent, _whiten128, 90f)
- {
- Blend = _ribbonOutBlend
- };
- cache.insideBrush = new LinearGradientBrush(vertRectF, Color.Transparent, _whiten200, 90f)
- {
- Blend = _ribbonInBlend
- };
- cache.topBrush = new LinearGradientBrush(horzRectF, _whiten92, _whiten128, 0f)
- {
- Blend = _ribbonTopBlend
- };
- cache.topPen = new Pen(cache.topBrush);
-
- cache.outsidePen = new Pen(c1);
- cache.outsidePath = outsidePath;
- cache.topPath = topPath;
- cache.ellipsePath = ellipsePath;
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual void DrawRibbonTabTrackingTopDraw2007(Rectangle rect,
- MementoRibbonTabTracking2007 cache,
- Graphics g)
- {
- g.FillRectangle(cache.outsideBrush, rect.Left, rect.Top + 3, 1, rect.Height - 4);
- g.FillRectangle(cache.insideBrush, rect.Left + 2, rect.Top + 3, 1, rect.Height - 4);
- g.FillRectangle(cache.outsideBrush, rect.Right - 1, rect.Top + 3, 1, rect.Height - 4);
- g.FillRectangle(cache.insideBrush, rect.Right - 3, rect.Top + 3, 1, rect.Height - 4);
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual void DrawRibbonTabTrackingLeft2007(Rectangle rect,
- Color c1, Color c2,
- MementoRibbonTabTracking2007 cache)
- {
- // Create path for a curved border around the tab
- GraphicsPath outsidePath = new GraphicsPath();
- outsidePath.AddLine(rect.Right - 2, rect.Bottom - 2, rect.Left + 1.5f, rect.Bottom - 2);
- outsidePath.AddLine(rect.Left + 1.5f, rect.Bottom - 2, rect.Left, rect.Bottom - 4);
- outsidePath.AddLine(rect.Left, rect.Bottom - 4, rect.Left, rect.Top + 3);
- outsidePath.AddLine(rect.Left, rect.Top + 3, rect.Left + 1.5f, rect.Top + 1);
- outsidePath.AddLine(rect.Left + 1.5f, rect.Top + 1, rect.Right - 2, rect.Top + 1);
-
- // Create path for the top hightlight line
- GraphicsPath topPath = new GraphicsPath();
- topPath.AddLine(rect.Left + 2, rect.Bottom - 4, rect.Left + 1, rect.Bottom - 5);
- topPath.AddLine(rect.Left + 1, rect.Bottom - 5, rect.Left + 1, rect.Top + 4);
- topPath.AddLine(rect.Left + 1, rect.Top + 4, rect.Left + 2, rect.Top + 3);
-
- // Create the top and bottom half rectangles
- int full = rect.Width - 3;
- int half1 = full / 2;
- int half2 = full - half1;
- cache.half1Rect = new Rectangle(rect.Left + 2, rect.Top + 3, half1, rect.Height - 6);
- cache.half2Rect = new Rectangle(rect.Left + 2 + half1, rect.Top + 3, half2, rect.Height - 6);
- Rectangle fullRect = new Rectangle(rect.Left + 2, rect.Top + 3, half1 + half2, rect.Height - 6);
- RectangleF half1RectF = new RectangleF(cache.half1Rect.Left - 0.5f, cache.half1Rect.Top - 1f, cache.half1Rect.Width + 1, cache.half1Rect.Height + 2);
- cache.half2RectF = new RectangleF(cache.half2Rect.Left - 0.5f, cache.half2Rect.Top - 1f, cache.half2Rect.Width + 1, cache.half2Rect.Height + 2);
-
- cache.half1LeftBrush = new LinearGradientBrush(half1RectF, Color.FromArgb(85, c2), Color.Transparent, 90f)
- {
- Blend = _ribbonTabTopBlend
- };
- cache.half1RightBrush = new LinearGradientBrush(half1RectF, Color.FromArgb(85, c2), Color.Transparent, 270f)
- {
- Blend = _ribbonTabTopBlend
- };
- cache.half1LightBrush = new LinearGradientBrush(half1RectF, Color.FromArgb(28, Color.White), Color.FromArgb(125, Color.White), 180f);
- cache.half2Brush = new SolidBrush(Color.FromArgb(85, c2));
-
- // Create ellipse information for lightening the bottom hald
- cache.ellipseRect = new RectangleF(fullRect.Left, fullRect.Top - (fullRect.Width / 8), fullRect.Width, fullRect.Height * 1.25f);
-
- GraphicsPath ellipsePath = new GraphicsPath();
- // Cannot draw a path that contains a zero sized element
- if ((cache.ellipseRect.Width > 0) && (cache.ellipseRect.Height > 0))
- {
- ellipsePath.AddEllipse(cache.ellipseRect);
- cache.ellipseBrush = new PathGradientBrush(ellipsePath)
- {
- CenterColor = Color.FromArgb(48, Color.White)
- };
- PointF centerPoint = new PointF(cache.ellipseRect.Left + (cache.ellipseRect.Width / 2), cache.ellipseRect.Top + (cache.ellipseRect.Height / 2));
- cache.ellipseBrush.CenterPoint = centerPoint;
- cache.ellipseBrush.SurroundColors = new Color[] { Color.Transparent };
- }
-
- RectangleF vertRectF = new RectangleF(rect.Left + 2, rect.Top - 1, rect.Width - 2, rect.Height + 2);
- RectangleF horzRectF = new RectangleF(rect.Left, rect.Top + 1, rect.Width, rect.Height - 2);
- cache.outsideBrush = new LinearGradientBrush(vertRectF, Color.Transparent, _whiten128, 180f)
- {
- Blend = _ribbonOutBlend
- };
- cache.insideBrush = new LinearGradientBrush(vertRectF, Color.Transparent, _whiten200, 180f)
- {
- Blend = _ribbonInBlend
- };
- cache.topBrush = new LinearGradientBrush(horzRectF, _whiten92, _whiten128, 90f)
- {
- Blend = _ribbonTopBlend
- };
- cache.topPen = new Pen(cache.topBrush);
-
- cache.outsidePen = new Pen(c1);
- cache.outsidePath = outsidePath;
- cache.topPath = topPath;
- cache.ellipsePath = ellipsePath;
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual void DrawRibbonTabTrackingLeftDraw2007(Rectangle rect,
- MementoRibbonTabTracking2007 cache,
- Graphics g)
- {
- g.FillRectangle(cache.outsideBrush, rect.Left + 3, rect.Top, rect.Width - 4, 1);
- g.FillRectangle(cache.insideBrush, rect.Left + 3, rect.Top + 2, rect.Width - 4, 1);
- g.FillRectangle(cache.outsideBrush, rect.Left + 3, rect.Bottom - 1, rect.Width - 4, 1);
- g.FillRectangle(cache.insideBrush, rect.Left + 3, rect.Bottom - 3, rect.Width - 4, 1);
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual void DrawRibbonTabTrackingRight2007(Rectangle rect,
- Color c1, Color c2,
- MementoRibbonTabTracking2007 cache)
- {
- // Create path for a curved border around the tab
- GraphicsPath outsidePath = new GraphicsPath();
- outsidePath.AddLine(rect.Left + 1, rect.Bottom - 2, rect.Right - 2.5f, rect.Bottom - 2);
- outsidePath.AddLine(rect.Right - 2.5f, rect.Bottom - 2, rect.Right - 1, rect.Bottom - 4);
- outsidePath.AddLine(rect.Right - 1, rect.Bottom - 4, rect.Right - 1, rect.Top + 3);
- outsidePath.AddLine(rect.Right - 1, rect.Top + 3, rect.Right - 2.5f, rect.Top + 1);
- outsidePath.AddLine(rect.Right - 2.5f, rect.Top + 1, rect.Left + 1, rect.Top + 1);
-
- // Create path for the top hightlight line
- GraphicsPath topPath = new GraphicsPath();
- topPath.AddLine(rect.Right - 3, rect.Bottom - 4, rect.Right - 2, rect.Bottom - 5);
- topPath.AddLine(rect.Right - 2, rect.Bottom - 5, rect.Right - 2, rect.Top + 4);
- topPath.AddLine(rect.Right - 2, rect.Top + 4, rect.Right - 3, rect.Top + 3);
-
- // Create the top and bottom half rectangles
- int full = rect.Width - 3;
- int half1 = full / 2;
- int half2 = full - half1;
- cache.half1Rect = new Rectangle(rect.Right - 2 - half1, rect.Top + 3, half1, rect.Height - 6);
- cache.half2Rect = new Rectangle(rect.Right - 2 - half1 - half2, rect.Top + 3, half2, rect.Height - 6);
- Rectangle fullRect = new Rectangle(rect.Right - 2 - half1 - half2, rect.Top + 3, half1 + half2, rect.Height - 6);
- RectangleF half1RectF = new RectangleF(cache.half1Rect.Left - 0.5f, cache.half1Rect.Top - 1f, cache.half1Rect.Width + 1, cache.half1Rect.Height + 2);
- cache.half2RectF = new RectangleF(cache.half2Rect.Left - 0.5f, cache.half2Rect.Top - 1f, cache.half2Rect.Width + 1, cache.half2Rect.Height + 2);
-
- cache.half1LeftBrush = new LinearGradientBrush(half1RectF, Color.FromArgb(85, c2), Color.Transparent, 270f)
- {
- Blend = _ribbonTabTopBlend
- };
- cache.half1RightBrush = new LinearGradientBrush(half1RectF, Color.FromArgb(85, c2), Color.Transparent, 90f)
- {
- Blend = _ribbonTabTopBlend
- };
- cache.half1LightBrush = new LinearGradientBrush(half1RectF, Color.FromArgb(28, Color.White), Color.FromArgb(125, Color.White), 0f);
- cache.half2Brush = new SolidBrush(Color.FromArgb(85, c2));
-
- // Create ellipse information for lightening the bottom hald
- cache.ellipseRect = new RectangleF(fullRect.Left, fullRect.Top - (fullRect.Width / 8), fullRect.Width, fullRect.Height * 1.25f);
-
- GraphicsPath ellipsePath = new GraphicsPath();
- // Cannot draw a path that contains a zero sized element
- if ((cache.ellipseRect.Width > 0) && (cache.ellipseRect.Height > 0))
- {
- ellipsePath.AddEllipse(cache.ellipseRect);
- cache.ellipseBrush = new PathGradientBrush(ellipsePath)
- {
- CenterColor = Color.FromArgb(48, Color.White)
- };
- PointF centerPoint = new PointF(cache.ellipseRect.Left + (cache.ellipseRect.Width / 2), cache.ellipseRect.Top + (cache.ellipseRect.Height / 2));
- cache.ellipseBrush.CenterPoint = centerPoint;
- cache.ellipseBrush.SurroundColors = new Color[] { Color.Transparent };
- }
-
- RectangleF vertRectF = new RectangleF(rect.Left, rect.Top - 1, rect.Width - 2, rect.Height + 2);
- RectangleF horzRectF = new RectangleF(rect.Left, rect.Top + 1, rect.Width, rect.Height - 2);
- cache.outsideBrush = new LinearGradientBrush(vertRectF, Color.Transparent, _whiten128, 0f)
- {
- Blend = _ribbonOutBlend
- };
- cache.insideBrush = new LinearGradientBrush(vertRectF, Color.Transparent, _whiten200, 0f)
- {
- Blend = _ribbonInBlend
- };
- cache.topBrush = new LinearGradientBrush(horzRectF, _whiten92, _whiten128, 270f)
- {
- Blend = _ribbonTopBlend
- };
- cache.topPen = new Pen(cache.topBrush);
-
- cache.outsidePen = new Pen(c1);
- cache.outsidePath = outsidePath;
- cache.topPath = topPath;
- cache.ellipsePath = ellipsePath;
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual void DrawRibbonTabTrackingRightDraw2007(Rectangle rect,
- MementoRibbonTabTracking2007 cache,
- Graphics g)
- {
- g.FillRectangle(cache.outsideBrush, rect.Left + 1, rect.Top, rect.Width - 4, 1);
- g.FillRectangle(cache.insideBrush, rect.Left + 1, rect.Top + 2, rect.Width - 4, 1);
- g.FillRectangle(cache.outsideBrush, rect.Left + 1, rect.Bottom - 1, rect.Width - 4, 1);
- g.FillRectangle(cache.insideBrush, rect.Left + 1, rect.Bottom - 3, rect.Width - 4, 1);
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual void DrawRibbonTabTrackingBottom2007(Rectangle rect,
- Color c1, Color c2,
- MementoRibbonTabTracking2007 cache)
- {
- // Create path for a curved border around the tab
- GraphicsPath outsidePath = new GraphicsPath();
- outsidePath.AddLine(rect.Left + 1, rect.Top + 1, rect.Left + 1, rect.Bottom - 2.5f);
- outsidePath.AddLine(rect.Left + 1, rect.Bottom - 2.5f, rect.Left + 3, rect.Bottom - 1);
- outsidePath.AddLine(rect.Left + 3, rect.Bottom - 1, rect.Right - 4, rect.Bottom - 1);
- outsidePath.AddLine(rect.Right - 4, rect.Bottom - 1, rect.Right - 2, rect.Bottom - 2.5f);
- outsidePath.AddLine(rect.Right - 2, rect.Bottom - 2.5f, rect.Right - 2, rect.Top + 1);
-
- // Create path for the bottom hightlight line
- GraphicsPath topPath = new GraphicsPath();
- topPath.AddLine(rect.Left + 3, rect.Bottom - 3, rect.Left + 4, rect.Bottom - 2);
- topPath.AddLine(rect.Left + 4, rect.Bottom - 2, rect.Right - 5, rect.Bottom - 2);
- topPath.AddLine(rect.Right - 5, rect.Bottom - 2, rect.Right - 4, rect.Bottom - 3);
-
- // Create the top and bottom half rectangles
- int full = rect.Height - 3;
- int half1 = full / 2;
- int half2 = full - half1;
- cache.half1Rect = new Rectangle(rect.Left + 3, rect.Bottom - 2 - half1, rect.Width - 6, half1);
- cache.half2Rect = new Rectangle(rect.Left + 3, rect.Bottom - 2 - half1 - half2, rect.Width - 6, half2);
- Rectangle fullRect = new Rectangle(rect.Left + 3, rect.Bottom - 2 - half1 - half2, rect.Width - 6, half1 + half2);
- RectangleF half1RectF = new RectangleF(cache.half1Rect.Left - 1, cache.half1Rect.Top - 0.5f, cache.half1Rect.Width + 2, cache.half1Rect.Height + 1);
- cache.half2RectF = new RectangleF(cache.half2Rect.Left - 1, cache.half2Rect.Top - 0.5f, cache.half2Rect.Width + 2, cache.half2Rect.Height + 1);
-
- cache.half1LeftBrush = new LinearGradientBrush(half1RectF, Color.FromArgb(85, c2), Color.Transparent, 180f)
- {
- Blend = _ribbonTabTopBlend
- };
- cache.half1RightBrush = new LinearGradientBrush(half1RectF, Color.FromArgb(85, c2), Color.Transparent, 0f)
- {
- Blend = _ribbonTabTopBlend
- };
- cache.half1LightBrush = new LinearGradientBrush(half1RectF, Color.FromArgb(28, Color.White), Color.FromArgb(125, Color.White), 270f);
- cache.half2Brush = new SolidBrush(Color.FromArgb(85, c2));
-
- // Create ellipse information for lightening the bottom hald
- cache.ellipseRect = new RectangleF(fullRect.Left - (fullRect.Width / 8), fullRect.Top, fullRect.Width * 1.25f, fullRect.Height);
-
- GraphicsPath ellipsePath = new GraphicsPath();
- // Cannot draw a path that contains a zero sized element
- if ((cache.ellipseRect.Width > 0) && (cache.ellipseRect.Height > 0))
- {
- ellipsePath.AddEllipse(cache.ellipseRect);
- cache.ellipseBrush = new PathGradientBrush(ellipsePath)
- {
- CenterColor = Color.FromArgb(92, Color.White)
- };
- PointF centerPoint = new PointF(cache.ellipseRect.Left + (cache.ellipseRect.Width / 2), cache.ellipseRect.Bottom - (cache.ellipseRect.Height / 2));
- cache.ellipseBrush.CenterPoint = centerPoint;
- cache.ellipseBrush.SurroundColors = new Color[] { Color.Transparent };
- }
-
- RectangleF vertRectF = new RectangleF(rect.Left - 1, rect.Top, rect.Width + 2, rect.Height - 2);
- RectangleF horzRectF = new RectangleF(rect.Left + 1, rect.Top, rect.Width - 2, rect.Height);
- cache.outsideBrush = new LinearGradientBrush(vertRectF, Color.Transparent, _whiten128, 270f)
- {
- Blend = _ribbonOutBlend
- };
- cache.insideBrush = new LinearGradientBrush(vertRectF, Color.Transparent, _whiten200, 270f)
- {
- Blend = _ribbonInBlend
- };
- cache.topBrush = new LinearGradientBrush(horzRectF, _whiten92, _whiten128, 180f)
- {
- Blend = _ribbonTopBlend
- };
- cache.topPen = new Pen(cache.topBrush);
-
- cache.outsidePen = new Pen(c1);
- cache.outsidePath = outsidePath;
- cache.topPath = topPath;
- cache.ellipsePath = ellipsePath;
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual void DrawRibbonTabTrackingBottomDraw2007(Rectangle rect,
- MementoRibbonTabTracking2007 cache,
- Graphics g)
- {
- g.FillRectangle(cache.outsideBrush, rect.Left, rect.Top + 1, 1, rect.Height - 4);
- g.FillRectangle(cache.insideBrush, rect.Left + 2, rect.Top + 1, 1, rect.Height - 4);
- g.FillRectangle(cache.outsideBrush, rect.Right - 1, rect.Top + 1, 1, rect.Height - 4);
- g.FillRectangle(cache.insideBrush, rect.Right - 3, rect.Top + 1, 1, rect.Height - 4);
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual IDisposable DrawRibbonTabTracking2010(PaletteRibbonShape shape,
- ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- PaletteState state,
- IPaletteRibbonBack palette,
- VisualOrientation orientation,
- IDisposable memento,
- bool standard)
- {
- if ((rect.Width > 0) && (rect.Height > 0))
- {
- Color c1 = palette.GetRibbonBackColor1(state);
- Color c2 = palette.GetRibbonBackColor2(state);
- Color c3 = palette.GetRibbonBackColor3(state);
- Color c4 = palette.GetRibbonBackColor4(state);
- Color c5 = palette.GetRibbonBackColor5(state);
-
- bool generate = true;
- MementoRibbonTabTracking2010 cache;
-
- // Access a cache instance and decide if cache resources need generating
- if (!(memento is MementoRibbonTabTracking2010))
- {
- memento?.Dispose();
-
- cache = new MementoRibbonTabTracking2010(rect, c1, c2, c3, c4, orientation);
- memento = cache;
- }
- else
- {
- cache = (MementoRibbonTabTracking2010)memento;
- generate = !cache.UseCachedValues(rect, c1, c2, c3, c4, orientation);
- }
-
- // Do we need to generate the contents of the cache?
- if (generate)
- {
- // Dispose of existing values
- cache.Dispose();
-
- // If c5 has a colour then use that to highlight the tab
- if (c5 != Color.Empty)
- {
- if (!standard)
- {
- c5 = CommonHelper.MergeColors(c5, 0.65f, Color.Black, 0.35f);
- }
-
- c1 = c5;
- c2 = CommonHelper.MergeColors(c2, 0.8f, ControlPaint.Light(c5), 0.2f);
- c3 = CommonHelper.MergeColors(c3, 0.7f, c5, 0.3f);
- }
-
- switch (orientation)
- {
- case VisualOrientation.Top:
- DrawRibbonTabTrackingTop2010(rect, c3, c4, cache);
- break;
- case VisualOrientation.Left:
- DrawRibbonTabTrackingLeft2010(rect, c3, c4, cache);
- break;
- case VisualOrientation.Right:
- DrawRibbonTabTrackingRight2010(rect, c3, c4, cache);
- break;
- case VisualOrientation.Bottom:
- DrawRibbonTabTrackingBottom2010(rect, c3, c4, cache);
- break;
- }
-
- cache.outsidePen = new Pen(c1);
- cache.outsideBrush = new SolidBrush(c2);
- }
-
- // Fill the full background
- context.Graphics.FillPath(cache.outsideBrush, cache.outsidePath);
-
- // Draw the border
- using (AntiAlias aa = new AntiAlias(context.Graphics))
- {
- context.Graphics.DrawPath(cache.outsidePen, cache.borderPath);
- }
-
- // Fill the inside area
- context.Graphics.FillPath(cache.insideBrush, cache.insidePath);
- }
-
- return memento;
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual void DrawRibbonTabTrackingTop2010(Rectangle rect,
- Color c3, Color c4,
- MementoRibbonTabTracking2010 cache)
- {
- GraphicsPath borderPath = new GraphicsPath();
- GraphicsPath outsidePath = new GraphicsPath();
- GraphicsPath insidePath = new GraphicsPath();
-
- // Create path for a border pen
- borderPath.AddLine(rect.Left, rect.Bottom - 2, rect.Left, rect.Top + 1.75f);
- borderPath.AddLine(rect.Left, rect.Top + 1.75f, rect.Left + 1, rect.Top);
- borderPath.AddLine(rect.Left + 1, rect.Top, rect.Right - 2, rect.Top);
- borderPath.AddLine(rect.Right - 2, rect.Top, rect.Right - 1, rect.Top + 1.75f);
- borderPath.AddLine(rect.Right - 1, rect.Top + 1.75f, rect.Right - 1, rect.Bottom - 2);
-
- // Create path for a inside fill
- outsidePath.AddLine(rect.Left, rect.Bottom - 1, rect.Left, rect.Top + 1.5f);
- outsidePath.AddLine(rect.Left, rect.Top + 1.5f, rect.Left + 1, rect.Top);
- outsidePath.AddLine(rect.Left + 1, rect.Top, rect.Right - 2, rect.Top);
- outsidePath.AddLine(rect.Right - 2, rect.Top, rect.Right - 1, rect.Top + 1.5f);
- outsidePath.AddLine(rect.Right - 1, rect.Top + 1.5f, rect.Right - 1, rect.Bottom - 1);
-
- // Reduce rectangle to the inside fill area
- rect.X += 2;
- rect.Y += 2;
- rect.Width -= 3;
- rect.Height -= 2;
-
- // Create path for a curved inside fill area
- insidePath.AddLine(rect.Left, rect.Bottom - 1, rect.Left, rect.Top + 1f);
- insidePath.AddLine(rect.Left, rect.Top + 1f, rect.Left + 1, rect.Top);
- insidePath.AddLine(rect.Left + 1, rect.Top, rect.Right - 2, rect.Top);
- insidePath.AddLine(rect.Right - 2, rect.Top, rect.Right - 1, rect.Top + 1f);
- insidePath.AddLine(rect.Right - 1, rect.Top + 1f, rect.Right - 1, rect.Bottom - 1);
-
- cache.borderPath = borderPath;
- cache.outsidePath = outsidePath;
- cache.insidePath = insidePath;
- cache.insideBrush = new LinearGradientBrush(new RectangleF(rect.X - 1, rect.Y - 1, rect.Width + 2, rect.Height + 2), c4, c3, 270f)
- {
- Blend = _linear50Blend
- };
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual void DrawRibbonTabTrackingBottom2010(Rectangle rect,
- Color c3, Color c4,
- MementoRibbonTabTracking2010 cache)
- {
- GraphicsPath borderPath = new GraphicsPath();
- GraphicsPath outsidePath = new GraphicsPath();
- GraphicsPath insidePath = new GraphicsPath();
-
- // Create path for a border pen
- borderPath.AddLine(rect.Left, rect.Top, rect.Left, rect.Bottom - 2.75f);
- borderPath.AddLine(rect.Left, rect.Bottom - 2.75f, rect.Left + 1, rect.Bottom - 1);
- borderPath.AddLine(rect.Left + 1, rect.Bottom - 1, rect.Right - 2, rect.Bottom - 1);
- borderPath.AddLine(rect.Right - 2, rect.Bottom - 1, rect.Right - 1, rect.Bottom - 2.75f);
- borderPath.AddLine(rect.Right - 1, rect.Bottom - 2.75f, rect.Right - 1, rect.Top);
-
- // Create path for a inside fill
- outsidePath.AddLine(rect.Left, rect.Top, rect.Left, rect.Bottom - 2.5f);
- outsidePath.AddLine(rect.Left, rect.Bottom - 2.5f, rect.Left + 1, rect.Bottom - 1);
- outsidePath.AddLine(rect.Left + 1, rect.Bottom - 1, rect.Right - 2, rect.Bottom - 1);
- outsidePath.AddLine(rect.Right - 2, rect.Bottom - 1, rect.Right - 1, rect.Bottom - 2.5f);
- outsidePath.AddLine(rect.Right - 1, rect.Bottom - 2.5f, rect.Right - 1, rect.Top);
-
- // Reduce rectangle to the inside fill area
- rect.X += 2;
- rect.Width -= 3;
- rect.Height -= 2;
-
- // Create path for a curved inside fill area
- insidePath.AddLine(rect.Left, rect.Top, rect.Left, rect.Bottom - 2);
- insidePath.AddLine(rect.Left, rect.Bottom - 2, rect.Left + 2, rect.Bottom);
- insidePath.AddLine(rect.Left + 2, rect.Bottom, rect.Right - 3, rect.Bottom);
- insidePath.AddLine(rect.Right - 3, rect.Bottom, rect.Right - 1, rect.Bottom - 2);
- insidePath.AddLine(rect.Right - 1, rect.Bottom - 2, rect.Right - 1, rect.Top);
-
- cache.borderPath = borderPath;
- cache.outsidePath = outsidePath;
- cache.insidePath = insidePath;
- cache.insideBrush = new LinearGradientBrush(new RectangleF(rect.X - 1, rect.Y - 1, rect.Width + 2, rect.Height + 2), c4, c3, 90f)
- {
- Blend = _linear50Blend
- };
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual void DrawRibbonTabTrackingLeft2010(Rectangle rect,
- Color c3, Color c4,
- MementoRibbonTabTracking2010 cache)
- {
- GraphicsPath borderPath = new GraphicsPath();
- GraphicsPath outsidePath = new GraphicsPath();
- GraphicsPath insidePath = new GraphicsPath();
-
- // Create path for a border pen
- borderPath.AddLine(rect.Right - 1, rect.Top, rect.Left + 1.75f, rect.Top);
- borderPath.AddLine(rect.Left + 1.75f, rect.Top, rect.Left, rect.Top + 1);
- borderPath.AddLine(rect.Left, rect.Top + 1, rect.Left, rect.Bottom - 2.5f);
- borderPath.AddLine(rect.Left, rect.Bottom - 2.5f, rect.Left + 1.75f, rect.Bottom - 1);
- borderPath.AddLine(rect.Left + 1.75f, rect.Bottom - 1, rect.Right - 1, rect.Bottom - 1);
-
- // Create path for a inside fill
- outsidePath.AddLine(rect.Right - 1, rect.Top, rect.Left + 1.75f, rect.Top);
- outsidePath.AddLine(rect.Left + 1.75f, rect.Top, rect.Left, rect.Top + 1);
- outsidePath.AddLine(rect.Left, rect.Top + 1, rect.Left, rect.Bottom - 2.5f);
- outsidePath.AddLine(rect.Left, rect.Bottom - 2.5f, rect.Left + 1.75f, rect.Bottom - 1);
- outsidePath.AddLine(rect.Left + 1.75f, rect.Bottom - 1, rect.Right - 1, rect.Bottom - 1);
-
- // Reduce rectangle to the inside fill area
- rect.X += 2;
- rect.Y += 2;
- rect.Width -= 2;
- rect.Height -= 3;
-
- // Create path for a curved inside fill area
- insidePath.AddLine(rect.Right - 1, rect.Top, rect.Left + 1, rect.Top);
- insidePath.AddLine(rect.Left + 1, rect.Top, rect.Left, rect.Top + 1);
- insidePath.AddLine(rect.Left, rect.Top + 1, rect.Left, rect.Bottom - 2);
- insidePath.AddLine(rect.Left, rect.Bottom - 2.5f, rect.Left + 1.5f, rect.Bottom - 1);
- insidePath.AddLine(rect.Left + 1.5f, rect.Bottom - 1, rect.Right - 1, rect.Bottom - 1);
-
- cache.borderPath = borderPath;
- cache.outsidePath = outsidePath;
- cache.insidePath = insidePath;
- cache.insideBrush = new LinearGradientBrush(new RectangleF(rect.X - 1, rect.Y - 1, rect.Width + 2, rect.Height + 2), c4, c3, 180f)
- {
- Blend = _linear50Blend
- };
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual void DrawRibbonTabTrackingRight2010(Rectangle rect,
- Color c3, Color c4,
- MementoRibbonTabTracking2010 cache)
- {
- GraphicsPath borderPath = new GraphicsPath();
- GraphicsPath outsidePath = new GraphicsPath();
- GraphicsPath insidePath = new GraphicsPath();
-
- // Create path for a border pen
- borderPath.AddLine(rect.Left, rect.Top, rect.Right - 2.75f, rect.Top);
- borderPath.AddLine(rect.Right - 2.75f, rect.Top, rect.Right - 1, rect.Top + 1);
- borderPath.AddLine(rect.Right - 1, rect.Top + 1, rect.Right - 1, rect.Bottom - 2.5f);
- borderPath.AddLine(rect.Right - 1, rect.Bottom - 2.5f, rect.Right - 2.75f, rect.Bottom - 1);
- borderPath.AddLine(rect.Right - 2.75f, rect.Bottom - 1, rect.Left, rect.Bottom - 1);
-
- // Create path for a inside fill
- outsidePath.AddLine(rect.Left, rect.Top, rect.Right - 2.75f, rect.Top);
- outsidePath.AddLine(rect.Right - 2.75f, rect.Top, rect.Right - 1, rect.Top + 1);
- outsidePath.AddLine(rect.Right - 1, rect.Top + 1, rect.Right - 1, rect.Bottom - 2.5f);
- outsidePath.AddLine(rect.Right - 1, rect.Bottom - 2.5f, rect.Right - 2.75f, rect.Bottom - 1);
- outsidePath.AddLine(rect.Right - 2.75f, rect.Bottom - 1, rect.Left, rect.Bottom - 1);
-
- // Reduce rectangle to the inside fill area
- rect.Y += 2;
- rect.Width -= 2;
- rect.Height -= 3;
-
- // Create path for a curved inside fill area
- insidePath.AddLine(rect.Left, rect.Top, rect.Right - 1, rect.Top);
- insidePath.AddLine(rect.Right - 1, rect.Top, rect.Right, rect.Top + 1);
- insidePath.AddLine(rect.Right, rect.Top + 1, rect.Right, rect.Bottom - 2.5f);
- insidePath.AddLine(rect.Right, rect.Bottom - 2.5f, rect.Right - 3.5f, rect.Bottom - 1);
- insidePath.AddLine(rect.Right - 3.5f, rect.Bottom - 1, rect.Left, rect.Bottom - 1);
-
- cache.borderPath = borderPath;
- cache.outsidePath = outsidePath;
- cache.insidePath = insidePath;
- cache.insideBrush = new LinearGradientBrush(new RectangleF(rect.X - 2, rect.Y - 1, rect.Width + 2, rect.Height + 2), c4, c3, 0f)
- {
- Blend = _linear50Blend
- };
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual IDisposable DrawRibbonTabFocus2010(PaletteRibbonShape shape,
- ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- PaletteState state,
- IPaletteRibbonBack palette,
- VisualOrientation orientation,
- IDisposable memento)
- {
- if ((rect.Width > 0) && (rect.Height > 0))
- {
- Color c1 = palette.GetRibbonBackColor1(state);
- Color c2 = palette.GetRibbonBackColor2(state);
- Color c3 = palette.GetRibbonBackColor3(state);
- Color c4 = palette.GetRibbonBackColor4(state);
- Color c5 = palette.GetRibbonBackColor5(state);
-
- bool generate = true;
- MementoRibbonTabTracking2010 cache;
-
- // Access a cache instance and decide if cache resources need generating
- if (!(memento is MementoRibbonTabTracking2010))
- {
- memento?.Dispose();
-
- cache = new MementoRibbonTabTracking2010(rect, c1, c2, c3, c4, orientation);
- memento = cache;
- }
- else
- {
- cache = (MementoRibbonTabTracking2010)memento;
- generate = !cache.UseCachedValues(rect, c1, c2, c3, c4, orientation);
- }
-
- // Do we need to generate the contents of the cache?
- if (generate)
- {
- // Dispose of existing values
- cache.Dispose();
-
- // If c5 has a colour then use that to highlight the tab
- if (c5 != Color.Empty)
- {
- c1 = c5;
- c2 = CommonHelper.MergeColors(c2, 0.8f, ControlPaint.Light(c5), 0.2f);
- c3 = CommonHelper.MergeColors(c3, 0.7f, c5, 0.3f);
- }
-
- switch (orientation)
- {
- case VisualOrientation.Top:
- DrawRibbonTabFocusTop2010(rect, c3, c4, cache);
- break;
- case VisualOrientation.Left:
- DrawRibbonTabFocusLeft2010(rect, c3, c4, cache);
- break;
- case VisualOrientation.Right:
- DrawRibbonTabFocusRight2010(rect, c3, c4, cache);
- break;
- case VisualOrientation.Bottom:
- DrawRibbonTabFocusBottom2010(rect, c3, c4, cache);
- break;
- }
-
- cache.outsidePen = new Pen(c1);
- cache.outsideBrush = new SolidBrush(c2);
- }
-
- // Fill the full background
- context.Graphics.FillPath(cache.outsideBrush, cache.outsidePath);
-
- // Draw the border
- using (AntiAlias aa = new AntiAlias(context.Graphics))
- {
- context.Graphics.DrawPath(cache.outsidePen, cache.borderPath);
- }
-
- // Fill the inside area
- context.Graphics.FillPath(cache.insideBrush, cache.insidePath);
- }
-
- return memento;
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual void DrawRibbonTabFocusTop2010(Rectangle rect,
- Color c3, Color c4,
- MementoRibbonTabTracking2010 cache)
- {
- GraphicsPath borderPath = new GraphicsPath();
- GraphicsPath outsidePath = new GraphicsPath();
- GraphicsPath insidePath = new GraphicsPath();
-
- // Create path for a border pen
- borderPath.AddLine(rect.Left, rect.Bottom - 1, rect.Left + 1, rect.Bottom - 2);
- borderPath.AddLine(rect.Left + 1, rect.Bottom - 2, rect.Left + 1, rect.Top + 1.75f);
- borderPath.AddLine(rect.Left + 1, rect.Top + 1.75f, rect.Left + 2, rect.Top);
- borderPath.AddLine(rect.Left + 2, rect.Top, rect.Right - 3, rect.Top);
- borderPath.AddLine(rect.Right - 3, rect.Top, rect.Right - 2, rect.Top + 1.75f);
- borderPath.AddLine(rect.Right - 2, rect.Top + 1.75f, rect.Right - 2, rect.Bottom - 2);
- borderPath.AddLine(rect.Right - 2, rect.Bottom - 2, rect.Right - 1, rect.Bottom - 1);
-
- // Create path for a inside fill
- outsidePath.AddLine(rect.Left, rect.Bottom, rect.Left + 1, rect.Bottom - 1);
- outsidePath.AddLine(rect.Left + 1, rect.Bottom - 1, rect.Left + 1, rect.Top + 1.5f);
- outsidePath.AddLine(rect.Left + 1, rect.Top + 1.5f, rect.Left + 2, rect.Top);
- outsidePath.AddLine(rect.Left + 2, rect.Top, rect.Right - 3, rect.Top);
- outsidePath.AddLine(rect.Right - 3, rect.Top, rect.Right - 2, rect.Top + 1.5f);
- outsidePath.AddLine(rect.Right - 2, rect.Top + 1.5f, rect.Right - 2, rect.Bottom - 1);
- outsidePath.AddLine(rect.Right - 2, rect.Bottom - 1, rect.Right - 1, rect.Bottom - 1);
-
- // Reduce rectangle to the inside fill area
- rect.X += 2;
- rect.Y += 2;
- rect.Width -= 3;
- rect.Height -= 2;
-
- // Create path for a curved inside fill area
- insidePath.AddLine(rect.Left - 2, rect.Bottom, rect.Left + 1, rect.Bottom - 2);
- insidePath.AddLine(rect.Left + 1, rect.Bottom - 2, rect.Left + 1, rect.Top + 1f);
- insidePath.AddLine(rect.Left + 1, rect.Top + 1f, rect.Left + 2, rect.Top);
- insidePath.AddLine(rect.Left + 2, rect.Top, rect.Right - 3, rect.Top);
- insidePath.AddLine(rect.Right - 3, rect.Top, rect.Right - 2, rect.Top + 1f);
- insidePath.AddLine(rect.Right - 2, rect.Top + 1f, rect.Right - 2, rect.Bottom - 2);
- insidePath.AddLine(rect.Right - 2, rect.Bottom - 2, rect.Right - 1, rect.Bottom - 1);
-
- cache.borderPath = borderPath;
- cache.outsidePath = outsidePath;
- cache.insidePath = insidePath;
- cache.insideBrush = new LinearGradientBrush(new RectangleF(rect.X - 1, rect.Y - 1, rect.Width + 2, rect.Height + 2), c4, c3, 270f)
- {
- Blend = _linear50Blend
- };
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual void DrawRibbonTabFocusBottom2010(Rectangle rect,
- Color c3, Color c4,
- MementoRibbonTabTracking2010 cache)
- {
- GraphicsPath borderPath = new GraphicsPath();
- GraphicsPath outsidePath = new GraphicsPath();
- GraphicsPath insidePath = new GraphicsPath();
-
- // Create path for a border pen
- borderPath.AddLine(rect.Left, rect.Top, rect.Left + 1, rect.Top + 1);
- borderPath.AddLine(rect.Left + 1, rect.Top + 1, rect.Left + 1, rect.Bottom - 2.75f);
- borderPath.AddLine(rect.Left + 1, rect.Bottom - 2.75f, rect.Left + 2, rect.Bottom - 1);
- borderPath.AddLine(rect.Left + 2, rect.Bottom - 1, rect.Right - 3, rect.Bottom - 1);
- borderPath.AddLine(rect.Right - 3, rect.Bottom - 1, rect.Right - 2, rect.Bottom - 2.75f);
- borderPath.AddLine(rect.Right - 2, rect.Bottom - 2.75f, rect.Right - 2, rect.Top + 1);
- borderPath.AddLine(rect.Right - 2, rect.Top + 1, rect.Right - 1, rect.Top);
-
- // Create path for a inside fill
- outsidePath.AddLine(rect.Left, rect.Top, rect.Left + 1, rect.Top);
- outsidePath.AddLine(rect.Left + 1, rect.Top, rect.Left + 1, rect.Bottom - 2.5f);
- outsidePath.AddLine(rect.Left + 1, rect.Bottom - 2.5f, rect.Left + 2, rect.Bottom - 1);
- outsidePath.AddLine(rect.Left + 2, rect.Bottom - 1, rect.Right - 2, rect.Bottom - 1);
- outsidePath.AddLine(rect.Right - 2, rect.Bottom - 1, rect.Right - 1, rect.Bottom - 2.5f);
- outsidePath.AddLine(rect.Right - 1, rect.Bottom - 2.5f, rect.Right - 1, rect.Top);
- outsidePath.AddLine(rect.Right - 1, rect.Top, rect.Right, rect.Top);
-
- // Reduce rectangle to the inside fill area
- rect.X += 2;
- rect.Width -= 3;
- rect.Height -= 2;
-
- // Create path for a curved inside fill area
- insidePath.AddLine(rect.Left - 2, rect.Top - 1, rect.Left + 1, rect.Top + 1);
- insidePath.AddLine(rect.Left + 1, rect.Top + 1, rect.Left + 1, rect.Bottom - 2);
- insidePath.AddLine(rect.Left + 1, rect.Bottom - 2, rect.Left + 3, rect.Bottom);
- insidePath.AddLine(rect.Left + 3, rect.Bottom, rect.Right - 4, rect.Bottom);
- insidePath.AddLine(rect.Right - 4, rect.Bottom, rect.Right - 3, rect.Bottom - 1);
- insidePath.AddLine(rect.Right - 2, rect.Bottom - 1, rect.Right - 2, rect.Top + 1);
- insidePath.AddLine(rect.Right - 2, rect.Top + 1, rect.Right - 1, rect.Top);
-
- cache.borderPath = borderPath;
- cache.outsidePath = outsidePath;
- cache.insidePath = insidePath;
- cache.insideBrush = new LinearGradientBrush(new RectangleF(rect.X - 1, rect.Y - 1, rect.Width + 2, rect.Height + 2), c4, c3, 90f)
- {
- Blend = _linear50Blend
- };
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual void DrawRibbonTabFocusLeft2010(Rectangle rect,
- Color c3, Color c4,
- MementoRibbonTabTracking2010 cache)
- {
- GraphicsPath borderPath = new GraphicsPath();
- GraphicsPath outsidePath = new GraphicsPath();
- GraphicsPath insidePath = new GraphicsPath();
-
- // Create path for a border pen
- borderPath.AddLine(rect.Right - 1, rect.Top - 1, rect.Right - 2, rect.Top);
- borderPath.AddLine(rect.Right - 2, rect.Top, rect.Left + 1.75f, rect.Top);
- borderPath.AddLine(rect.Left + 1.75f, rect.Top, rect.Left, rect.Top + 1);
- borderPath.AddLine(rect.Left, rect.Top + 2, rect.Left, rect.Bottom - 3.5f);
- borderPath.AddLine(rect.Left, rect.Bottom - 3.5f, rect.Left + 1.75f, rect.Bottom - 2);
- borderPath.AddLine(rect.Left + 1.75f, rect.Bottom - 2, rect.Right - 2, rect.Bottom - 2);
- borderPath.AddLine(rect.Right - 2, rect.Bottom - 2, rect.Right - 1, rect.Bottom - 1);
-
- // Create path for a inside fill
- outsidePath.AddLine(rect.Right, rect.Top, rect.Left + 1.75f, rect.Top);
- outsidePath.AddLine(rect.Left + 1.75f, rect.Top, rect.Left, rect.Top + 1);
- outsidePath.AddLine(rect.Left, rect.Top + 1, rect.Left, rect.Bottom - 2.5f);
- outsidePath.AddLine(rect.Left, rect.Bottom - 2.5f, rect.Left + 1.75f, rect.Bottom - 1);
- outsidePath.AddLine(rect.Left + 1.75f, rect.Bottom - 1, rect.Right, rect.Bottom - 1);
-
- // Reduce rectangle to the inside fill area
- rect.X += 2;
- rect.Y += 2;
- rect.Width -= 2;
- rect.Height -= 3;
-
- // Create path for a curved inside fill area
- insidePath.AddLine(rect.Right - 1, rect.Top - 2, rect.Right - 1, rect.Top);
- insidePath.AddLine(rect.Right - 1, rect.Top, rect.Left + 1, rect.Top);
- insidePath.AddLine(rect.Left + 1, rect.Top, rect.Left, rect.Top + 1);
- insidePath.AddLine(rect.Left, rect.Top + 1, rect.Left, rect.Bottom - 4);
- insidePath.AddLine(rect.Left, rect.Bottom - 4, rect.Left + 2, rect.Bottom - 2);
- insidePath.AddLine(rect.Left + 2, rect.Bottom - 2, rect.Right - 1, rect.Bottom - 2);
- insidePath.AddLine(rect.Right - 1, rect.Bottom - 2, rect.Right, rect.Bottom);
-
- cache.borderPath = borderPath;
- cache.outsidePath = outsidePath;
- cache.insidePath = insidePath;
- cache.insideBrush = new LinearGradientBrush(new RectangleF(rect.X - 1, rect.Y - 1, rect.Width + 2, rect.Height + 2), c4, c3, 180f)
- {
- Blend = _linear50Blend
- };
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual void DrawRibbonTabFocusRight2010(Rectangle rect,
- Color c3, Color c4,
- MementoRibbonTabTracking2010 cache)
- {
- GraphicsPath borderPath = new GraphicsPath();
- GraphicsPath outsidePath = new GraphicsPath();
- GraphicsPath insidePath = new GraphicsPath();
-
- // Create path for a border pen
- borderPath.AddLine(rect.Left, rect.Top - 1, rect.Left + 1, rect.Top);
- borderPath.AddLine(rect.Left + 1, rect.Top, rect.Right - 2.75f, rect.Top);
- borderPath.AddLine(rect.Right - 2.75f, rect.Top, rect.Right - 1, rect.Top + 1);
- borderPath.AddLine(rect.Right - 1, rect.Top + 2, rect.Right - 1, rect.Bottom - 3.5f);
- borderPath.AddLine(rect.Right - 1, rect.Bottom - 3.5f, rect.Right - 2.75f, rect.Bottom - 2);
- borderPath.AddLine(rect.Right - 2.75f, rect.Bottom - 2, rect.Left + 1, rect.Bottom - 2);
- borderPath.AddLine(rect.Left + 1, rect.Bottom - 2, rect.Left, rect.Bottom - 1);
-
- // Create path for a inside fill
- outsidePath.AddLine(rect.Left, rect.Top, rect.Right - 2.75f, rect.Top);
- outsidePath.AddLine(rect.Right - 2.75f, rect.Top, rect.Right - 1, rect.Top + 1);
- outsidePath.AddLine(rect.Right - 1, rect.Top + 1, rect.Right - 1, rect.Bottom - 2.5f);
- outsidePath.AddLine(rect.Right - 1, rect.Bottom - 2.5f, rect.Right - 2.75f, rect.Bottom - 1);
- outsidePath.AddLine(rect.Right - 2.75f, rect.Bottom - 1, rect.Left, rect.Bottom - 1);
-
- // Reduce rectangle to the inside fill area
- rect.Y += 2;
- rect.Width -= 2;
- rect.Height -= 3;
-
- // Create path for a curved inside fill area
- insidePath.AddLine(rect.Left, rect.Top - 2, rect.Left + 1, rect.Top);
- insidePath.AddLine(rect.Left + 1, rect.Top, rect.Right - 1, rect.Top);
- insidePath.AddLine(rect.Right - 1, rect.Top, rect.Right, rect.Top + 1);
- insidePath.AddLine(rect.Right, rect.Top + 1, rect.Right, rect.Bottom - 4);
- insidePath.AddLine(rect.Right, rect.Bottom - 4, rect.Right - 2, rect.Bottom - 2);
- insidePath.AddLine(rect.Right - 2, rect.Bottom - 2, rect.Left + 1, rect.Bottom - 2);
- insidePath.AddLine(rect.Left + 1, rect.Bottom - 2, rect.Left, rect.Bottom - 1);
-
- cache.borderPath = borderPath;
- cache.outsidePath = outsidePath;
- cache.insidePath = insidePath;
- cache.insideBrush = new LinearGradientBrush(new RectangleF(rect.X - 2, rect.Y - 1, rect.Width + 2, rect.Height + 2), c4, c3, 0f)
- {
- Blend = _linear50Blend
- };
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual IDisposable DrawRibbonTabGlowing(PaletteRibbonShape shape,
- ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- PaletteState state,
- IPaletteRibbonBack palette,
- VisualOrientation orientation,
- IDisposable memento)
- {
- if ((rect.Width > 0) && (rect.Height > 0))
- {
- Color c1 = palette.GetRibbonBackColor1(state);
- Color c2 = palette.GetRibbonBackColor2(state);
- Color insideColor = Color.FromArgb(36, c2);
-
- bool generate = true;
- MementoRibbonTabGlowing cache;
-
- // Access a cache instance and decide if cache resources need generating
- if (!(memento is MementoRibbonTabGlowing))
- {
- memento?.Dispose();
-
- cache = new MementoRibbonTabGlowing(rect, c1, c2, insideColor, orientation);
- memento = cache;
- }
- else
- {
- cache = (MementoRibbonTabGlowing)memento;
- generate = !cache.UseCachedValues(rect, c1, c2, insideColor, orientation);
- }
-
- // Do we need to generate the contents of the cache?
- if (generate)
- {
- // Dispose of existing values
- cache.Dispose();
-
- switch (orientation)
- {
- case VisualOrientation.Top:
- DrawRibbonTabGlowingTop(rect, c1, c2, insideColor, cache);
- break;
- case VisualOrientation.Left:
- DrawRibbonTabGlowingLeft(rect, c1, c2, insideColor, cache);
- break;
- case VisualOrientation.Right:
- DrawRibbonTabGlowingRight(rect, c1, c2, insideColor, cache);
- break;
- case VisualOrientation.Bottom:
- DrawRibbonTabGlowingBottom(rect, c1, c2, insideColor, cache);
- break;
- }
- }
-
- // Fill the path area with inside color
- context.Graphics.FillPath(cache.insideBrush, cache.outsidePath);
-
- switch (orientation)
- {
- case VisualOrientation.Top:
- // Draw the missing line from the bottom of the inside area
- context.Graphics.DrawLine(cache.insidePen, rect.Left + 1, rect.Bottom - 2, rect.Right - 2, rect.Bottom - 2);
- break;
- case VisualOrientation.Left:
- // Draw the missing line from the right of the inside area
- context.Graphics.DrawLine(cache.insidePen, rect.Right - 2, rect.Top + 1, rect.Right - 2, rect.Bottom - 2);
- break;
- }
-
- // Draw the border over the edge of the inside color
- using (AntiAlias aa = new AntiAlias(context.Graphics))
- {
- context.Graphics.DrawPath(cache.outsidePen, cache.outsidePath);
- }
-
- // Draw the top glass effect
- context.Graphics.FillPath(cache.topBrush, cache.topPath);
-
- // Cannot draw a path that contains a zero sized element
- if ((cache.ellipseRect.Width > 0) && (cache.ellipseRect.Height > 0))
- {
- context.Graphics.FillRectangle(cache.ellipseBrush, cache.fullRect);
- }
- }
-
- return memento;
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual void DrawRibbonTabGlowingTop(Rectangle rect,
- Color c1, Color c2, Color insideColor,
- MementoRibbonTabGlowing cache)
- {
- GraphicsPath outsidePath = new GraphicsPath();
- GraphicsPath topPath = new GraphicsPath();
- GraphicsPath ellipsePath = new GraphicsPath();
-
- // Create path for a curved border around the tab
- outsidePath.AddLine(rect.Left, rect.Bottom - 2, rect.Left, rect.Top + 1.5f);
- outsidePath.AddLine(rect.Left, rect.Top + 1.5f, rect.Left + 2, rect.Top);
- outsidePath.AddLine(rect.Left + 2, rect.Top, rect.Right - 4, rect.Top);
- outsidePath.AddLine(rect.Right - 4, rect.Top, rect.Right - 2, rect.Top + 1.5f);
- outsidePath.AddLine(rect.Right - 2, rect.Top + 1.5f, rect.Right - 2, rect.Bottom - 2);
-
- // Create path for the top glassy effect
- int q4 = rect.Height / 4;
- topPath.AddLine(rect.Left + 2, rect.Top + 1, rect.Left + 1, rect.Top + 2);
- topPath.AddLine(rect.Left + 1, rect.Top + 2, rect.Left + 1, rect.Top + 2 + q4);
- topPath.AddLine(rect.Left + 1, rect.Top + 2 + q4, rect.Left + 4, rect.Top + 5 + q4);
- topPath.AddLine(rect.Left + 4, rect.Top + 5 + q4, rect.Right - 5, rect.Top + 5 + q4);
- topPath.AddLine(rect.Right - 5, rect.Top + 5 + q4, rect.Right - 2, rect.Top + 2 + q4);
- topPath.AddLine(rect.Right - 2, rect.Top + 2 + q4, rect.Right - 2, rect.Top + 2);
- topPath.AddLine(rect.Right - 2, rect.Top + 2, rect.Right - 3, rect.Top + 1);
-
- RectangleF topRectF = new RectangleF(rect.Left, rect.Top, rect.Width, q4 + 5);
- cache.topBrush = new LinearGradientBrush(topRectF, c1, Color.Transparent, 90f);
-
- int ellipseWidth = (int)(rect.Width * 1.2f);
- int ellipseHeight = (int)(rect.Height * 0.4f);
- cache.fullRect = new RectangleF(rect.Left + 1, rect.Top + 1, rect.Width - 3, rect.Height - 2);
- cache.ellipseRect = new RectangleF(rect.Left - ((ellipseWidth - rect.Width) / 2), rect.Bottom - ellipseHeight, ellipseWidth, ellipseHeight * 2);
-
- // Cannot draw a path that contains a zero sized element
- if ((cache.ellipseRect.Width > 0) && (cache.ellipseRect.Height > 0))
- {
- ellipsePath.AddEllipse(cache.ellipseRect);
- cache.ellipseBrush = new PathGradientBrush(ellipsePath)
- {
- CenterColor = c2
- };
- PointF centerPoint = new PointF(cache.ellipseRect.Left + (cache.ellipseRect.Width / 2), cache.ellipseRect.Top + (cache.ellipseRect.Height / 2));
- cache.ellipseBrush.CenterPoint = centerPoint;
- cache.ellipseBrush.SurroundColors = new Color[] { Color.Transparent };
- }
-
- cache.insideBrush = new SolidBrush(insideColor);
- cache.insidePen = new Pen(insideColor);
- cache.outsidePen = new Pen(c1);
- cache.outsidePath = outsidePath;
- cache.topPath = topPath;
- cache.ellipsePath = ellipsePath;
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual void DrawRibbonTabGlowingLeft(Rectangle rect,
- Color c1, Color c2, Color insideColor,
- MementoRibbonTabGlowing cache)
- {
- GraphicsPath outsidePath = new GraphicsPath();
- GraphicsPath topPath = new GraphicsPath();
- GraphicsPath ellipsePath = new GraphicsPath();
-
- // Create path for a curved border around the tab
- outsidePath.AddLine(rect.Right - 2, rect.Bottom - 1, rect.Left + 1.5f, rect.Bottom - 1);
- outsidePath.AddLine(rect.Left + 1.5f, rect.Bottom - 1, rect.Left, rect.Bottom - 3);
- outsidePath.AddLine(rect.Left, rect.Bottom - 3, rect.Left, rect.Top + 3);
- outsidePath.AddLine(rect.Left, rect.Top + 3, rect.Left + 1.5f, rect.Top + 1);
- outsidePath.AddLine(rect.Left + 1.5f, rect.Top + 1, rect.Right - 2, rect.Top + 1);
-
- // Create path for the top glassy effect
- int q4 = rect.Height / 4;
- topPath.AddLine(rect.Left + 1, rect.Bottom - 2, rect.Left + 2, rect.Bottom - 1);
- topPath.AddLine(rect.Left + 2, rect.Bottom - 1, rect.Left + 2 + q4, rect.Bottom - 1);
- topPath.AddLine(rect.Left + 2 + q4, rect.Bottom - 1, rect.Left + 5 + q4, rect.Bottom - 4);
- topPath.AddLine(rect.Left + 5 + q4, rect.Bottom - 4, rect.Left + 5 + q4, rect.Top + 4);
- topPath.AddLine(rect.Left + 5 + q4, rect.Top + 4, rect.Left + 2 + q4, rect.Top + 1);
- topPath.AddLine(rect.Left + 2 + q4, rect.Top + 1, rect.Left + 2, rect.Top + 2);
- topPath.AddLine(rect.Left + 2, rect.Top + 2, rect.Left + 1, rect.Top + 2);
-
- RectangleF topRectF = new RectangleF(rect.Left, rect.Top, q4 + 5, rect.Height);
- cache.topBrush = new LinearGradientBrush(topRectF, c1, Color.Transparent, 0f);
-
- int ellipseWidth = (int)(rect.Width * 0.4f);
- int ellipseHeight = (int)(rect.Height * 1.2f);
- cache.fullRect = new RectangleF(rect.Left + 1, rect.Top + 2, rect.Width - 2, rect.Height - 3);
- cache.ellipseRect = new RectangleF(rect.Right - ellipseWidth, rect.Top - ((ellipseHeight - rect.Height) / 2), ellipseWidth * 2, ellipseHeight);
-
- // Cannot draw a path that contains a zero sized element
- if ((cache.ellipseRect.Width > 0) && (cache.ellipseRect.Height > 0))
- {
- ellipsePath.AddEllipse(cache.ellipseRect);
- cache.ellipseBrush = new PathGradientBrush(ellipsePath)
- {
- CenterColor = c2
- };
- PointF centerPoint = new PointF(cache.ellipseRect.Left + (cache.ellipseRect.Width / 2), cache.ellipseRect.Top + (cache.ellipseRect.Height / 2));
- cache.ellipseBrush.CenterPoint = centerPoint;
- cache.ellipseBrush.SurroundColors = new Color[] { Color.Transparent };
- }
-
- cache.insideBrush = new SolidBrush(insideColor);
- cache.insidePen = new Pen(insideColor);
- cache.outsidePen = new Pen(c1);
- cache.outsidePath = outsidePath;
- cache.topPath = topPath;
- cache.ellipsePath = ellipsePath;
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual void DrawRibbonTabGlowingRight(Rectangle rect,
- Color c1, Color c2, Color insideColor,
- MementoRibbonTabGlowing cache)
- {
- GraphicsPath outsidePath = new GraphicsPath();
- GraphicsPath topPath = new GraphicsPath();
- GraphicsPath ellipsePath = new GraphicsPath();
-
- // Create path for a curved border around the tab
- outsidePath.AddLine(rect.Left + 1, rect.Bottom - 1, rect.Right - 2.5f, rect.Bottom - 1);
- outsidePath.AddLine(rect.Right - 2.5f, rect.Bottom - 1, rect.Right - 1, rect.Bottom - 3);
- outsidePath.AddLine(rect.Right - 1, rect.Bottom - 3, rect.Right - 1, rect.Top + 3);
- outsidePath.AddLine(rect.Right - 1, rect.Top + 3, rect.Right - 2.5f, rect.Top + 1);
- outsidePath.AddLine(rect.Right - 2.5f, rect.Top + 1, rect.Left + 1, rect.Top + 1);
-
- // Create path for the top glassy effect
- int q4 = rect.Height / 4;
- topPath.AddLine(rect.Right - 1, rect.Bottom - 2, rect.Right - 2, rect.Bottom - 1);
- topPath.AddLine(rect.Right - 2, rect.Bottom - 1, rect.Right - 2 - q4, rect.Bottom - 1);
- topPath.AddLine(rect.Right - 2 - q4, rect.Bottom - 1, rect.Right - 5 - q4, rect.Bottom - 4);
- topPath.AddLine(rect.Right - 5 - q4, rect.Bottom - 4, rect.Right - 5 - q4, rect.Top + 4);
- topPath.AddLine(rect.Right - 5 - q4, rect.Top + 4, rect.Right - 2 - q4, rect.Top + 1);
- topPath.AddLine(rect.Right - 2 - q4, rect.Top + 1, rect.Right - 2, rect.Top + 2);
- topPath.AddLine(rect.Right - 2, rect.Top + 2, rect.Right - 1, rect.Top + 2);
-
- RectangleF topRectF = new RectangleF(rect.Right - q4 - 5, rect.Top, q4 + 5, rect.Height);
- cache.topBrush = new LinearGradientBrush(topRectF, c1, Color.Transparent, 180f);
-
- int ellipseWidth = (int)(rect.Width * 0.4f);
- int ellipseHeight = (int)(rect.Height * 1.2f);
- cache.fullRect = new RectangleF(rect.Left + 1, rect.Top + 2, rect.Width - 2, rect.Height - 3);
- cache.ellipseRect = new RectangleF(rect.Left - ellipseWidth, rect.Top - ((ellipseHeight - rect.Height) / 2), ellipseWidth * 2, ellipseHeight);
-
- // Cannot draw a path that contains a zero sized element
- if ((cache.ellipseRect.Width > 0) && (cache.ellipseRect.Height > 0))
- {
- ellipsePath.AddEllipse(cache.ellipseRect);
- cache.ellipseBrush = new PathGradientBrush(ellipsePath)
- {
- CenterColor = c2
- };
- PointF centerPoint = new PointF(cache.ellipseRect.Left + (cache.ellipseRect.Width / 2), cache.ellipseRect.Top + (cache.ellipseRect.Height / 2));
- cache.ellipseBrush.CenterPoint = centerPoint;
- cache.ellipseBrush.SurroundColors = new Color[] { Color.Transparent };
- }
-
- cache.insideBrush = new SolidBrush(insideColor);
- cache.insidePen = new Pen(insideColor);
- cache.outsidePen = new Pen(c1);
- cache.outsidePath = outsidePath;
- cache.topPath = topPath;
- cache.ellipsePath = ellipsePath;
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual void DrawRibbonTabGlowingBottom(Rectangle rect,
- Color c1, Color c2, Color insideColor,
- MementoRibbonTabGlowing cache)
- {
- GraphicsPath outsidePath = new GraphicsPath();
- GraphicsPath topPath = new GraphicsPath();
- GraphicsPath ellipsePath = new GraphicsPath();
-
- // Create path for a curved border around the tab
- outsidePath.AddLine(rect.Left, rect.Top + 1, rect.Left, rect.Bottom - 2.5f);
- outsidePath.AddLine(rect.Left, rect.Bottom - 2.5f, rect.Left + 2, rect.Bottom - 1);
- outsidePath.AddLine(rect.Left + 2, rect.Bottom - 1, rect.Right - 4, rect.Bottom - 1);
- outsidePath.AddLine(rect.Right - 4, rect.Bottom - 1, rect.Right - 2, rect.Bottom - 2.5f);
- outsidePath.AddLine(rect.Right - 2, rect.Bottom - 2.5f, rect.Right - 2, rect.Top + 1);
-
- // Create path for the bottom glassy effect
- int q4 = rect.Height / 4;
- topPath.AddLine(rect.Left + 2, rect.Bottom - 1, rect.Left + 1, rect.Bottom - 2);
- topPath.AddLine(rect.Left + 1, rect.Bottom - 2, rect.Left + 1, rect.Bottom - 2 - q4);
- topPath.AddLine(rect.Left + 1, rect.Bottom - 2 - q4, rect.Left + 4, rect.Bottom - 5 - q4);
- topPath.AddLine(rect.Left + 4, rect.Bottom - 5 - q4, rect.Right - 5, rect.Bottom - 5 - q4);
- topPath.AddLine(rect.Right - 5, rect.Bottom - 5 - q4, rect.Right - 2, rect.Bottom - 2 - q4);
- topPath.AddLine(rect.Right - 2, rect.Bottom - 2 - q4, rect.Right - 2, rect.Bottom - 2);
- topPath.AddLine(rect.Right - 2, rect.Bottom - 2, rect.Right - 3, rect.Bottom - 1);
-
- RectangleF topRectF = new RectangleF(rect.Left, rect.Bottom - 6 - q4, rect.Width, q4 + 5);
- cache.topBrush = new LinearGradientBrush(topRectF, c1, Color.Transparent, 270f);
-
- int ellipseWidth = (int)(rect.Width * 1.2f);
- int ellipseHeight = (int)(rect.Height * 0.4f);
- cache.fullRect = new RectangleF(rect.Left + 1, rect.Top + 1, rect.Width - 3, rect.Height - 2);
- cache.ellipseRect = new RectangleF(rect.Left - ((ellipseWidth - rect.Width) / 2), rect.Top - ellipseHeight, ellipseWidth, ellipseHeight * 2);
-
- // Cannot draw a path that contains a zero sized element
- if ((cache.ellipseRect.Width > 0) && (cache.ellipseRect.Height > 0))
- {
- ellipsePath.AddEllipse(cache.ellipseRect);
- cache.ellipseBrush = new PathGradientBrush(ellipsePath)
- {
- CenterColor = c2
- };
- PointF centerPoint = new PointF(cache.ellipseRect.Left + (cache.ellipseRect.Width / 2), cache.ellipseRect.Bottom - 1 - (cache.ellipseRect.Height / 2));
- cache.ellipseBrush.CenterPoint = centerPoint;
- cache.ellipseBrush.SurroundColors = new Color[] { Color.Transparent };
- }
-
- cache.insideBrush = new SolidBrush(insideColor);
- cache.insidePen = new Pen(insideColor);
- cache.outsidePen = new Pen(c1);
- cache.outsidePath = outsidePath;
- cache.topPath = topPath;
- cache.ellipsePath = ellipsePath;
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual IDisposable DrawRibbonTabSelected2007(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- PaletteState state,
- IPaletteRibbonBack palette,
- VisualOrientation orientation,
- IDisposable memento)
- {
- if ((rect.Width > 0) && (rect.Height > 0))
- {
- Color c1 = palette.GetRibbonBackColor1(state);
- Color c2 = palette.GetRibbonBackColor2(state);
- Color c3 = palette.GetRibbonBackColor3(state);
- Color c4 = palette.GetRibbonBackColor4(state);
- Color c5 = palette.GetRibbonBackColor5(state);
-
- bool generate = true;
- MementoRibbonTabSelected2007 cache;
-
- // Access a cache instance and decide if cache resources need generating
- if (!(memento is MementoRibbonTabSelected2007))
- {
- memento?.Dispose();
-
- cache = new MementoRibbonTabSelected2007(rect, c1, c2, c3, c4, c5, orientation);
- memento = cache;
- }
- else
- {
- cache = (MementoRibbonTabSelected2007)memento;
- generate = !cache.UseCachedValues(rect, c1, c2, c3, c4, c5, orientation);
- }
-
- // Do we need to generate the contents of the cache?
- if (generate)
- {
- // Dispose of existing values
- cache.Dispose();
-
- switch (orientation)
- {
- case VisualOrientation.Top:
- DrawRibbonTabSelectedTop2007(rect, c4, c5, cache);
- break;
- case VisualOrientation.Left:
- DrawRibbonTabSelectedLeft2007(rect, c4, c5, cache);
- break;
- case VisualOrientation.Right:
- DrawRibbonTabSelectedRight2007(rect, c4, c5, cache);
- break;
- case VisualOrientation.Bottom:
- DrawRibbonTabSelectedBottom2007(rect, c4, c5, cache);
- break;
- }
-
- cache.insideBrush = new SolidBrush(c3);
- cache.outsidePen = new Pen(c1);
- cache.middlePen = new Pen(c2);
- cache.insidePen = new Pen(c3);
- cache.centerPen = new Pen(c5);
- }
-
- // Fill the inside of the border
- context.Graphics.FillPath(cache.insideBrush, cache.outsidePath);
-
- // Draw the actual border
- using (AntiAlias aa = new AntiAlias(context.Graphics))
- {
- context.Graphics.DrawPath(cache.outsidePen, cache.outsidePath);
- }
-
- switch (orientation)
- {
- case VisualOrientation.Top:
- DrawRibbonTabSelectedTopDraw2007(rect, cache, context.Graphics);
- break;
- case VisualOrientation.Left:
- DrawRibbonTabSelectedLeftDraw2007(rect, cache, context.Graphics);
- break;
- case VisualOrientation.Right:
- DrawRibbonTabSelectedRightDraw2007(rect, cache, context.Graphics);
- break;
- case VisualOrientation.Bottom:
- DrawRibbonTabSelectedBottomDraw2007(rect, cache, context.Graphics);
- break;
- }
-
- // Fill in the center as a vertical gradient from tto bottom
- context.Graphics.FillRectangle(cache.centerBrush, cache.centerRect);
- }
-
- return memento;
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual void DrawRibbonTabSelectedTop2007(Rectangle rect,
- Color c4, Color c5,
- MementoRibbonTabSelected2007 cache)
- {
- GraphicsPath outsidePath = new GraphicsPath();
-
- // Create path for a curved dark border around the tab
- outsidePath.AddLine(rect.Left, rect.Bottom - 2, rect.Left + 1, rect.Bottom - 3);
- outsidePath.AddLine(rect.Left + 1, rect.Bottom - 3, rect.Left + 1, rect.Top + 1.5f);
- outsidePath.AddLine(rect.Left + 1, rect.Top + 1.5f, rect.Left + 3, rect.Top);
- outsidePath.AddLine(rect.Left + 3, rect.Top, rect.Right - 4, rect.Top);
- outsidePath.AddLine(rect.Right - 4, rect.Top, rect.Right - 2, rect.Top + 1.5f);
- outsidePath.AddLine(rect.Right - 2, rect.Top + 1.5f, rect.Right - 2, rect.Bottom - 3);
- outsidePath.AddLine(rect.Right - 2, rect.Bottom - 3, rect.Right - 1, rect.Bottom - 2);
-
- cache.centerRect = new Rectangle(rect.Left + 4, rect.Top + 4, rect.Width - 8, rect.Height - 4);
- RectangleF centerRectF = new RectangleF(cache.centerRect.Left - 1, cache.centerRect.Top - 1, cache.centerRect.Width + 2, cache.centerRect.Height + 2);
- cache.centerBrush = new LinearGradientBrush(centerRectF, c4, c5, 90f);
- cache.outsidePath = outsidePath;
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual void DrawRibbonTabSelectedTopDraw2007(Rectangle rect,
- MementoRibbonTabSelected2007 cache,
- Graphics g)
- {
- // Fill in the bottom two lines that the 'FillPath' above missed
- g.DrawLine(cache.insidePen, rect.Left + 1, rect.Bottom - 1, rect.Right - 2, rect.Bottom - 1);
- g.DrawLine(cache.insidePen, rect.Left + 2, rect.Bottom - 2, rect.Right - 3, rect.Bottom - 2);
- g.DrawLine(cache.centerPen, rect.Left + 3, rect.Bottom - 1, rect.Right - 4, rect.Bottom - 1);
-
- using (AntiAlias aa = new AntiAlias(g))
- {
- // Draw a line on the inside of the left and right border edges
- g.DrawLine(cache.middlePen, rect.Left + 0.5f, rect.Bottom - 1, rect.Left + 2, rect.Bottom - 3);
- g.DrawLine(cache.middlePen, rect.Left + 2, rect.Bottom - 3, rect.Left + 2, rect.Top + 2);
- g.DrawLine(cache.middlePen, rect.Right - 1.5f, rect.Bottom - 1, rect.Right - 3, rect.Bottom - 3);
- g.DrawLine(cache.middlePen, rect.Right - 3, rect.Bottom - 3, rect.Right - 3, rect.Top + 2);
-
- // Draw shadow lines on the outside of the left and right edges
- g.DrawLine(_paleShadowPen, rect.Left - 1, rect.Bottom - 2, rect.Left - 1, rect.Top + 8);
- g.DrawLine(_lightShadowPen, rect.Left, rect.Bottom - 3, rect.Left, rect.Top + 5);
- g.DrawLine(_darkShadowPen, rect.Right - 1, rect.Bottom - 3, rect.Right - 1, rect.Top + 3);
- g.DrawLine(_mediumShadowPen, rect.Right, rect.Bottom - 2, rect.Right, rect.Top + 7);
- }
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual void DrawRibbonTabSelectedLeft2007(Rectangle rect,
- Color c4, Color c5,
- MementoRibbonTabSelected2007 cache)
- {
- GraphicsPath outsidePath = new GraphicsPath();
-
- // Create path for a curved dark border around the tab
- outsidePath.AddLine(rect.Right - 2, rect.Bottom - 1, rect.Right - 3, rect.Bottom - 2);
- outsidePath.AddLine(rect.Right - 3, rect.Bottom - 2, rect.Left + 1.5f, rect.Bottom - 2);
- outsidePath.AddLine(rect.Left + 1.5f, rect.Bottom - 2, rect.Left, rect.Bottom - 4);
- outsidePath.AddLine(rect.Left, rect.Bottom - 4, rect.Left, rect.Top + 3);
- outsidePath.AddLine(rect.Left, rect.Top + 3, rect.Left + 1.5f, rect.Top + 1);
- outsidePath.AddLine(rect.Left + 1.5f, rect.Top + 1, rect.Right - 3, rect.Top + 1);
- outsidePath.AddLine(rect.Right - 3, rect.Top + 1, rect.Right - 1, rect.Top);
-
- cache.centerRect = new Rectangle(rect.Left + 4, rect.Top + 4, rect.Width - 4, rect.Height - 8);
- RectangleF centerRectF = new RectangleF(cache.centerRect.Left - 1, cache.centerRect.Top - 1, cache.centerRect.Width + 2, cache.centerRect.Height + 2);
- cache.centerBrush = new LinearGradientBrush(centerRectF, c4, c5, 0f);
- cache.outsidePath = outsidePath;
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual void DrawRibbonTabSelectedLeftDraw2007(Rectangle rect,
- MementoRibbonTabSelected2007 cache,
- Graphics g)
- {
- // Fill in the bottom two lines that the 'FillPath' above missed
- g.DrawLine(cache.insidePen, rect.Right - 1, rect.Bottom - 2, rect.Right - 1, rect.Top + 1);
- g.DrawLine(cache.insidePen, rect.Right - 2, rect.Bottom - 3, rect.Right - 2, rect.Top + 2);
- g.DrawLine(cache.centerPen, rect.Right - 1, rect.Bottom - 4, rect.Right - 1, rect.Top + 3);
-
- using (AntiAlias aa = new AntiAlias(g))
- {
- // Draw a line on the inside of the left and right border edges
- g.DrawLine(cache.middlePen, rect.Right - 1, rect.Bottom - 1.5f, rect.Right - 3, rect.Bottom - 3);
- g.DrawLine(cache.middlePen, rect.Right - 3, rect.Bottom - 3, rect.Left + 2, rect.Bottom - 3);
- g.DrawLine(cache.middlePen, rect.Right - 1, rect.Top + 0.5f, rect.Right - 3, rect.Top + 2);
- g.DrawLine(cache.middlePen, rect.Right - 3, rect.Top + 2, rect.Left + 2, rect.Top + 2);
-
- // Draw shadow lines on the outside of the left and right edges
- g.DrawLine(_paleShadowPen, rect.Right - 2, rect.Bottom, rect.Left + 8, rect.Bottom);
- g.DrawLine(_lightShadowPen, rect.Right - 3, rect.Bottom - 1, rect.Left + 5, rect.Bottom - 1);
- g.DrawLine(_darkShadowPen, rect.Right - 3, rect.Top, rect.Left + 3, rect.Top);
- g.DrawLine(_mediumShadowPen, rect.Right - 2, rect.Top - 1, rect.Left + 7, rect.Top - 1);
- }
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual void DrawRibbonTabSelectedRight2007(Rectangle rect,
- Color c4, Color c5,
- MementoRibbonTabSelected2007 cache)
- {
- GraphicsPath outsidePath = new GraphicsPath();
-
- // Create path for a curved dark border around the tab
- outsidePath.AddLine(rect.Left + 1, rect.Bottom - 1, rect.Left + 2, rect.Bottom - 2);
- outsidePath.AddLine(rect.Left + 2, rect.Bottom - 2, rect.Right - 2.5f, rect.Bottom - 2);
- outsidePath.AddLine(rect.Right - 2.5f, rect.Bottom - 2, rect.Right - 1, rect.Bottom - 4);
- outsidePath.AddLine(rect.Right - 1, rect.Bottom - 4, rect.Right - 1, rect.Top + 3);
- outsidePath.AddLine(rect.Right - 1, rect.Top + 3, rect.Right - 2.5f, rect.Top + 1);
- outsidePath.AddLine(rect.Right - 2.5f, rect.Top + 1, rect.Left + 2, rect.Top + 1);
- outsidePath.AddLine(rect.Left + 2, rect.Top + 1, rect.Left, rect.Top);
-
- cache.centerRect = new Rectangle(rect.Left, rect.Top + 4, rect.Width - 4, rect.Height - 8);
- RectangleF centerRectF = new RectangleF(cache.centerRect.Left - 1, cache.centerRect.Top - 1, cache.centerRect.Width + 2, cache.centerRect.Height + 2);
- cache.centerBrush = new LinearGradientBrush(centerRectF, c4, c5, 180f);
- cache.outsidePath = outsidePath;
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual void DrawRibbonTabSelectedRightDraw2007(Rectangle rect,
- MementoRibbonTabSelected2007 cache,
- Graphics g)
- {
- // Fill in the bottom two lines that the 'FillPath' above missed
- g.DrawLine(cache.insidePen, rect.Left, rect.Bottom - 2, rect.Left, rect.Top + 1);
- g.DrawLine(cache.insidePen, rect.Left + 1, rect.Bottom - 3, rect.Left + 1, rect.Top + 2);
- g.DrawLine(cache.centerPen, rect.Left, rect.Bottom - 4, rect.Left, rect.Top + 3);
-
- using (AntiAlias aa = new AntiAlias(g))
- {
- // Draw a line on the inside of the left and right border edges
- g.DrawLine(cache.middlePen, rect.Left, rect.Bottom - 1.5f, rect.Left + 2, rect.Bottom - 3);
- g.DrawLine(cache.middlePen, rect.Left + 2, rect.Bottom - 3, rect.Right - 3, rect.Bottom - 3);
- g.DrawLine(cache.middlePen, rect.Left, rect.Top + 0.5f, rect.Left + 2, rect.Top + 2);
- g.DrawLine(cache.middlePen, rect.Left + 2, rect.Top + 2, rect.Right - 3, rect.Top + 2);
-
- // Draw shadow lines on the outside of the left and right edges
- g.DrawLine(_paleShadowPen, rect.Left + 1, rect.Bottom, rect.Right - 9, rect.Bottom);
- g.DrawLine(_lightShadowPen, rect.Left + 2, rect.Bottom - 1, rect.Right - 6, rect.Bottom - 1);
- g.DrawLine(_darkShadowPen, rect.Left + 2, rect.Top, rect.Right - 4, rect.Top);
- g.DrawLine(_mediumShadowPen, rect.Left + 1, rect.Top - 1, rect.Right - 8, rect.Top - 1);
- }
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual void DrawRibbonTabSelectedBottom2007(Rectangle rect,
- Color c4, Color c5,
- MementoRibbonTabSelected2007 cache)
- {
- GraphicsPath outsidePath = new GraphicsPath();
-
- // Create path for a curved dark border around the tab
- outsidePath.AddLine(rect.Left, rect.Top + 1, rect.Left + 1, rect.Top + 2);
- outsidePath.AddLine(rect.Left + 1, rect.Top + 2, rect.Left + 1, rect.Bottom - 2.5f);
- outsidePath.AddLine(rect.Left + 1, rect.Bottom - 2.5f, rect.Left + 3, rect.Bottom - 1);
- outsidePath.AddLine(rect.Left + 3, rect.Bottom - 1, rect.Right - 4, rect.Bottom - 1);
- outsidePath.AddLine(rect.Right - 4, rect.Bottom - 1, rect.Right - 2, rect.Bottom - 2.5f);
- outsidePath.AddLine(rect.Right - 2, rect.Bottom - 2.5f, rect.Right - 2, rect.Top + 2);
- outsidePath.AddLine(rect.Right - 2, rect.Top + 2, rect.Right - 1, rect.Top + 1);
-
- cache.centerRect = new Rectangle(rect.Left + 4, rect.Top, rect.Width - 8, rect.Height - 4);
- RectangleF centerRectF = new RectangleF(cache.centerRect.Left - 1, cache.centerRect.Top - 1, cache.centerRect.Width + 2, cache.centerRect.Height + 2);
- cache.centerBrush = new LinearGradientBrush(centerRectF, c4, c5, 270f);
- cache.outsidePath = outsidePath;
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual void DrawRibbonTabSelectedBottomDraw2007(Rectangle rect,
- MementoRibbonTabSelected2007 cache,
- Graphics g)
- {
- // Fill in the bottom two lines that the 'FillPath' above missed
- g.DrawLine(cache.insidePen, rect.Left + 1, rect.Top, rect.Right - 2, rect.Top);
- g.DrawLine(cache.insidePen, rect.Left + 2, rect.Top + 1, rect.Right - 3, rect.Top + 1);
- g.DrawLine(cache.centerPen, rect.Left + 3, rect.Top, rect.Right - 4, rect.Top);
-
- using (AntiAlias aa = new AntiAlias(g))
- {
- // Draw a line on the inside of the left and right border edges
- g.DrawLine(cache.middlePen, rect.Left + 0.5f, rect.Top, rect.Left + 2, rect.Top + 2);
- g.DrawLine(cache.middlePen, rect.Left + 2, rect.Top + 2, rect.Left + 2, rect.Bottom - 3);
- g.DrawLine(cache.middlePen, rect.Right - 1.5f, rect.Top, rect.Right - 3, rect.Top + 2);
- g.DrawLine(cache.middlePen, rect.Right - 3, rect.Top + 2, rect.Right - 3, rect.Bottom - 3);
-
- // Draw shadow lines on the outside of the left and right edges
- g.DrawLine(_paleShadowPen, rect.Left - 1, rect.Top + 1, rect.Left - 1, rect.Bottom - 9);
- g.DrawLine(_lightShadowPen, rect.Left, rect.Top + 2, rect.Left, rect.Bottom - 6);
- g.DrawLine(_darkShadowPen, rect.Right - 1, rect.Top + 2, rect.Right - 1, rect.Bottom - 4);
- g.DrawLine(_mediumShadowPen, rect.Right, rect.Top + 1, rect.Right, rect.Bottom - 8);
- }
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual IDisposable DrawRibbonTabSelected2010(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- PaletteState state,
- IPaletteRibbonBack palette,
- VisualOrientation orientation,
- IDisposable memento,
- bool standard)
- {
- if ((rect.Width > 0) && (rect.Height > 0))
- {
- Color c1 = palette.GetRibbonBackColor1(state);
- Color c2 = palette.GetRibbonBackColor2(state);
- Color c3 = palette.GetRibbonBackColor3(state);
- Color c4 = palette.GetRibbonBackColor4(state);
- Color c5 = palette.GetRibbonBackColor5(state);
-
- bool generate = true;
- MementoRibbonTabSelected2010 cache;
-
- // Access a cache instance and decide if cache resources need generating
- if (!(memento is MementoRibbonTabSelected2010))
- {
- memento?.Dispose();
-
- cache = new MementoRibbonTabSelected2010(rect, c1, c2, c3, c4, c5, orientation);
- memento = cache;
- }
- else
- {
- cache = (MementoRibbonTabSelected2010)memento;
- generate = !cache.UseCachedValues(rect, c1, c2, c3, c4, c5, orientation);
- }
-
- // Do we need to generate the contents of the cache?
- if (generate)
- {
- // Dispose of existing values
- cache.Dispose();
-
- // If we have a context color to use then modify the drawing colors
- if (c5 != Color.Empty)
- {
- if (!standard)
- {
- c5 = CommonHelper.MergeColors(c5, 0.65f, Color.Black, 0.35f);
- }
-
- c1 = Color.FromArgb(196, c5);
- }
-
- switch (orientation)
- {
- case VisualOrientation.Top:
- DrawRibbonTabSelectedTop2010(rect, c2, c3, c5, cache);
- break;
- case VisualOrientation.Left:
- DrawRibbonTabSelectedLeft2010(rect, c2, c3, c5, cache);
- break;
- case VisualOrientation.Right:
- DrawRibbonTabSelectedRight2010(rect, c2, c3, c5, cache);
- break;
- case VisualOrientation.Bottom:
- DrawRibbonTabSelectedBottom2010(rect, c2, c3, c5, cache);
- break;
- }
-
- cache.outsidePen = new Pen(c1);
- cache.centerPen = new Pen(c4);
- }
-
- context.Graphics.FillPath(cache.centerBrush, cache.outsidePath);
-
- if (c5 != Color.Empty)
- {
- context.Graphics.FillPath(cache.insideBrush, cache.insidePath);
- }
-
- using (AntiAlias aa = new AntiAlias(context.Graphics))
- {
- context.Graphics.DrawPath(cache.outsidePen, cache.outsidePath);
- }
-
- switch (orientation)
- {
- case VisualOrientation.Top:
- DrawRibbonTabSelectedTopDraw2010(rect, cache, context.Graphics);
- break;
- case VisualOrientation.Left:
- DrawRibbonTabSelectedLeftDraw2010(rect, cache, context.Graphics);
- break;
- case VisualOrientation.Right:
- DrawRibbonTabSelectedRightDraw2010(rect, cache, context.Graphics);
- break;
- case VisualOrientation.Bottom:
- DrawRibbonTabSelectedBottomDraw2010(rect, cache, context.Graphics);
- break;
- }
- }
-
- return memento;
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual void DrawRibbonTabSelectedTop2010(Rectangle rect,
- Color c2, Color c3, Color c5,
- MementoRibbonTabSelected2010 cache)
- {
- GraphicsPath outsidePath = new GraphicsPath();
- GraphicsPath insidePath = new GraphicsPath();
-
- // Create path for a curved dark border around the tab
- outsidePath.AddLine(rect.Left, rect.Bottom - 2, rect.Left + 1, rect.Bottom - 3);
- outsidePath.AddLine(rect.Left + 1, rect.Bottom - 3, rect.Left + 1, rect.Top + 1);
- outsidePath.AddLine(rect.Left + 1, rect.Top + 1, rect.Left + 3, rect.Top);
- outsidePath.AddLine(rect.Left + 3, rect.Top, rect.Right - 4, rect.Top);
- outsidePath.AddLine(rect.Right - 4, rect.Top, rect.Right - 2, rect.Top + 1);
- outsidePath.AddLine(rect.Right - 2, rect.Top + 1, rect.Right - 2, rect.Bottom - 3);
- outsidePath.AddLine(rect.Right - 2, rect.Bottom - 3, rect.Right - 1, rect.Bottom - 2);
-
- RectangleF centerRectF = new RectangleF(rect.Left - 1, rect.Top - 1, rect.Width + 2, rect.Height + 2);
- cache.centerBrush = new LinearGradientBrush(centerRectF, c2, c3, 90f)
- {
- Blend = _ribbonTabSelected1Blend
- };
- cache.outsidePath = outsidePath;
-
- // Reduce rectangle to the inside fill area
- rect.X += 2;
- rect.Y += 2;
- rect.Width -= 3;
- rect.Height -= 2;
-
- // Create path for a curved inside border
- insidePath.AddLine(rect.Left, rect.Bottom - 2, rect.Left + 1, rect.Bottom - 3);
- insidePath.AddLine(rect.Left + 1, rect.Bottom - 3, rect.Left + 1, rect.Top + 1);
- insidePath.AddLine(rect.Left + 1, rect.Top + 1, rect.Left + 2, rect.Top);
- insidePath.AddLine(rect.Left + 2, rect.Top, rect.Right - 3, rect.Top);
- insidePath.AddLine(rect.Right - 3, rect.Top, rect.Right - 2, rect.Top + 1);
- insidePath.AddLine(rect.Right - 2, rect.Top + 1, rect.Right - 2, rect.Bottom - 3);
- insidePath.AddLine(rect.Right - 2, rect.Bottom - 3, rect.Right - 1, rect.Bottom - 2);
-
- RectangleF insideRectF = new RectangleF(rect.Left - 1, rect.Top - 1, rect.Width + 2, rect.Height + 2);
- cache.insideBrush = new LinearGradientBrush(insideRectF, Color.FromArgb(32, c5), Color.Transparent, 90f)
- {
- Blend = _ribbonTabSelected2Blend
- };
- cache.insidePath = insidePath;
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual void DrawRibbonTabSelectedTopDraw2010(Rectangle rect,
- MementoRibbonTabSelected2010 cache,
- Graphics g)
- {
- // Fill in the bottom two lines that the 'FillPath' above missed
- g.DrawLine(cache.centerPen, rect.Left + 2, rect.Bottom - 2, rect.Right - 3, rect.Bottom - 2);
- g.DrawLine(cache.centerPen, rect.Left + 1, rect.Bottom - 1, rect.Right - 2, rect.Bottom - 1);
-
- using (AntiAlias aa = new AntiAlias(g))
- {
- // Draw shadow lines on the outside of the left and right edges
- g.DrawLine(_mediumShadowPen, rect.Left, rect.Bottom - 3, rect.Left, rect.Top + 2);
- g.DrawLine(_mediumShadowPen, rect.Right - 1, rect.Bottom - 3, rect.Right - 1, rect.Top + 2);
- }
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual void DrawRibbonTabSelectedLeft2010(Rectangle rect,
- Color c2, Color c3, Color c5,
- MementoRibbonTabSelected2010 cache)
- {
- GraphicsPath outsidePath = new GraphicsPath();
- GraphicsPath insidePath = new GraphicsPath();
-
- // Create path for a curved dark border around the tab
- outsidePath.AddLine(rect.Right - 2, rect.Bottom - 1, rect.Right - 2, rect.Bottom - 2);
- outsidePath.AddLine(rect.Right - 2, rect.Bottom - 2, rect.Left + 1, rect.Bottom - 2);
- outsidePath.AddLine(rect.Left + 1, rect.Bottom - 2, rect.Left, rect.Bottom - 4);
- outsidePath.AddLine(rect.Left, rect.Bottom - 4, rect.Left, rect.Top + 3);
- outsidePath.AddLine(rect.Left, rect.Top + 3, rect.Left + 1, rect.Top + 1);
- outsidePath.AddLine(rect.Left + 1, rect.Top + 1, rect.Right - 2, rect.Top + 1);
- outsidePath.AddLine(rect.Right - 2, rect.Top + 1, rect.Right - 2, rect.Top);
-
- RectangleF centerRectF = new RectangleF(rect.Left - 1, rect.Top - 1, rect.Width + 2, rect.Height + 2);
- cache.centerBrush = new LinearGradientBrush(centerRectF, c2, c3, 0f)
- {
- Blend = _ribbonTabSelected1Blend
- };
- cache.outsidePath = outsidePath;
-
- // Reduce rectangle to the inside fill area
- rect.X += 2;
- rect.Y += 2;
- rect.Width -= 2;
- rect.Height -= 3;
-
- // Create path for a curved inside border
- insidePath.AddLine(rect.Right - 2, rect.Bottom - 1, rect.Right - 2, rect.Bottom - 2);
- insidePath.AddLine(rect.Right - 2, rect.Bottom - 2, rect.Left + 1, rect.Bottom - 2);
- insidePath.AddLine(rect.Left + 1, rect.Bottom - 2, rect.Left, rect.Bottom - 4);
- insidePath.AddLine(rect.Left, rect.Bottom - 4, rect.Left, rect.Top + 2);
- insidePath.AddLine(rect.Left, rect.Top + 2, rect.Left + 1, rect.Top + 1);
- insidePath.AddLine(rect.Left + 1, rect.Top + 1, rect.Right - 2, rect.Top + 1);
- insidePath.AddLine(rect.Right - 2, rect.Top + 1, rect.Right - 2, rect.Top);
-
- RectangleF insideRectF = new RectangleF(rect.Left - 1, rect.Top - 1, rect.Width + 2, rect.Height + 2);
- cache.insideBrush = new LinearGradientBrush(insideRectF, Color.FromArgb(32, c5), Color.Transparent, 0f)
- {
- Blend = _ribbonTabSelected2Blend
- };
- cache.insidePath = insidePath;
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual void DrawRibbonTabSelectedLeftDraw2010(Rectangle rect,
- MementoRibbonTabSelected2010 cache,
- Graphics g)
- {
- // Fill in the bottom two lines that the 'FillPath' above missed
- g.DrawLine(cache.centerPen, rect.Right - 2, rect.Bottom - 3, rect.Right - 2, rect.Top + 2);
- g.DrawLine(cache.centerPen, rect.Right - 1, rect.Bottom - 2, rect.Right - 1, rect.Top + 1);
-
- using (AntiAlias aa = new AntiAlias(g))
- {
- // Draw shadow lines on the outside of the top and bottom edges
- g.DrawLine(_mediumShadowPen, rect.Right - 3, rect.Bottom - 1, rect.Left + 3, rect.Bottom - 1);
- g.DrawLine(_mediumShadowPen, rect.Right - 3, rect.Top, rect.Left + 3, rect.Top);
- }
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual void DrawRibbonTabSelectedRight2010(Rectangle rect,
- Color c2, Color c3, Color c5,
- MementoRibbonTabSelected2010 cache)
- {
- GraphicsPath outsidePath = new GraphicsPath();
- GraphicsPath insidePath = new GraphicsPath();
-
- // Create path for a curved dark border around the tab
- outsidePath.AddLine(rect.Left + 1, rect.Bottom - 1, rect.Left + 1, rect.Bottom - 2);
- outsidePath.AddLine(rect.Left + 2, rect.Bottom - 2, rect.Right - 2, rect.Bottom - 2);
- outsidePath.AddLine(rect.Right - 2, rect.Bottom - 2, rect.Right - 1, rect.Bottom - 4);
- outsidePath.AddLine(rect.Right - 1, rect.Bottom - 4, rect.Right - 1, rect.Top + 3);
- outsidePath.AddLine(rect.Right - 1, rect.Top + 3, rect.Right - 2, rect.Top + 1);
- outsidePath.AddLine(rect.Right - 2, rect.Top + 1, rect.Left + 1, rect.Top + 1);
- outsidePath.AddLine(rect.Left + 1, rect.Top + 1, rect.Left + 1, rect.Top);
-
- RectangleF centerRectF = new RectangleF(rect.Left - 1, rect.Top - 1, rect.Width + 2, rect.Height + 2);
- cache.centerBrush = new LinearGradientBrush(centerRectF, c2, c3, 180f)
- {
- Blend = _ribbonTabSelected1Blend
- };
- cache.outsidePath = outsidePath;
-
- // Reduce rectangle to the inside fill area
- rect.Y += 2;
- rect.Width -= 1;
- rect.Height -= 3;
-
- // Create path for a curved inside border
- insidePath.AddLine(rect.Left + 1, rect.Bottom - 1, rect.Left + 1, rect.Bottom - 2);
- insidePath.AddLine(rect.Left + 2, rect.Bottom - 2, rect.Right - 3, rect.Bottom - 2);
- insidePath.AddLine(rect.Right - 3, rect.Bottom - 2, rect.Right - 1, rect.Bottom - 4);
- insidePath.AddLine(rect.Right - 1, rect.Bottom - 4, rect.Right - 1, rect.Top + 3);
- insidePath.AddLine(rect.Right - 1, rect.Top + 3, rect.Right - 2, rect.Top + 1);
- insidePath.AddLine(rect.Right - 2, rect.Top + 1, rect.Left + 1, rect.Top + 1);
- insidePath.AddLine(rect.Left + 1, rect.Top + 1, rect.Left + 1, rect.Top);
-
- RectangleF insideRectF = new RectangleF(rect.Left - 1, rect.Top - 1, rect.Width + 2, rect.Height + 2);
- cache.insideBrush = new LinearGradientBrush(insideRectF, Color.FromArgb(32, c5), Color.Transparent, 180f)
- {
- Blend = _ribbonTabSelected2Blend
- };
- cache.insidePath = insidePath;
-
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual void DrawRibbonTabSelectedRightDraw2010(Rectangle rect,
- MementoRibbonTabSelected2010 cache,
- Graphics g)
- {
- // Fill in the bottom two lines that the 'FillPath' above missed
- g.DrawLine(cache.centerPen, rect.Left + 1, rect.Bottom - 3, rect.Left + 1, rect.Top + 2);
- g.DrawLine(cache.centerPen, rect.Left, rect.Bottom - 2, rect.Left, rect.Top + 1);
-
- using (AntiAlias aa = new AntiAlias(g))
- {
- // Draw shadow lines on the outside of the top and bottom edges
- g.DrawLine(_mediumShadowPen, rect.Left + 2, rect.Bottom - 1, rect.Right - 4, rect.Bottom - 1);
- g.DrawLine(_mediumShadowPen, rect.Left + 2, rect.Top, rect.Right - 4, rect.Top);
- }
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual void DrawRibbonTabSelectedBottom2010(Rectangle rect,
- Color c2, Color c3, Color c5,
- MementoRibbonTabSelected2010 cache)
- {
- GraphicsPath outsidePath = new GraphicsPath();
- GraphicsPath insidePath = new GraphicsPath();
-
- // Create path for a curved dark border around the tab
- outsidePath.AddLine(rect.Left, rect.Top + 1, rect.Left + 1, rect.Top + 1);
- outsidePath.AddLine(rect.Left + 1, rect.Top + 1, rect.Left + 1, rect.Bottom - 2);
- outsidePath.AddLine(rect.Left + 1, rect.Bottom - 2, rect.Left + 3, rect.Bottom - 1);
- outsidePath.AddLine(rect.Left + 3, rect.Bottom - 1, rect.Right - 4, rect.Bottom - 1);
- outsidePath.AddLine(rect.Right - 4, rect.Bottom - 1, rect.Right - 2, rect.Bottom - 3);
- outsidePath.AddLine(rect.Right - 2, rect.Bottom - 3, rect.Right - 2, rect.Top + 1);
- outsidePath.AddLine(rect.Right - 2, rect.Top + 1, rect.Right - 1, rect.Top + 1);
-
- RectangleF centerRectF = new RectangleF(rect.Left - 1, rect.Top - 1, rect.Width + 2, rect.Height + 2);
- cache.centerBrush = new LinearGradientBrush(centerRectF, c2, c3, 270f)
- {
- Blend = _ribbonTabSelected1Blend
- };
- cache.outsidePath = outsidePath;
-
- // Reduce rectangle to the inside fill area
- rect.X += 2;
- rect.Width -= 3;
- rect.Height -= 1;
-
- // Create path for a curved inside border
- insidePath.AddLine(rect.Left, rect.Top + 1, rect.Left + 1, rect.Top + 1);
- insidePath.AddLine(rect.Left + 1, rect.Top + 1, rect.Left + 1, rect.Bottom - 3);
- insidePath.AddLine(rect.Left + 1, rect.Bottom - 3, rect.Left + 2, rect.Bottom - 1);
- insidePath.AddLine(rect.Left + 2, rect.Bottom - 1, rect.Right - 4, rect.Bottom - 1);
- insidePath.AddLine(rect.Right - 4, rect.Bottom - 1, rect.Right - 2, rect.Bottom - 3);
- insidePath.AddLine(rect.Right - 2, rect.Bottom - 3, rect.Right - 2, rect.Top + 1);
- insidePath.AddLine(rect.Right - 2, rect.Top + 1, rect.Right - 1, rect.Top + 1);
-
- RectangleF insideRectF = new RectangleF(rect.Left - 1, rect.Top - 1, rect.Width + 2, rect.Height + 2);
- cache.insideBrush = new LinearGradientBrush(insideRectF, Color.FromArgb(32, c5), Color.Transparent, 270f)
- {
- Blend = _ribbonTabSelected2Blend
- };
- cache.insidePath = insidePath;
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual void DrawRibbonTabSelectedBottomDraw2010(Rectangle rect,
- MementoRibbonTabSelected2010 cache,
- Graphics g)
- {
- // Fill in the bottom two lines that the 'FillPath' above missed
- g.DrawLine(cache.centerPen, rect.Left + 2, rect.Top + 1, rect.Right - 3, rect.Top + 1);
- g.DrawLine(cache.centerPen, rect.Left + 1, rect.Top, rect.Right - 2, rect.Top);
-
- using (AntiAlias aa = new AntiAlias(g))
- {
- // Draw shadow lines on the outside of the left and right edges
- g.DrawLine(_mediumShadowPen, rect.Left, rect.Top + 2, rect.Left, rect.Bottom - 4);
- g.DrawLine(_mediumShadowPen, rect.Right - 1, rect.Top + 2, rect.Right - 1, rect.Bottom - 4);
- }
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual IDisposable DrawRibbonTabContextSelected(PaletteRibbonShape shape,
- ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- PaletteState state,
- IPaletteRibbonBack palette,
- VisualOrientation orientation,
- IDisposable memento)
- {
- if ((rect.Width > 0) && (rect.Height > 0))
- {
- Color c1 = palette.GetRibbonBackColor1(state);
- Color c2 = palette.GetRibbonBackColor2(state);
-
- bool generate = true;
- MementoRibbonTabContextSelected cache;
-
- // Access a cache instance and decide if cache resources need generating
- if (!(memento is MementoRibbonTabContextSelected))
- {
- memento?.Dispose();
-
- cache = new MementoRibbonTabContextSelected(rect, c1, c2, orientation);
- memento = cache;
- }
- else
- {
- cache = (MementoRibbonTabContextSelected)memento;
- generate = !cache.UseCachedValues(rect, c1, c2, orientation);
- }
-
- // Do we need to generate the contents of the cache?
- if (generate)
- {
- // Dispose of existing values
- cache.Dispose();
-
- switch (orientation)
- {
- case VisualOrientation.Top:
- DrawRibbonTabContextSelectedTop(rect, c2, cache);
- break;
- case VisualOrientation.Left:
- DrawRibbonTabContextSelectedLeft(rect, c2, cache);
- break;
- case VisualOrientation.Right:
- DrawRibbonTabContextSelectedRight(rect, c2, cache);
- break;
- case VisualOrientation.Bottom:
- DrawRibbonTabContextSelectedBottom(rect, c2, cache);
- break;
- }
-
- cache.outsidePen = new Pen(c1);
- cache.l1 = new Pen(Color.FromArgb(100, c2));
- cache.l2 = new Pen(Color.FromArgb(75, c2));
- cache.l3 = new Pen(Color.FromArgb(48, c2));
- cache.bottomInnerPen = new Pen(Color.FromArgb(70, c2));
- cache.bottomOuterPen = new Pen(Color.FromArgb(100, c2));
- }
-
- // Fill the interior using a gradient brush
- context.Graphics.FillRectangle(Brushes.White, cache.interiorRect);
- context.Graphics.FillRectangle(cache.insideBrush, cache.interiorRect);
-
- // Draw the actual border
- using (AntiAlias aa = new AntiAlias(context.Graphics))
- {
- context.Graphics.DrawPath(cache.outsidePen, cache.outsidePath);
- }
-
- switch (orientation)
- {
- case VisualOrientation.Top:
- DrawRibbonTabContextSelectedTopDraw(rect, cache, context.Graphics);
- break;
- case VisualOrientation.Left:
- DrawRibbonTabContextSelectedLeftDraw(rect, cache, context.Graphics);
- break;
- case VisualOrientation.Right:
- DrawRibbonTabContextSelectedRightDraw(rect, cache, context.Graphics);
- break;
- case VisualOrientation.Bottom:
- DrawRibbonTabContextSelectedBottomDraw(rect, cache, context.Graphics);
- break;
- }
- }
-
- return memento;
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual void DrawRibbonTabContextSelectedTop(Rectangle rect,
- Color c2,
- MementoRibbonTabContextSelected cache)
- {
- GraphicsPath outsidePath = new GraphicsPath();
-
- // Create path for a curved dark border around the tab
- outsidePath.AddLine(rect.Left, rect.Bottom - 2, rect.Left + 1, rect.Bottom - 3);
- outsidePath.AddLine(rect.Left + 1, rect.Bottom - 3, rect.Left + 1, rect.Top + 1.5f);
- outsidePath.AddLine(rect.Left + 1, rect.Top + 1.5f, rect.Left + 3, rect.Top);
- outsidePath.AddLine(rect.Left + 3, rect.Top, rect.Right - 4, rect.Top);
- outsidePath.AddLine(rect.Right - 4, rect.Top, rect.Right - 2, rect.Top + 1.5f);
- outsidePath.AddLine(rect.Right - 2, rect.Top + 1.5f, rect.Right - 2, rect.Bottom - 3);
- outsidePath.AddLine(rect.Right - 2, rect.Bottom - 3, rect.Right - 1, rect.Bottom - 2);
-
- LinearGradientBrush leftBrush = new LinearGradientBrush(rect, Color.FromArgb(125, c2), Color.FromArgb(67, c2), 90f);
- LinearGradientBrush rightBrush = new LinearGradientBrush(rect, Color.FromArgb(16, c2), Color.FromArgb(67, c2), 90f);
- cache.leftPen = new Pen(leftBrush);
- cache.rightPen = new Pen(rightBrush);
-
- cache.interiorRect = new Rectangle(rect.Left + 2, rect.Top + 3, rect.Width - 4, rect.Height - 3);
- cache.insideBrush = new LinearGradientBrush(rect, Color.FromArgb(134, c2), Color.FromArgb(50, c2), 90f);
- cache.outsidePath = outsidePath;
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual void DrawRibbonTabContextSelectedTopDraw(Rectangle rect,
- MementoRibbonTabContextSelected cache,
- Graphics g)
- {
- g.DrawLine(Pens.White, rect.Left + 2, rect.Top + 3, rect.Right - 3, rect.Top + 3);
- g.DrawLine(cache.l3, rect.Left + 2, rect.Top + 3, rect.Right - 3, rect.Top + 3);
- g.DrawLine(Pens.White, rect.Left + 2, rect.Top + 2, rect.Right - 3, rect.Top + 2);
- g.DrawLine(cache.l2, rect.Left + 2, rect.Top + 2, rect.Right - 3, rect.Top + 2);
- g.DrawLine(Pens.White, rect.Left + 3, rect.Top + 1, rect.Right - 4, rect.Top + 1);
- g.DrawLine(cache.l1, rect.Left + 3, rect.Top + 1, rect.Right - 4, rect.Top + 1);
-
- // Draw the inside left, right and then bottom borders
- g.DrawLine(cache.leftPen, rect.Left + 2, rect.Top + 4, rect.Left + 2, rect.Bottom - 3);
- g.DrawLine(cache.rightPen, rect.Right - 3, rect.Top + 2, rect.Right - 3, rect.Bottom - 3);
- g.DrawLine(Pens.White, rect.Left + 2, rect.Bottom - 2, rect.Left + 1, rect.Bottom - 1);
- g.DrawLine(cache.bottomInnerPen, rect.Left + 2, rect.Bottom - 2, rect.Left + 1, rect.Bottom - 1);
- g.DrawLine(Pens.White, rect.Right - 3, rect.Bottom - 2, rect.Right - 2, rect.Bottom - 1);
- g.DrawLine(cache.bottomInnerPen, rect.Right - 3, rect.Bottom - 2, rect.Right - 2, rect.Bottom - 1);
- g.DrawLine(Pens.White, rect.Left + 1, rect.Bottom - 2, rect.Left, rect.Bottom - 1);
- g.DrawLine(cache.bottomOuterPen, rect.Left + 1, rect.Bottom - 2, rect.Left, rect.Bottom - 1);
- g.DrawLine(Pens.White, rect.Right - 2, rect.Bottom - 2, rect.Right - 1, rect.Bottom - 1);
- g.DrawLine(cache.bottomOuterPen, rect.Right - 2, rect.Bottom - 2, rect.Right - 1, rect.Bottom - 1);
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual void DrawRibbonTabContextSelectedLeft(Rectangle rect,
- Color c2,
- MementoRibbonTabContextSelected cache)
- {
- GraphicsPath outsidePath = new GraphicsPath();
-
- // Create path for a curved dark border around the tab
- outsidePath.AddLine(rect.Right - 2, rect.Bottom - 1, rect.Right - 3, rect.Bottom - 2);
- outsidePath.AddLine(rect.Right - 3, rect.Bottom - 2, rect.Left + 1.5f, rect.Bottom - 2);
- outsidePath.AddLine(rect.Left + 1.5f, rect.Bottom - 2, rect.Left, rect.Bottom - 4);
- outsidePath.AddLine(rect.Left, rect.Bottom - 4, rect.Left, rect.Top + 3);
- outsidePath.AddLine(rect.Left, rect.Top + 3, rect.Left + 1.5f, rect.Top + 1);
- outsidePath.AddLine(rect.Left + 1.5f, rect.Top + 1, rect.Right - 3, rect.Top + 1);
- outsidePath.AddLine(rect.Right - 3, rect.Top + 1, rect.Right - 2, rect.Top);
-
- LinearGradientBrush leftBrush = new LinearGradientBrush(rect, Color.FromArgb(125, c2), Color.FromArgb(67, c2), 0f);
- LinearGradientBrush rightBrush = new LinearGradientBrush(rect, Color.FromArgb(16, c2), Color.FromArgb(67, c2), 0f);
- cache.leftPen = new Pen(leftBrush);
- cache.rightPen = new Pen(rightBrush);
-
- cache.interiorRect = new Rectangle(rect.Left + 3, rect.Top + 2, rect.Width - 3, rect.Height - 4);
- cache.insideBrush = new LinearGradientBrush(rect, Color.FromArgb(134, c2), Color.FromArgb(50, c2), 0f);
- cache.outsidePath = outsidePath;
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual void DrawRibbonTabContextSelectedLeftDraw(Rectangle rect,
- MementoRibbonTabContextSelected cache,
- Graphics g)
- {
- g.DrawLine(Pens.White, rect.Left + 3, rect.Bottom - 3, rect.Left + 3, rect.Top + 2);
- g.DrawLine(cache.l3, rect.Left + 3, rect.Bottom - 3, rect.Left + 3, rect.Top + 2);
- g.DrawLine(Pens.White, rect.Left + 2, rect.Bottom - 3, rect.Left + 2, rect.Top + 2);
- g.DrawLine(cache.l2, rect.Left + 2, rect.Bottom - 3, rect.Left + 2, rect.Top + 2);
- g.DrawLine(Pens.White, rect.Left + 1, rect.Bottom - 4, rect.Left + 1, rect.Top + 3);
- g.DrawLine(cache.l1, rect.Left + 1, rect.Bottom - 4, rect.Left + 1, rect.Top + 3);
-
- // Draw the inside left, right and then bottom borders
- g.DrawLine(cache.leftPen, rect.Left + 4, rect.Bottom - 3, rect.Right - 3, rect.Bottom - 3);
- g.DrawLine(cache.rightPen, rect.Left + 2, rect.Top + 2, rect.Right - 3, rect.Top + 2);
- g.DrawLine(Pens.White, rect.Right - 2, rect.Bottom - 3, rect.Right - 1, rect.Bottom - 2);
- g.DrawLine(cache.bottomInnerPen, rect.Right - 2, rect.Bottom - 3, rect.Right - 1, rect.Bottom - 2);
- g.DrawLine(Pens.White, rect.Right - 2, rect.Top + 2, rect.Right - 1, rect.Top + 1);
- g.DrawLine(cache.bottomInnerPen, rect.Right - 2, rect.Top + 2, rect.Right - 1, rect.Top + 1);
- g.DrawLine(Pens.White, rect.Right - 2, rect.Bottom - 2, rect.Right - 1, rect.Bottom - 1);
- g.DrawLine(cache.bottomOuterPen, rect.Right - 2, rect.Bottom - 2, rect.Right - 1, rect.Bottom - 1);
- g.DrawLine(Pens.White, rect.Right - 2, rect.Top + 1, rect.Right - 1, rect.Top);
- g.DrawLine(cache.bottomOuterPen, rect.Right - 2, rect.Top + 1, rect.Right - 1, rect.Top);
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual void DrawRibbonTabContextSelectedRight(Rectangle rect,
- Color c2,
- MementoRibbonTabContextSelected cache)
- {
- GraphicsPath outsidePath = new GraphicsPath();
-
- // Create path for a curved dark border around the tab
- outsidePath.AddLine(rect.Left + 1, rect.Bottom - 1, rect.Left + 2, rect.Bottom - 2);
- outsidePath.AddLine(rect.Left + 2, rect.Bottom - 2, rect.Right - 2.5f, rect.Bottom - 2);
- outsidePath.AddLine(rect.Right - 2.5f, rect.Bottom - 2, rect.Right - 1, rect.Bottom - 4);
- outsidePath.AddLine(rect.Right - 1, rect.Bottom - 4, rect.Right - 1, rect.Top + 3);
- outsidePath.AddLine(rect.Right - 1, rect.Top + 3, rect.Right - 2.5f, rect.Top + 1);
- outsidePath.AddLine(rect.Right - 2.5f, rect.Top + 1, rect.Left + 2, rect.Top + 1);
- outsidePath.AddLine(rect.Left + 2, rect.Top + 1, rect.Left + 1, rect.Top);
-
- LinearGradientBrush leftBrush = new LinearGradientBrush(rect, Color.FromArgb(125, c2), Color.FromArgb(67, c2), 180f);
- LinearGradientBrush rightBrush = new LinearGradientBrush(rect, Color.FromArgb(16, c2), Color.FromArgb(67, c2), 180f);
- cache.leftPen = new Pen(leftBrush);
- cache.rightPen = new Pen(rightBrush);
-
- cache.interiorRect = new Rectangle(rect.Left, rect.Top + 2, rect.Width - 3, rect.Height - 4);
- cache.insideBrush = new LinearGradientBrush(rect, Color.FromArgb(134, c2), Color.FromArgb(50, c2), 180f);
- cache.outsidePath = outsidePath;
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual void DrawRibbonTabContextSelectedRightDraw(Rectangle rect,
- MementoRibbonTabContextSelected cache,
- Graphics g)
- {
- g.DrawLine(Pens.White, rect.Right - 4, rect.Bottom - 3, rect.Right - 4, rect.Top + 2);
- g.DrawLine(cache.l3, rect.Right - 4, rect.Bottom - 3, rect.Right - 4, rect.Top + 2);
- g.DrawLine(Pens.White, rect.Right - 3, rect.Bottom - 3, rect.Right - 3, rect.Top + 2);
- g.DrawLine(cache.l2, rect.Right - 3, rect.Bottom - 3, rect.Right - 3, rect.Top + 2);
- g.DrawLine(Pens.White, rect.Right - 2, rect.Bottom - 4, rect.Right - 2, rect.Top + 3);
- g.DrawLine(cache.l1, rect.Right - 2, rect.Bottom - 4, rect.Right - 2, rect.Top + 3);
-
- // Draw the inside left, right and then bottom borders
- g.DrawLine(cache.leftPen, rect.Right - 5, rect.Bottom - 3, rect.Left + 2, rect.Bottom - 3);
- g.DrawLine(cache.rightPen, rect.Right - 3, rect.Top + 2, rect.Left + 2, rect.Top + 2);
- g.DrawLine(Pens.White, rect.Left + 1, rect.Bottom - 3, rect.Left, rect.Bottom - 2);
- g.DrawLine(cache.bottomInnerPen, rect.Left + 1, rect.Bottom - 3, rect.Left, rect.Bottom - 2);
- g.DrawLine(Pens.White, rect.Left + 1, rect.Top + 2, rect.Left, rect.Top + 1);
- g.DrawLine(cache.bottomInnerPen, rect.Left + 1, rect.Top + 2, rect.Left, rect.Top + 1);
- g.DrawLine(Pens.White, rect.Left + 1, rect.Bottom - 2, rect.Left, rect.Bottom - 1);
- g.DrawLine(cache.bottomOuterPen, rect.Left + 1, rect.Bottom - 2, rect.Left, rect.Bottom - 1);
- g.DrawLine(Pens.White, rect.Left + 1, rect.Top + 1, rect.Left, rect.Top);
- g.DrawLine(cache.bottomOuterPen, rect.Left + 1, rect.Top + 1, rect.Left, rect.Top);
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual void DrawRibbonTabContextSelectedBottom(Rectangle rect,
- Color c2,
- MementoRibbonTabContextSelected cache)
- {
- GraphicsPath outsidePath = new GraphicsPath();
-
- // Create path for a curved dark border around the tab
- outsidePath.AddLine(rect.Left, rect.Top + 1, rect.Left + 1, rect.Top + 2);
- outsidePath.AddLine(rect.Left + 1, rect.Top + 2, rect.Left + 1, rect.Bottom - 2.5f);
- outsidePath.AddLine(rect.Left + 1, rect.Bottom - 2.5f, rect.Left + 3, rect.Bottom - 1);
- outsidePath.AddLine(rect.Left + 3, rect.Bottom - 1, rect.Right - 4, rect.Bottom - 1);
- outsidePath.AddLine(rect.Right - 4, rect.Bottom - 1, rect.Right - 2, rect.Bottom - 2.5f);
- outsidePath.AddLine(rect.Right - 2, rect.Bottom - 2.5f, rect.Right - 2, rect.Top + 2);
- outsidePath.AddLine(rect.Right - 2, rect.Top + 2, rect.Right - 1, rect.Top + 1);
-
- LinearGradientBrush leftBrush = new LinearGradientBrush(rect, Color.FromArgb(125, c2), Color.FromArgb(67, c2), 270f);
- LinearGradientBrush rightBrush = new LinearGradientBrush(rect, Color.FromArgb(16, c2), Color.FromArgb(67, c2), 270f);
- cache.leftPen = new Pen(leftBrush);
- cache.rightPen = new Pen(rightBrush);
-
- cache.interiorRect = new Rectangle(rect.Left + 2, rect.Top, rect.Width - 4, rect.Height - 3);
- cache.insideBrush = new LinearGradientBrush(rect, Color.FromArgb(134, c2), Color.FromArgb(50, c2), 270f);
- cache.outsidePath = outsidePath;
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual void DrawRibbonTabContextSelectedBottomDraw(Rectangle rect,
- MementoRibbonTabContextSelected cache,
- Graphics g)
- {
- g.DrawLine(Pens.White, rect.Left + 2, rect.Bottom - 4, rect.Right - 3, rect.Bottom - 4);
- g.DrawLine(cache.l3, rect.Left + 2, rect.Bottom - 4, rect.Right - 3, rect.Bottom - 4);
- g.DrawLine(Pens.White, rect.Left + 2, rect.Bottom - 3, rect.Right - 3, rect.Bottom - 3);
- g.DrawLine(cache.l2, rect.Left + 2, rect.Bottom - 3, rect.Right - 3, rect.Bottom - 3);
- g.DrawLine(Pens.White, rect.Left + 3, rect.Bottom - 2, rect.Right - 4, rect.Bottom - 2);
- g.DrawLine(cache.l1, rect.Left + 3, rect.Bottom - 2, rect.Right - 4, rect.Bottom - 2);
-
- // Draw the inside left, right and then bottom borders
- g.DrawLine(cache.leftPen, rect.Left + 2, rect.Bottom - 5, rect.Left + 2, rect.Top + 2);
- g.DrawLine(cache.rightPen, rect.Right - 3, rect.Bottom - 3, rect.Right - 3, rect.Top + 2);
- g.DrawLine(Pens.White, rect.Left + 2, rect.Top + 1, rect.Left + 1, rect.Top);
- g.DrawLine(cache.bottomInnerPen, rect.Left + 2, rect.Top + 1, rect.Left + 1, rect.Top);
- g.DrawLine(Pens.White, rect.Right - 3, rect.Top + 1, rect.Right - 2, rect.Top);
- g.DrawLine(cache.bottomInnerPen, rect.Right - 3, rect.Top + 1, rect.Right - 2, rect.Top);
- g.DrawLine(Pens.White, rect.Left + 1, rect.Top + 1, rect.Left, rect.Top);
- g.DrawLine(cache.bottomOuterPen, rect.Left + 1, rect.Top + 1, rect.Left, rect.Top);
- g.DrawLine(Pens.White, rect.Right - 2, rect.Top + 1, rect.Right - 1, rect.Top);
- g.DrawLine(cache.bottomOuterPen, rect.Right - 2, rect.Top + 1, rect.Right - 1, rect.Top);
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual IDisposable DrawRibbonTabHighlight(PaletteRibbonShape shape,
- ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- PaletteState state,
- IPaletteRibbonBack palette,
- VisualOrientation orientation,
- IDisposable memento,
- bool alternate)
- {
- if ((rect.Width > 0) && (rect.Height > 0))
- {
- Color c1 = palette.GetRibbonBackColor1(state);
- Color c2 = palette.GetRibbonBackColor2(state);
- Color c3 = palette.GetRibbonBackColor3(state);
- Color c4 = palette.GetRibbonBackColor4(state);
- Color c5 = palette.GetRibbonBackColor5(state);
-
- bool generate = true;
- MementoRibbonTabHighlight cache;
-
- // Access a cache instance and decide if cache resources need generating
- if (!(memento is MementoRibbonTabHighlight))
- {
- memento?.Dispose();
-
- cache = new MementoRibbonTabHighlight(rect, c1, c2, c3, c4, c5, orientation);
- memento = cache;
- }
- else
- {
- cache = (MementoRibbonTabHighlight)memento;
- generate = !cache.UseCachedValues(rect, c1, c2, c3, c4, c5, orientation);
- }
-
- // Do we need to generate the contents of the cache?
- if (generate)
- {
- // Dispose of existing values
- cache.Dispose();
-
- switch (orientation)
- {
- case VisualOrientation.Top:
- DrawRibbonTabHighlightTop(rect, c4, c5, cache);
- break;
- case VisualOrientation.Left:
- DrawRibbonTabHighlightLeft(rect, c4, c5, cache);
- break;
- case VisualOrientation.Right:
- DrawRibbonTabHighlightRight(rect, c4, c5, cache);
- break;
- case VisualOrientation.Bottom:
- DrawRibbonTabHighlightBottom(rect, c4, c5, cache);
- break;
- }
-
- cache.innerVertPen = new Pen(c1);
- cache.innerHorzPen = new Pen(c2);
- cache.borderHorzPen = new Pen(c3);
- }
-
- // First of all draw as selected
- cache.selectedMemento = (MementoRibbonTabSelected2007)DrawRibbonTabSelected2007(context, rect, PaletteState.CheckedNormal, palette, orientation, cache.selectedMemento);
-
- switch (orientation)
- {
- case VisualOrientation.Top:
- DrawRibbonTabHighlightTopDraw(rect, c1, c2, c3, c4, c5, cache, context.Graphics, alternate);
- break;
- case VisualOrientation.Left:
- DrawRibbonTabHighlightLeftDraw(rect, c1, c2, c3, c4, c5, cache, context.Graphics, alternate);
- break;
- case VisualOrientation.Right:
- DrawRibbonTabHighlightRightDraw(rect, c1, c2, c3, c4, c5, cache, context.Graphics, alternate);
- break;
- case VisualOrientation.Bottom:
- DrawRibbonTabHighlightBottomDraw(rect, c1, c2, c3, c4, c5, cache, context.Graphics, alternate);
- break;
- }
- }
-
- return memento;
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual void DrawRibbonTabHighlightTop(Rectangle rect,
- Color c4, Color c5,
- MementoRibbonTabHighlight cache)
- {
- RectangleF hF = new RectangleF(rect.Left - 2, rect.Top - 1, rect.Width + 4, 6);
- RectangleF vF = new RectangleF(rect.Left - 2, rect.Top + 1, rect.Width + 4, rect.Height - 1);
- cache.topBorderBrush = new LinearGradientBrush(hF, Color.FromArgb(48, c5), Color.FromArgb(64, c5), 90f);
- cache.borderVertBrush = new LinearGradientBrush(vF, c5, c4, 90f);
- cache.outsideVertBrush = new LinearGradientBrush(vF, Color.FromArgb(48, c5), c5, 90f);
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual void DrawRibbonTabHighlightTopDraw(Rectangle rect,
- Color c1, Color c2,
- Color c3, Color c4,
- Color c5,
- MementoRibbonTabHighlight cache,
- Graphics g,
- bool alternate)
- {
- g.FillRectangle(cache.topBorderBrush, rect.Left - 1, rect.Top - 1, rect.Width + 2, 4);
- g.DrawLine(cache.innerVertPen, rect.Left + 2, rect.Bottom - 2, rect.Left + 2, rect.Top + 3);
- g.DrawLine(cache.innerVertPen, rect.Right - 3, rect.Bottom - 2, rect.Right - 3, rect.Top + 3);
- g.DrawLine(cache.innerHorzPen, rect.Left + 2, rect.Top + 2, rect.Right - 3, rect.Top + 2);
-
- if (alternate)
- {
- g.DrawLine(cache.innerHorzPen, rect.Left + 2, rect.Top + 1, rect.Right - 3, rect.Top + 1);
- g.DrawLine(cache.borderHorzPen, rect.Left + 3, rect.Top, rect.Right - 4, rect.Top);
- }
- else
- {
- g.DrawLine(cache.innerHorzPen, rect.Left + 3, rect.Top + 1, rect.Right - 4, rect.Top + 1);
- g.DrawLine(cache.borderHorzPen, rect.Left + 4, rect.Top, rect.Right - 5, rect.Top);
- }
-
- g.FillRectangle(cache.borderVertBrush, rect.Left + 1, rect.Top + 2, 1, rect.Height - 3);
- g.FillRectangle(cache.borderVertBrush, rect.Right - 2, rect.Top + 2, 1, rect.Height - 3);
- g.FillRectangle(cache.outsideVertBrush, rect.Left, rect.Top + 3, 1, rect.Height - 4);
- g.FillRectangle(cache.outsideVertBrush, rect.Left - 1, rect.Top + 3, 1, rect.Height - 4);
- g.FillRectangle(cache.outsideVertBrush, rect.Right - 1, rect.Top + 3, 1, rect.Height - 4);
- g.FillRectangle(cache.outsideVertBrush, rect.Right, rect.Top + 3, 1, rect.Height - 4);
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual void DrawRibbonTabHighlightLeft(Rectangle rect,
- Color c4, Color c5,
- MementoRibbonTabHighlight cache)
- {
- RectangleF hF = new RectangleF(rect.Left - 1, rect.Top - 2, 6, rect.Height - 4);
- RectangleF vF = new RectangleF(rect.Left + 1, rect.Top - 2, rect.Width - 1, rect.Height - 4);
- cache.topBorderBrush = new LinearGradientBrush(hF, Color.FromArgb(48, c5), Color.FromArgb(64, c5), 0f);
- cache.borderVertBrush = new LinearGradientBrush(vF, c5, c4, 0f);
- cache.outsideVertBrush = new LinearGradientBrush(vF, Color.FromArgb(48, c5), c5, 0f);
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual void DrawRibbonTabHighlightLeftDraw(Rectangle rect,
- Color c1, Color c2,
- Color c3, Color c4,
- Color c5,
- MementoRibbonTabHighlight cache,
- Graphics g,
- bool alternate)
- {
- g.FillRectangle(cache.topBorderBrush, rect.Left - 1, rect.Top - 1, 4, rect.Height + 2);
- g.DrawLine(cache.innerVertPen, rect.Right - 2, rect.Bottom - 3, rect.Left + 3, rect.Bottom - 3);
- g.DrawLine(cache.innerVertPen, rect.Right - 2, rect.Top + 2, rect.Left + 3, rect.Top + 2);
- g.DrawLine(cache.innerHorzPen, rect.Left + 2, rect.Bottom - 3, rect.Left + 2, rect.Top + 2);
-
- if (alternate)
- {
- g.DrawLine(cache.innerHorzPen, rect.Left + 1, rect.Bottom - 3, rect.Left + 1, rect.Top + 2);
- g.DrawLine(cache.borderHorzPen, rect.Left, rect.Bottom - 4, rect.Left, rect.Top + 3);
- }
- else
- {
- g.DrawLine(cache.innerHorzPen, rect.Left + 1, rect.Bottom - 4, rect.Left + 1, rect.Top + 3);
- g.DrawLine(cache.borderHorzPen, rect.Left, rect.Bottom - 5, rect.Left, rect.Top + 4);
- }
-
- g.FillRectangle(cache.borderVertBrush, rect.Left + 2, rect.Bottom - 2, rect.Width - 3, 1);
- g.FillRectangle(cache.borderVertBrush, rect.Left + 2, rect.Top + 1, rect.Width - 3, 1);
- g.FillRectangle(cache.outsideVertBrush, rect.Left + 3, rect.Bottom - 1, rect.Width - 4, 1);
- g.FillRectangle(cache.outsideVertBrush, rect.Left + 3, rect.Bottom, rect.Width - 4, 1);
- g.FillRectangle(cache.outsideVertBrush, rect.Left + 3, rect.Top, rect.Width - 4, 1);
- g.FillRectangle(cache.outsideVertBrush, rect.Left + 3, rect.Top - 1, rect.Width - 4, 1);
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual void DrawRibbonTabHighlightRight(Rectangle rect,
- Color c4, Color c5,
- MementoRibbonTabHighlight cache)
- {
- RectangleF hF = new RectangleF(rect.Right - 6, rect.Top - 2, 6, rect.Height - 4);
- RectangleF vF = new RectangleF(rect.Left, rect.Top - 2, rect.Width - 1, rect.Height - 4);
- cache.topBorderBrush = new LinearGradientBrush(hF, Color.FromArgb(48, c5), Color.FromArgb(64, c5), 180f);
- cache.borderVertBrush = new LinearGradientBrush(vF, c5, c4, 180f);
- cache.outsideVertBrush = new LinearGradientBrush(vF, Color.FromArgb(48, c5), c5, 180f);
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual void DrawRibbonTabHighlightRightDraw(Rectangle rect,
- Color c1, Color c2,
- Color c3, Color c4,
- Color c5,
- MementoRibbonTabHighlight cache,
- Graphics g,
- bool alternate)
- {
- g.FillRectangle(cache.topBorderBrush, rect.Right - 4, rect.Top - 1, 4, rect.Height + 2);
- g.DrawLine(cache.innerVertPen, rect.Left + 1, rect.Bottom - 3, rect.Right - 4, rect.Bottom - 3);
- g.DrawLine(cache.innerVertPen, rect.Left + 1, rect.Top + 2, rect.Right - 4, rect.Top + 2);
- g.DrawLine(cache.innerHorzPen, rect.Right - 3, rect.Bottom - 3, rect.Right - 3, rect.Top + 2);
-
- if (alternate)
- {
- g.DrawLine(cache.innerHorzPen, rect.Right - 2, rect.Bottom - 3, rect.Right - 2, rect.Top + 2);
- g.DrawLine(cache.borderHorzPen, rect.Right - 1, rect.Bottom - 4, rect.Right - 1, rect.Top + 3);
- }
- else
- {
- g.DrawLine(cache.innerHorzPen, rect.Right - 2, rect.Bottom - 4, rect.Right - 2, rect.Top + 3);
- g.DrawLine(cache.borderHorzPen, rect.Right - 1, rect.Bottom - 5, rect.Right - 1, rect.Top + 4);
- }
-
- g.FillRectangle(cache.borderVertBrush, rect.Left + 1, rect.Bottom - 2, rect.Width - 3, 1);
- g.FillRectangle(cache.borderVertBrush, rect.Left + 1, rect.Top + 1, rect.Width - 3, 1);
- g.FillRectangle(cache.outsideVertBrush, rect.Left + 1, rect.Bottom - 1, rect.Width - 4, 1);
- g.FillRectangle(cache.outsideVertBrush, rect.Left + 1, rect.Bottom, rect.Width - 4, 1);
- g.FillRectangle(cache.outsideVertBrush, rect.Left + 1, rect.Top, rect.Width - 4, 1);
- g.FillRectangle(cache.outsideVertBrush, rect.Left + 1, rect.Top - 1, rect.Width - 4, 1);
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual void DrawRibbonTabHighlightBottom(Rectangle rect,
- Color c4, Color c5,
- MementoRibbonTabHighlight cache)
- {
- RectangleF hF = new RectangleF(rect.Left - 2, rect.Bottom - 6, rect.Width + 4, 6);
- RectangleF vF = new RectangleF(rect.Left - 2, rect.Top, rect.Width + 4, rect.Height - 1);
- cache.topBorderBrush = new LinearGradientBrush(hF, Color.FromArgb(48, c5), Color.FromArgb(64, c5), 270f);
- cache.borderVertBrush = new LinearGradientBrush(vF, c5, c4, 270f);
- cache.outsideVertBrush = new LinearGradientBrush(vF, Color.FromArgb(48, c5), c5, 270f);
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual void DrawRibbonTabHighlightBottomDraw(Rectangle rect,
- Color c1, Color c2,
- Color c3, Color c4,
- Color c5,
- MementoRibbonTabHighlight cache,
- Graphics g,
- bool alternate)
- {
- g.FillRectangle(cache.topBorderBrush, rect.Left - 1, rect.Bottom - 3, rect.Width + 2, 4);
- g.DrawLine(cache.innerVertPen, rect.Left + 2, rect.Top + 1, rect.Left + 2, rect.Bottom - 4);
- g.DrawLine(cache.innerVertPen, rect.Right - 3, rect.Top + 1, rect.Right - 3, rect.Bottom - 4);
- g.DrawLine(cache.innerHorzPen, rect.Left + 2, rect.Bottom - 3, rect.Right - 3, rect.Bottom - 3);
-
- if (alternate)
- {
- g.DrawLine(cache.innerHorzPen, rect.Left + 2, rect.Bottom - 2, rect.Right - 3, rect.Bottom - 2);
- g.DrawLine(cache.borderHorzPen, rect.Left + 3, rect.Bottom - 1, rect.Right - 4, rect.Bottom - 1);
- }
- else
- {
- g.DrawLine(cache.innerHorzPen, rect.Left + 3, rect.Bottom - 2, rect.Right - 4, rect.Bottom - 2);
- g.DrawLine(cache.borderHorzPen, rect.Left + 4, rect.Bottom - 1, rect.Right - 5, rect.Bottom - 1);
- }
-
- g.FillRectangle(cache.borderVertBrush, rect.Left + 1, rect.Top + 1, 1, rect.Height - 3);
- g.FillRectangle(cache.borderVertBrush, rect.Right - 2, rect.Top + 1, 1, rect.Height - 3);
- g.FillRectangle(cache.outsideVertBrush, rect.Left, rect.Top + 1, 1, rect.Height - 4);
- g.FillRectangle(cache.outsideVertBrush, rect.Left - 1, rect.Top + 1, 1, rect.Height - 4);
- g.FillRectangle(cache.outsideVertBrush, rect.Right - 1, rect.Top + 1, 1, rect.Height - 4);
- g.FillRectangle(cache.outsideVertBrush, rect.Right, rect.Top + 1, 1, rect.Height - 4);
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual IDisposable DrawRibbonTabContext(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- IPaletteRibbonGeneral paletteGeneral,
- IPaletteRibbonBack paletteBack,
- IDisposable memento)
- {
- if ((rect.Width > 0) && (rect.Height > 0))
- {
- Color c1 = paletteGeneral.GetRibbonTabSeparatorContextColor(PaletteState.Normal);
- Color c2 = paletteBack.GetRibbonBackColor5(PaletteState.ContextCheckedNormal);
-
- bool generate = true;
- MementoRibbonTabContext cache;
-
- // Access a cache instance and decide if cache resources need generating
- if (!(memento is MementoRibbonTabContext))
- {
- memento?.Dispose();
-
- cache = new MementoRibbonTabContext(rect, c1, c2);
- memento = cache;
- }
- else
- {
- cache = (MementoRibbonTabContext)memento;
- generate = !cache.UseCachedValues(rect, c1, c2);
- }
-
- // Do we need to generate the contents of the cache?
- if (generate)
- {
- // Dispose of existing values
- cache.Dispose();
-
- Rectangle borderRect = new Rectangle(rect.X - 1, rect.Y - 1, rect.Width + 2, rect.Height + 2);
- cache.fillRect = new Rectangle(rect.X + 1, rect.Y, rect.Width - 2, rect.Height - 1);
-
- LinearGradientBrush borderBrush = new LinearGradientBrush(borderRect, c1, Color.Transparent, 270f)
- {
- Blend = _ribbonGroup5Blend
- };
- cache.borderPen = new Pen(borderBrush);
-
- LinearGradientBrush underlineBrush = new LinearGradientBrush(borderRect, Color.Transparent, Color.FromArgb(200, c2), 0f)
- {
- Blend = _ribbonGroup7Blend
- };
- cache.underlinePen = new Pen(underlineBrush);
-
- cache.fillBrush = new LinearGradientBrush(borderRect, Color.FromArgb(196, c2), Color.Transparent, 270f)
- {
- Blend = _ribbonGroup6Blend
- };
- }
-
- // Draw the left and right border lines
- context.Graphics.DrawLine(cache.borderPen, rect.X, rect.Y, rect.X, rect.Bottom - 1);
- context.Graphics.DrawLine(cache.borderPen, rect.Right - 1, rect.Y, rect.Right - 1, rect.Bottom - 1);
-
- // Fill the inner area with a gradient context specific color
- context.Graphics.FillRectangle(cache.fillBrush, cache.fillRect);
-
- // Overdraw the brighter line at bottom
- context.Graphics.DrawLine(cache.underlinePen, rect.X + 1, rect.Bottom - 1, rect.Right - 2, rect.Bottom - 1);
- }
-
- return memento;
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual IDisposable DrawRibbonAppButton(PaletteRibbonShape shape,
- ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- PaletteState state,
- IPaletteRibbonBack palette,
- bool trackBorderAsPressed,
- IDisposable memento)
- {
- // Reduce the area of the actual button as the extra space is used for shadow
- rect.Width -= 3;
- rect.Height -= 3;
-
- if ((rect.Width > 0) && (rect.Height > 0))
- {
- // Get the colors from the palette
- Color topLight = palette.GetRibbonBackColor1(state);
- Color topMedium = palette.GetRibbonBackColor2(state);
- Color topDark = palette.GetRibbonBackColor3(state);
- Color bottomLight = palette.GetRibbonBackColor4(state);
- Color bottomMedium = palette.GetRibbonBackColor5(state);
- Color bottomDark = CommonHelper.MergeColors(topDark, 0.78f, Color.Empty, 0.22f);
-
- bool generate = true;
- MementoRibbonAppButton cache;
-
- // Access a cache instance and decide if cache resources need generating
- if (!(memento is MementoRibbonAppButton))
- {
- memento?.Dispose();
-
- cache = new MementoRibbonAppButton(rect, topLight, topMedium,
- topDark, bottomLight, bottomMedium);
- memento = cache;
- }
- else
- {
- cache = (MementoRibbonAppButton)memento;
- generate = !cache.UseCachedValues(rect, topLight, topMedium,
- topDark, bottomLight, bottomMedium);
- }
-
- // Do we need to generate the contents of the cache?
- if (generate)
- {
- // Dispose of existing values
- cache.Dispose();
-
- cache.borderShadow1 = new RectangleF(rect.X, rect.Y, rect.Width + 2, rect.Height + 2);
- cache.borderShadow2 = new RectangleF(rect.X, rect.Y, rect.Width + 1, rect.Height + 1);
- cache.borderMain1 = new RectangleF(rect.X + 1, rect.Y + 1, rect.Width - 2, rect.Height - 2);
- cache.borderMain2 = new RectangleF(cache.borderMain1.X + 1, cache.borderMain1.Y + 1, cache.borderMain1.Width - 2, cache.borderMain1.Height - 2);
- cache.borderMain3 = new RectangleF(cache.borderMain1.X + 1, cache.borderMain1.Y + 1, cache.borderMain1.Width - 2, cache.borderMain1.Height - 2);
- cache.borderMain4 = new RectangleF(cache.borderMain2.X, cache.borderMain2.Y + 1, cache.borderMain2.Width, cache.borderMain2.Height - 2);
- cache.rectBottomGlow = new RectangleF(0, 0, rect.Width * 0.75f, rect.Height * 0.75f);
- cache.rectLower = new RectangleF(rect.X, rect.Y - 1, rect.Width, rect.Height + 1);
- cache.rectUpperGlow = new RectangleF
- {
- Width = rect.Width - 4,
- Height = rect.Height / 8
- };
- cache.rectUpperGlow.Y = rect.Y + ((rect.Height - cache.rectUpperGlow.Height) / 2);
- cache.rectUpperGlow.X = rect.X + ((rect.Width - cache.rectUpperGlow.Width) / 2);
-
- cache.brushUpper1 = new LinearGradientBrush(rect, Color.Transparent, Color.Transparent, LinearGradientMode.Horizontal);
- cache.brushLower = new LinearGradientBrush(cache.rectLower, Color.Transparent, Color.Transparent, LinearGradientMode.Horizontal);
- }
-
- using (AntiAlias aa = new AntiAlias(context.Graphics))
- {
- DrawRibbonAppButtonBorder1(context.Graphics, cache);
- DrawRibbonAppButtonUpperHalf(context.Graphics, cache, state, topDark, bottomDark, topLight, topMedium, trackBorderAsPressed);
- DrawRibbonAppButtonLowerHalf(context.Graphics, cache, state, bottomDark, bottomLight, bottomMedium);
- DrawRibbonAppButtonGlowCenter(context.Graphics, cache, state, topLight, bottomLight);
- DrawRibbonAppButtonGlowUpperBottom(context.Graphics, cache, state, bottomLight, bottomMedium, bottomDark);
- DrawRibbonAppButtonBorder2(context.Graphics, cache, state, bottomLight, trackBorderAsPressed);
- }
- }
-
- return memento;
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual void DrawRibbonAppButtonBorder1(Graphics g,
- MementoRibbonAppButton memento)
- {
- g.FillEllipse(_buttonBorder1Brush, memento.borderShadow1);
- g.FillEllipse(_buttonBorder2Brush, memento.borderShadow2);
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual void DrawRibbonAppButtonUpperHalf(Graphics g,
- MementoRibbonAppButton memento,
- PaletteState state,
- Color topDark,
- Color bottomDark,
- Color topLight,
- Color topMedium,
- bool trackBorderAsPressed)
- {
- bool pressed = (state == PaletteState.Pressed);
- bool tracking = (state == PaletteState.Tracking);
-
- // Override tracking/pressed states?
- if (tracking && trackBorderAsPressed)
- {
- pressed = true;
- tracking = false;
- }
-
- if (!pressed)
- {
- Color[] colorsUpperHalf = { topDark, topMedium, topLight, topLight, topMedium, topDark };
- float[] posUpperHalf = { 0.0f, 0.2f, 0.4f, 0.6f, 0.8f, 1.0f };
-
- ColorBlend blendUpperHalf = new ColorBlend
- {
- Colors = colorsUpperHalf,
- Positions = posUpperHalf
- };
- memento.brushUpper1.InterpolationColors = blendUpperHalf;
-
- g.FillPie(memento.brushUpper1, memento.rect.X, memento.rect.Y, memento.rect.Width, memento.rect.Height, 180, 180);
- }
-
- Color c1 = _whiten10;
- Color c2 = Color.FromArgb(100, topDark);
-
- if (tracking)
- {
- c1 = _whiten200;
- c2 = Color.FromArgb(200, bottomDark);
- }
-
- if (pressed)
- {
- c1 = Color.White;
- c2 = topDark;
- }
-
- using (LinearGradientBrush brushUpper2 = new LinearGradientBrush(memento.rect, c1, c2, LinearGradientMode.Vertical))
- {
- g.FillPie(brushUpper2, memento.rect.X, memento.rect.Y, memento.rect.Width, memento.rect.Height, 180, 180);
- }
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual void DrawRibbonAppButtonLowerHalf(Graphics g,
- MementoRibbonAppButton memento,
- PaletteState state,
- Color bottomDark,
- Color bottomLight,
- Color bottomMedium)
- {
- Color[] colorsLowerHalf = { bottomDark, bottomMedium, bottomLight, bottomLight, bottomMedium, bottomDark };
-
- float[] posLowerHalf = state == PaletteState.Pressed
- ? new float[] { 0.0f, 0.3f, 0.5f, 0.5f, 0.7f, 1.0f }
- : new float[] { 0.0f, 0.2f, 0.4f, 0.6f, 0.8f, 1.0f };
-
- ColorBlend blendLowerHalf = new ColorBlend
- {
- Colors = colorsLowerHalf,
- Positions = posLowerHalf
- };
-
- memento.brushLower.InterpolationColors = blendLowerHalf;
- g.FillPie(memento.brushLower, memento.rectLower.X, memento.rectLower.Y, memento.rectLower.Width, memento.rectLower.Height, 0, 180);
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual void DrawRibbonAppButtonGlowCenter(Graphics g,
- MementoRibbonAppButton memento,
- PaletteState state,
- Color topLight,
- Color bottomLight)
- {
- using (LinearGradientBrush brushBottomGlow = new LinearGradientBrush(memento.rectBottomGlow, Color.FromArgb(50, Color.White), Color.FromArgb(30, Color.White), LinearGradientMode.Vertical))
- {
- RectangleF rectBottomGlow = memento.rectBottomGlow;
- rectBottomGlow.X = memento.rect.X + ((memento.rect.Width - rectBottomGlow.Width) / 2);
- rectBottomGlow.Y = memento.rect.Y + (memento.rect.Height - rectBottomGlow.Height - 2);
-
- if (state != PaletteState.Pressed)
- {
- g.FillPie(brushBottomGlow, rectBottomGlow.X, rectBottomGlow.Y, rectBottomGlow.Width, rectBottomGlow.Height, 0, 360);
- }
-
- if (state == PaletteState.Pressed)
- {
- rectBottomGlow.Height = memento.rect.Height * 0.2f;
- rectBottomGlow.Width = memento.rect.Width * 0.4f;
- rectBottomGlow.X = memento.rect.X + ((memento.rect.Width - rectBottomGlow.Width) / 2);
- rectBottomGlow.Y = memento.rect.Y + (memento.rect.Height - rectBottomGlow.Height);
-
- using (GraphicsPath path = new GraphicsPath())
- {
- path.AddEllipse(rectBottomGlow);
- using (PathGradientBrush pathGradient = new PathGradientBrush(path))
- {
- pathGradient.CenterColor = topLight;
- pathGradient.SurroundColors = new Color[] { Color.FromArgb(100, bottomLight) };
- g.FillEllipse(pathGradient, rectBottomGlow);
- }
- }
- }
- }
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual void DrawRibbonAppButtonGlowUpperBottom(Graphics g,
- MementoRibbonAppButton memento,
- PaletteState state,
- Color bottomLight,
- Color bottomMedium,
- Color bottomDark)
- {
- int lightTransparency = 50;
- int mediumTransparency = 50;
-
- if ((state == PaletteState.Pressed) || (state == PaletteState.Tracking))
- {
- lightTransparency = 200;
- mediumTransparency = 200;
- }
-
- using (LinearGradientBrush brushUpperGlow = new LinearGradientBrush(memento.rectUpperGlow, Color.Transparent, Color.Transparent, LinearGradientMode.Horizontal))
- {
- Color[] colorsUpperGlow = { Color.FromArgb(180, bottomDark),
- Color.FromArgb(mediumTransparency, bottomMedium),
- Color.FromArgb(lightTransparency, bottomLight),
- Color.FromArgb(lightTransparency, bottomLight),
- Color.FromArgb(mediumTransparency, bottomMedium),
- Color.FromArgb(180, bottomDark) };
-
- float[] posUpperGlow = { 0.0f, 0.2f, 0.4f, 0.6f, 0.8f, 1.0f };
-
- ColorBlend blendUpperGlow = new ColorBlend
- {
- Colors = colorsUpperGlow,
- Positions = posUpperGlow
- };
- brushUpperGlow.InterpolationColors = blendUpperGlow;
-
- g.FillPie(brushUpperGlow, memento.rectUpperGlow.X, memento.rectUpperGlow.Y, memento.rectUpperGlow.Width, memento.rectUpperGlow.Height, 180, 180);
- }
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual void DrawRibbonAppButtonBorder2(Graphics g,
- MementoRibbonAppButton memento,
- PaletteState state,
- Color bottomLight,
- bool trackBorderAsPressed)
- {
- bool pressed = (state == PaletteState.Pressed);
- bool tracking = (state == PaletteState.Tracking);
-
- // Override tracking/pressed states?
- if (tracking && trackBorderAsPressed)
- {
- pressed = true;
- tracking = false;
- }
-
- Color borderGlowColor;
- if (pressed)
- {
- borderGlowColor = _whiten80;
- }
- else if (tracking && !pressed)
- {
- borderGlowColor = Color.FromArgb(200, bottomLight);
- }
- else
- {
- borderGlowColor = _whiten120;
- }
-
- using (Pen p = new Pen(borderGlowColor))
- {
- g.DrawEllipse(p, memento.borderMain1);
- }
-
- using (Pen p = new Pen(Color.FromArgb(100, 52, 59, 64)))
- {
- g.DrawEllipse(p, memento.rect);
- }
-
- if (pressed)
- {
- borderGlowColor = _whiten60;
- using (Pen p = new Pen(borderGlowColor))
- {
- g.DrawEllipse(p, memento.borderMain3);
- }
- }
-
- borderGlowColor = (pressed ? _whiten50 : _whiten80);
- using (Pen p = new Pen(borderGlowColor))
- {
- g.DrawArc(p, memento.borderMain2, 180, 180);
- }
-
- if (!pressed)
- {
- borderGlowColor = _whiten30;
- using (Pen p = new Pen(borderGlowColor))
- {
- g.DrawArc(p, memento.borderMain4, 180, 180);
- }
- }
-
- if (tracking && !pressed)
- {
- using (Pen p = new Pen(Color.FromArgb(100, borderGlowColor)))
- {
- g.DrawEllipse(p, memento.rect);
- }
- }
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual IDisposable DrawRibbonAppTab(PaletteRibbonShape shape,
- ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- PaletteState state,
- Color baseColor1,
- Color baseColor2,
- IDisposable memento)
- {
- if ((rect.Width > 0) && (rect.Height > 0))
- {
- bool generate = true;
- MementoRibbonAppTab cache;
-
- // Access a cache instance and decide if cache resources need generating
- if (!(memento is MementoRibbonAppTab))
- {
- memento?.Dispose();
-
- cache = new MementoRibbonAppTab(rect, baseColor1, baseColor2);
- memento = cache;
- }
- else
- {
- cache = (MementoRibbonAppTab)memento;
- generate = !cache.UseCachedValues(rect, baseColor1, baseColor2);
- }
-
- // Do we need to generate the contents of the cache?
- if (generate)
- {
- // Dispose of existing values
- cache.Dispose();
-
- // Create common paths to all the app tab states
- cache.GeneratePaths(rect, state);
- cache.borderPen = new Pen(baseColor1);
-
- // Create state specific colors/brushes/pens
- switch (state)
- {
- case PaletteState.Normal:
- cache.borderBrush = new SolidBrush(CommonHelper.MergeColors(baseColor1, 0.2f, baseColor2, 0.8f));
- cache.insideFillBrush = new LinearGradientBrush(new RectangleF(rect.X, rect.Y + 1, rect.Width, rect.Height),
- CommonHelper.MergeColors(baseColor1, 0.3f, baseColor2, 0.7f),
- CommonHelper.MergeColors(baseColor1, 0.6f, baseColor2, 0.4f),
- 90f);
-
- cache.insideFillBrush.SetSigmaBellShape(0.33f);
- cache.highlightBrush.CenterColor = Color.FromArgb(64, Color.White);
- break;
- case PaletteState.Tracking:
- cache.borderBrush = new SolidBrush(baseColor2);
- cache.insideFillBrush = new LinearGradientBrush(new RectangleF(rect.X, rect.Y + 1, rect.Width, rect.Height),
- CommonHelper.MergeColors(baseColor1, 0.3f, baseColor2, 0.7f),
- CommonHelper.MergeColors(baseColor1, 0.6f, baseColor2, 0.4f),
- 90f);
-
- cache.insideFillBrush.SetSigmaBellShape(0.33f);
- cache.highlightBrush.CenterColor = Color.FromArgb(100, Color.White);
- break;
- case PaletteState.Tracking | PaletteState.FocusOverride:
- cache.borderBrush = new SolidBrush(ControlPaint.LightLight(baseColor2));
- cache.insideFillBrush = new LinearGradientBrush(new RectangleF(rect.X, rect.Y + 1, rect.Width, rect.Height),
- CommonHelper.MergeColors(baseColor1, 0.3f, baseColor2, 0.7f),
- CommonHelper.MergeColors(baseColor1, 0.6f, baseColor2, 0.4f),
- 90f);
-
- cache.insideFillBrush.SetSigmaBellShape(0.33f);
- cache.highlightBrush.CenterColor = ControlPaint.LightLight(baseColor2);
- break;
- case PaletteState.Pressed:
- cache.borderBrush = new SolidBrush(CommonHelper.MergeColors(baseColor1, 0.5f, baseColor2, 0.5f));
- cache.insideFillBrush = new LinearGradientBrush(new RectangleF(rect.X, rect.Y + 1, rect.Width, rect.Height),
- CommonHelper.MergeColors(baseColor1, 0.3f, baseColor2, 0.7f),
- CommonHelper.MergeColors(baseColor1, 0.75f, baseColor2, 0.25f),
- 90f);
-
- cache.insideFillBrush.SetSigmaBellShape(0f);
- cache.highlightBrush.CenterColor = Color.FromArgb(90, Color.White);
- break;
- }
- }
-
- // Fill the entire tab area and then add a border around the edge
- context.Graphics.FillPath(cache.borderBrush, cache.borderFillPath);
-
- // Draw the outside border
- using (AntiAlias aa = new AntiAlias(context.Graphics))
- {
- context.Graphics.DrawPath(cache.borderPen, cache.borderPath);
- }
-
- // Fill inside area
- context.Graphics.FillPath(cache.insideFillBrush, cache.insideFillPath);
-
- // Draw highlight over bottom half
- using (Clipping clip = new Clipping(context.Graphics, cache.insideFillPath))
- {
- context.Graphics.FillPath(cache.highlightBrush, cache.highlightPath);
- }
- }
-
- return memento;
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual IDisposable DrawRibbonGroupNormalBorder(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- PaletteState state,
- IPaletteRibbonBack palette,
- bool tracking,
- bool lightInside,
- IDisposable memento)
- {
- if ((rect.Width > 0) && (rect.Height > 0))
- {
- Color c1 = palette.GetRibbonBackColor1(state);
- Color c2 = palette.GetRibbonBackColor2(state);
-
- bool generate = true;
- MementoRibbonGroupNormalBorder cache;
-
- // Access a cache instance and decide if cache resources need generating
- if (!(memento is MementoRibbonGroupNormalBorder))
- {
- memento?.Dispose();
-
- cache = new MementoRibbonGroupNormalBorder(rect, c1, c2);
- memento = cache;
- }
- else
- {
- cache = (MementoRibbonGroupNormalBorder)memento;
- generate = !cache.UseCachedValues(rect, c1, c2);
- }
-
- // Do we need to generate the contents of the cache?
- if (generate)
- {
- // Dispose of existing values
- cache.Dispose();
-
- GraphicsPath solidPath = new GraphicsPath();
- GraphicsPath insidePath = new GraphicsPath();
- GraphicsPath outsidePath = new GraphicsPath();
- GraphicsPath lightPath = new GraphicsPath();
-
- // Create the rounded complete border
- solidPath.AddLine(rect.Left + 2, rect.Top, rect.Right - 4, rect.Top);
- solidPath.AddLine(rect.Right - 4, rect.Top, rect.Right - 2, rect.Top + 2);
- solidPath.AddLine(rect.Right - 2, rect.Top + 2, rect.Right - 2, rect.Bottom - 4);
- solidPath.AddLine(rect.Right - 2, rect.Bottom - 4, rect.Right - 4, rect.Bottom - 2);
- solidPath.AddLine(rect.Right - 4, rect.Bottom - 2, rect.Left + 2, rect.Bottom - 2);
- solidPath.AddLine(rect.Left + 2, rect.Bottom - 2, rect.Left, rect.Bottom - 4);
- solidPath.AddLine(rect.Left, rect.Bottom - 4, rect.Left, rect.Top + 2);
- solidPath.AddLine(rect.Left, rect.Top + 2, rect.Left + 2, rect.Top);
-
- // Create the inside top and left path
- insidePath.AddLine(rect.Right - 4, rect.Top + 1, rect.Left + 2, rect.Top + 1);
- insidePath.AddLine(rect.Left + 2, rect.Top + 1, rect.Left + 1, rect.Top + 2);
- insidePath.AddLine(rect.Left + 1, rect.Top + 2, rect.Left + 1, rect.Bottom - 4);
-
- // Create the outside right and bottom path
- outsidePath.AddLine(rect.Right - 1, rect.Top + 2, rect.Right - 1, rect.Bottom - 3);
- outsidePath.AddLine(rect.Right - 1, rect.Bottom - 3, rect.Right - 3, rect.Bottom - 1);
- outsidePath.AddLine(rect.Right - 3, rect.Bottom - 1, rect.Left + 3, rect.Bottom - 1);
-
- // Optional path for lightening area
- lightPath.AddLine(rect.Left + 2, rect.Top + 1, rect.Right - 4, rect.Top + 1);
- lightPath.AddLine(rect.Right - 4, rect.Top + 1, rect.Right - 3, rect.Top + 2);
- lightPath.AddLine(rect.Right - 3, rect.Top + 2, rect.Right - 3, rect.Bottom - 4);
- lightPath.AddLine(rect.Right - 3, rect.Bottom - 4, rect.Right - 4, rect.Bottom - 3);
- lightPath.AddLine(rect.Right - 4, rect.Bottom - 3, rect.Left + 2, rect.Bottom - 3);
- lightPath.AddLine(rect.Left + 2, rect.Bottom - 3, rect.Left + 1, rect.Bottom - 4);
- lightPath.AddLine(rect.Left + 1, rect.Bottom - 4, rect.Left + 1, rect.Top + 2);
- lightPath.AddLine(rect.Left + 1, rect.Top + 2, rect.Left + 2, rect.Top + 1);
-
- RectangleF solidRectF = new RectangleF(rect.Left - 1, rect.Top - 1, rect.Width + 2, rect.Height + 2);
- LinearGradientBrush solidBrush = new LinearGradientBrush(solidRectF, c1, c2, 90f);
- cache.solidPen = new Pen(solidBrush);
-
- cache.backRect = new Rectangle(rect.Left + 2, rect.Top + 1, rect.Width - 4, rect.Height - 4);
- cache.solidPath = solidPath;
- cache.insidePath = insidePath;
- cache.outsidePath = outsidePath;
- cache.lightPath = lightPath;
- }
-
- // If tracking, lighten the background
- if (tracking)
- {
- context.Graphics.FillRectangle(lightInside ? _whitenLightLBrush : _whitenLightBrush, cache.backRect);
- }
-
- using (AntiAlias aa = new AntiAlias(context.Graphics))
- {
- // Draw the solid border
- context.Graphics.DrawPath(cache.solidPen, cache.solidPath);
-
- // Do now draw the inside and outside paths if ligtening the inside anyway
- if (!lightInside)
- {
- // Draw the two areas that make a lighter shadow to the right and bottom of border
- context.Graphics.DrawPath(_whitenMediumPen, cache.insidePath);
- context.Graphics.DrawPath(_whitenMediumPen, cache.outsidePath);
- }
- }
-
- if (lightInside)
- {
- context.Graphics.DrawPath(Pens.White, cache.lightPath);
- }
- }
-
- return memento;
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual IDisposable DrawRibbonGroupNormalBorderSep(bool showingInPopup,
- ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- PaletteState state,
- IPaletteRibbonBack palette,
- IDisposable memento,
- bool pressed,
- bool tracking,
- bool dark)
- {
- if ((rect.Width > 0) && (rect.Height > 0))
- {
- Color c1 = palette.GetRibbonBackColor1(state);
- Color c2 = palette.GetRibbonBackColor2(state);
- Color c3 = palette.GetRibbonBackColor3(state);
- Color c4 = palette.GetRibbonBackColor4(state);
- Color c5 = palette.GetRibbonBackColor5(state);
-
- bool generate = true;
- MementoRibbonGroupNormalBorderSep cache;
-
- // Access a cache instance and decide if cache resources need generating
- if (!(memento is MementoRibbonGroupNormalBorderSep))
- {
- memento?.Dispose();
-
- cache = new MementoRibbonGroupNormalBorderSep(rect, c1, c2, c3, c4, c5, tracking, dark);
- memento = cache;
- }
- else
- {
- cache = (MementoRibbonGroupNormalBorderSep)memento;
- generate = !cache.UseCachedValues(rect, c1, c2, c3, c4, c5, tracking, dark);
- }
-
- // Do we need to generate the contents of the cache?
- if (generate)
- {
- // Dispose of existing values
- cache.Dispose();
-
- RectangleF rectF = new RectangleF(rect.X - 1, rect.Y - 1, rect.Width + 2, rect.Height + 2);
- cache.totalBrush = new LinearGradientBrush(rectF, c2, c1, 90f);
- cache.innerBrush = new LinearGradientBrush(rectF, c4, c3, 90f);
- cache.trackSepBrush = new LinearGradientBrush(rectF, c5, c2, 90f);
- cache.totalBrush.Blend = _ribbonGroup9Blend;
- cache.innerBrush.Blend = _ribbonGroup9Blend;
- cache.trackSepBrush.Blend = _ribbonGroup9Blend;
- cache.innerPen = new Pen(cache.innerBrush);
- cache.trackSepPen = new Pen(cache.trackSepBrush);
- cache.trackBottomPen = new Pen(c5);
-
- GraphicsPath trackingPath = new GraphicsPath();
- trackingPath.AddEllipse(new Rectangle(rect.X, rect.Y + (rect.Height / 2), rect.Width - 3, rect.Height));
- cache.trackHighlightBrush = new PathGradientBrush(trackingPath)
- {
- SurroundColors = new Color[] { Color.Transparent },
- CenterColor = (dark ? (rect.Width > 50 ? _whiten60 : _whiten45) : _whiten160),
- CenterPoint = new PointF(rect.X + ((rect.Width - 3) / 2), rect.Height)
- };
- cache.trackFillBrush = new LinearGradientBrush(new RectangleF(rect.X - 1, rect.Y - 1, rect.Width + 2, rect.Height + 1),
- (dark ? _whiten5 : _whiten10),
- (dark ? _whiten5 : _darken5), 90f);
-
- cache.pressedFillBrush = new LinearGradientBrush(new RectangleF(rect.X - 1, rect.Y - 1, rect.Width + 2, rect.Height + 2),
- (dark ? Color.Empty : _whiten10),
- (dark ? _darken38 : _darken16), 90f);
- cache.trackFillBrush.Blend = _linear50Blend;
- }
-
- if (!showingInPopup)
- {
- context.Graphics.FillRectangle(cache.totalBrush, rect.Right - 3, rect.Top, 3, rect.Height);
- context.Graphics.DrawLine(cache.innerPen, rect.Right - 2, rect.Top, rect.Right - 2, rect.Bottom - 1);
- }
-
- if (tracking || pressed)
- {
-
- if (pressed)
- {
- // Lighent the top and darken the bottom of the fill area
- context.Graphics.FillRectangle(cache.pressedFillBrush, rect.X, rect.Y, rect.Width - 2, rect.Height);
- }
- else if (tracking)
- {
- // Lighten the top and darken the bottom of the fill area
- context.Graphics.FillRectangle(cache.trackFillBrush, rect.X, rect.Y, rect.Width - 1, rect.Height - 1);
-
- // Draw the tracking highlight at bottom of area
- context.Graphics.FillRectangle(cache.trackHighlightBrush, rect.X, rect.Y, rect.Width - 1, rect.Height - 1);
- }
-
- if (!showingInPopup && !pressed && !dark)
- {
- // Lighten the right inner edge
- context.Graphics.DrawLine(cache.trackSepPen, rect.Right - 3, rect.Top, rect.Right - 3, rect.Bottom - 1);
- }
-
- if (!showingInPopup && tracking)
- {
- // Lighten the bottom inner edge
- context.Graphics.DrawLine(cache.trackBottomPen, rect.Right - 3, rect.Bottom - 1, rect.Left, rect.Bottom - 1);
- }
- }
- }
-
- return memento;
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual IDisposable DrawRibbonGroupNormalTitle(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- PaletteState state,
- IPaletteRibbonBack palette,
- IDisposable memento)
- {
- if ((rect.Width > 0) && (rect.Height > 0))
- {
- Color c1 = palette.GetRibbonBackColor1(state);
- Color c2 = palette.GetRibbonBackColor2(state);
-
- bool generate = true;
- MementoRibbonGroupNormalTitle cache;
-
- // Access a cache instance and decide if cache resources need generating
- if (!(memento is MementoRibbonGroupNormalTitle))
- {
- memento?.Dispose();
-
- cache = new MementoRibbonGroupNormalTitle(rect, c1, c2);
- memento = cache;
- }
- else
- {
- cache = (MementoRibbonGroupNormalTitle)memento;
- generate = !cache.UseCachedValues(rect, c1, c2);
- }
-
- // Do we need to generate the contents of the cache?
- if (generate)
- {
- // Dispose of existing values
- cache.Dispose();
-
- GraphicsPath titlePath = new GraphicsPath();
-
- // Create the rounded bottom edge to fit inside a group border
- titlePath.AddLine(rect.Left, rect.Top, rect.Right - 1, rect.Top);
- titlePath.AddLine(rect.Right - 1, rect.Top, rect.Right - 1, rect.Bottom - 3);
- titlePath.AddLine(rect.Right - 1, rect.Bottom - 3, rect.Right - 3, rect.Bottom - 1);
- titlePath.AddLine(rect.Right - 3, rect.Bottom - 1, rect.Left + 2, rect.Bottom - 1);
- titlePath.AddLine(rect.Left + 2, rect.Bottom - 1, rect.Left, rect.Bottom - 3);
- titlePath.AddLine(rect.Left, rect.Bottom - 3, rect.Left, rect.Top);
-
- RectangleF rectF = new RectangleF(rect.Left - 0.5f, rect.Top - 0.5f, rect.Width + 1, rect.Height + 1);
- cache.titleBrush = new LinearGradientBrush(rectF, c1, c2, 90f);
- cache.titlePath = titlePath;
- }
-
- // Fill path area with a gradient brush
- context.Graphics.FillPath(cache.titleBrush, cache.titlePath);
- }
-
- return memento;
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual IDisposable DrawRibbonGroupCollapsedBorder(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- PaletteState state,
- IPaletteRibbonBack palette,
- IDisposable memento)
- {
- if ((rect.Width > 0) && (rect.Height > 0))
- {
- // Grab the colors needed for drawing
- Color c1 = palette.GetRibbonBackColor1(state);
- Color c2 = palette.GetRibbonBackColor2(state);
- Color c3 = palette.GetRibbonBackColor3(state);
- Color c4 = palette.GetRibbonBackColor4(state);
-
- bool generate = true;
- MementoRibbonGroupCollapsedBorder cache;
-
- // Access a cache instance and decide if cache resources need generating
- if (!(memento is MementoRibbonGroupCollapsedBorder))
- {
- memento?.Dispose();
-
- cache = new MementoRibbonGroupCollapsedBorder(rect, c1, c2, c3, c4);
- memento = cache;
- }
- else
- {
- cache = (MementoRibbonGroupCollapsedBorder)memento;
- generate = !cache.UseCachedValues(rect, c1, c2, c3, c4);
- }
-
- // Do we need to generate the contents of the cache?
- if (generate)
- {
- // Dispose of existing values
- cache.Dispose();
-
- GraphicsPath solidPath = new GraphicsPath();
- GraphicsPath insidePath = new GraphicsPath();
-
- // Create the rounded complete border
- solidPath.AddLine(rect.Left + 1.25f, rect.Top, rect.Right - 2, rect.Top);
- solidPath.AddLine(rect.Right - 2, rect.Top, rect.Right - 1, rect.Top + 2);
- solidPath.AddLine(rect.Right - 1, rect.Top + 2, rect.Right - 1, rect.Bottom - 3);
- solidPath.AddLine(rect.Right - 1, rect.Bottom - 3, rect.Right - 3, rect.Bottom - 1);
- solidPath.AddLine(rect.Right - 3, rect.Bottom - 1, rect.Left + 2, rect.Bottom - 1);
- solidPath.AddLine(rect.Left + 2, rect.Bottom - 1, rect.Left, rect.Bottom - 3);
- solidPath.AddLine(rect.Left, rect.Bottom - 3, rect.Left, rect.Top + 1.25f);
- solidPath.AddLine(rect.Left, rect.Top + 1.25f, rect.Left + 1.25f, rect.Top);
-
- // Create the inside border
- insidePath.AddLine(rect.Left + 2, rect.Top + 1, rect.Right - 3, rect.Top + 1);
- insidePath.AddLine(rect.Right - 3, rect.Top + 1, rect.Right - 2, rect.Top + 2);
- insidePath.AddLine(rect.Right - 2, rect.Top + 2, rect.Right - 2, rect.Bottom - 3);
- insidePath.AddLine(rect.Right - 2, rect.Bottom - 3, rect.Right - 3, rect.Bottom - 2);
- insidePath.AddLine(rect.Right - 3, rect.Bottom - 2, rect.Left + 2, rect.Bottom - 2);
- insidePath.AddLine(rect.Left + 2, rect.Bottom - 2, rect.Left + 1, rect.Bottom - 3);
- insidePath.AddLine(rect.Left + 1, rect.Bottom - 3, rect.Left + 1, rect.Top + 2);
- insidePath.AddLine(rect.Left + 1, rect.Top + 2, rect.Left + 2, rect.Top + 1);
-
- RectangleF solidRectF = new RectangleF(rect.Left - 1, rect.Top - 1, rect.Width + 2, rect.Height + 2);
- RectangleF insideRectF = new RectangleF(rect.Left, rect.Top, rect.Width, rect.Height);
-
- LinearGradientBrush solidBrush = new LinearGradientBrush(solidRectF, c1, c2, 90f);
- LinearGradientBrush insideBrush = new LinearGradientBrush(insideRectF, c3, c4, 90f);
-
- cache.solidPath = solidPath;
- cache.insidePath = insidePath;
- cache.solidPen = new Pen(solidBrush);
- cache.insidePen = new Pen(insideBrush);
- }
-
- // Perform actual drawing using the cache values
- using (AntiAlias aa = new AntiAlias(context.Graphics))
- {
- context.Graphics.DrawPath(cache.solidPen, cache.solidPath);
- context.Graphics.DrawPath(cache.insidePen, cache.insidePath);
- }
- }
-
- return memento;
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual IDisposable DrawRibbonGroupCollapsedFrameBorder(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- PaletteState state,
- IPaletteRibbonBack palette,
- IDisposable memento)
- {
- if ((rect.Width > 0) && (rect.Height > 0))
- {
- Color c1 = palette.GetRibbonBackColor1(state);
- Color c2 = palette.GetRibbonBackColor2(state);
-
- bool generate = true;
- MementoRibbonGroupCollapsedFrameBorder cache;
-
- // Access a cache instance and decide if cache resources need generating
- if (!(memento is MementoRibbonGroupCollapsedFrameBorder))
- {
- memento?.Dispose();
-
- cache = new MementoRibbonGroupCollapsedFrameBorder(rect, c1, c2);
- memento = cache;
- }
- else
- {
- cache = (MementoRibbonGroupCollapsedFrameBorder)memento;
- generate = !cache.UseCachedValues(rect, c1, c2);
- }
-
- // Do we need to generate the contents of the cache?
- if (generate)
- {
- // Dispose of existing values
- cache.Dispose();
-
- GraphicsPath solidPath = new GraphicsPath();
-
- // Create the rounded complete border
- solidPath.AddLine(rect.Left + 2, rect.Top, rect.Right - 3, rect.Top);
- solidPath.AddLine(rect.Right - 3, rect.Top, rect.Right - 1, rect.Top + 2);
- solidPath.AddLine(rect.Right - 1, rect.Top + 2, rect.Right - 1, rect.Bottom - 3);
- solidPath.AddLine(rect.Right - 1, rect.Bottom - 3, rect.Right - 3, rect.Bottom - 1);
- solidPath.AddLine(rect.Right - 3, rect.Bottom - 1, rect.Left + 2, rect.Bottom - 1);
- solidPath.AddLine(rect.Left + 2, rect.Bottom - 1, rect.Left, rect.Bottom - 3);
- solidPath.AddLine(rect.Left, rect.Bottom - 3, rect.Left, rect.Top + 2);
- solidPath.AddLine(rect.Left, rect.Top + 2, rect.Left + 2, rect.Top);
-
- cache.solidPath = solidPath;
- cache.titleBrush = new SolidBrush(c2);
- cache.solidPen = new Pen(c1);
- }
-
- // Perform actual drawing using the cache values
- Rectangle titleRect = new Rectangle(rect.Left + 1, rect.Bottom - GROUP_FRAME_TITLE_HEIGHT, rect.Width - 2, GROUP_FRAME_TITLE_HEIGHT - 1);
- context.Graphics.FillRectangle(cache.titleBrush, titleRect);
-
- using (AntiAlias aa = new AntiAlias(context.Graphics))
- {
- context.Graphics.DrawPath(cache.solidPen, cache.solidPath);
- }
- }
-
- return memento;
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual IDisposable DrawRibbonGroupGradientOne(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- PaletteState state,
- IPaletteRibbonBack palette,
- IDisposable memento)
- {
- if ((rect.Width > 0) && (rect.Height > 0))
- {
- Color c1 = palette.GetRibbonBackColor1(state);
- Color c2 = palette.GetRibbonBackColor2(state);
-
- bool generate = true;
- MementoRibbonGroupGradientOne cache;
-
- // Access a cache instance and decide if cache resources need generating
- if (!(memento is MementoRibbonGroupGradientOne))
- {
- memento?.Dispose();
-
- cache = new MementoRibbonGroupGradientOne(rect, c1, c2);
- memento = cache;
- }
- else
- {
- cache = (MementoRibbonGroupGradientOne)memento;
- generate = !cache.UseCachedValues(rect, c1, c2);
- }
-
- // Do we need to generate the contents of the cache?
- if (generate)
- {
- // Dispose of existing values
- cache.Dispose();
-
- RectangleF rectF = new RectangleF(rect.Left - 1, rect.Top - 1, rect.Width + 2, rect.Height + 2);
- cache.brush = new LinearGradientBrush(rectF, c1, c2, 90f)
- {
- Blend = _ribbonGroup8Blend
- };
- }
-
- // Perform actual drawing using the cache values
- context.Graphics.FillRectangle(cache.brush, rect);
- }
-
- return memento;
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual IDisposable DrawRibbonGroupGradientTwo(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- PaletteState state,
- IPaletteRibbonBack palette,
- float percent,
- IDisposable memento)
- {
- if ((rect.Width > 0) && (rect.Height > 0))
- {
- Color c1 = palette.GetRibbonBackColor1(state);
- Color c2 = palette.GetRibbonBackColor2(state);
- Color c3 = palette.GetRibbonBackColor3(state);
- Color c4 = palette.GetRibbonBackColor4(state);
-
- bool generate = true;
- MementoRibbonGroupGradientTwo cache;
-
- // Access a cache instance and decide if cache resources need generating
- if (!(memento is MementoRibbonGroupGradientTwo))
- {
- memento?.Dispose();
-
- cache = new MementoRibbonGroupGradientTwo(rect, c1, c2, c3, c4);
- memento = cache;
- }
- else
- {
- cache = (MementoRibbonGroupGradientTwo)memento;
- generate = !cache.UseCachedValues(rect, c1, c2, c3, c4);
- }
-
- // Do we need to generate the contents of the cache?
- if (generate)
- {
- // Dispose of existing values
- cache.Dispose();
-
- int topHeight = (int)(rect.Height * percent);
- Rectangle topRect = new Rectangle(rect.Left, rect.Top, rect.Width, topHeight);
- Rectangle bottomRect = new Rectangle(rect.Left, topRect.Bottom, rect.Width, rect.Height - topHeight);
- RectangleF topRectF = new RectangleF(topRect.Left - 1, topRect.Top - 1, topRect.Width + 2, topRect.Height + 2);
- RectangleF bottomRectF = new RectangleF(bottomRect.Left - 1, bottomRect.Top - 1, bottomRect.Width + 2, bottomRect.Height + 2);
-
- cache.topBrush = new LinearGradientBrush(topRectF, c1, c2, 90f);
- cache.bottomBrush = new LinearGradientBrush(bottomRectF, c3, c4, 90f);
- cache.topRect = topRect;
- cache.bottomRect = bottomRect;
- }
-
- // Perform actual drawing using the cache values
- context.Graphics.FillRectangle(cache.topBrush, cache.topRect);
- context.Graphics.FillRectangle(cache.bottomBrush, cache.bottomRect);
- }
-
- return memento;
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual IDisposable DrawRibbonQATMinibarSingle(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- PaletteState state,
- IPaletteRibbonBack palette,
- bool composition,
- IDisposable memento)
- {
- if ((rect.Width > 0) && (rect.Height > 0))
- {
- Color c1 = palette.GetRibbonBackColor1(state);
- Color c2 = palette.GetRibbonBackColor2(state);
- Color c3 = palette.GetRibbonBackColor3(state);
- Color c4 = palette.GetRibbonBackColor4(state);
- Color c5 = palette.GetRibbonBackColor5(state);
-
- bool generate = true;
- MementoRibbonQATMinibar cache;
-
- // Access a cache instance and decide if cache resources need generating
- if (!(memento is MementoRibbonQATMinibar))
- {
- memento?.Dispose();
-
- cache = new MementoRibbonQATMinibar(rect, c1, c2, c3, c4, c5);
- memento = cache;
- }
- else
- {
- cache = (MementoRibbonQATMinibar)memento;
- generate = !cache.UseCachedValues(rect, c1, c2, c3, c4, c5);
- }
-
- // Do we need to generate the contents of the cache?
- if (generate)
- {
- // Dispose of existing values
- cache.Dispose();
-
- GraphicsPath borderPath = new GraphicsPath();
- GraphicsPath topRight1 = new GraphicsPath();
- GraphicsPath bottomLeft1 = new GraphicsPath();
-
- // Find values needed for drawing the main border
- int left = rect.X + 1;
- int right = rect.Right - 3;
- int top = rect.Y + 2;
- int bottom = rect.Bottom - 3;
- int middle = top + ((bottom - top) / 2);
-
- // Construct closed path for the main border
- borderPath.AddLine(right - 8, bottom, left + 10.75f, bottom);
- borderPath.AddLine(left + 10.75f, bottom, left + 10, bottom - 8f);
- borderPath.AddLine(left + 10, bottom - 8f, left + 9, bottom - 11f);
- borderPath.AddLine(left + 9, bottom - 11f, left + 8, bottom - 13f);
- borderPath.AddLine(left + 8, bottom - 13f, left + 7, bottom - 15f);
- borderPath.AddLine(left + 7, bottom - 15f, left + 1, top + 0.25f);
- borderPath.AddLine(left + 1, top + 0.25f, left - 1, top + 0.25f);
- borderPath.AddLine(left - 1, top + 0.25f, right - 8, top + 0.25f);
- borderPath.AddLine(right - 8, top + 0.25f, right - 5, top + 1);
- borderPath.AddLine(right - 5, top + 1, right - 1, top + 5);
- borderPath.AddLine(right - 1, top + 5, right, top + 8);
- borderPath.AddLine(right, top + 8, right + 0.40f, middle);
- borderPath.AddLine(right + 0.40f, middle, right, bottom - 8.25f);
- borderPath.AddLine(right, bottom - 8.25f, right - 1, bottom - 5.25f);
- borderPath.AddLine(right - 1, bottom - 5.25f, right - 5, bottom - 1.25f);
- borderPath.AddLine(right - 5, bottom - 1.25f, right - 8, bottom);
-
- // Create the top right light paths
- topRight1.AddLine(rect.Left - 1, rect.Top + 1.25f, rect.Right - 11, rect.Top + 1.25f);
- topRight1.AddLine(rect.Right - 11, rect.Top + 1.5f, rect.Right - 8, rect.Top + 2.25f);
- topRight1.AddLine(rect.Right - 8, rect.Top + 2.25f, rect.Right - 5, rect.Top + 5.75f);
-
- // Create the bottom left light paths
- bottomLeft1.AddLine(rect.Left + 10.75f, rect.Bottom - 11, rect.Left + 10.75f, rect.Bottom - 5);
- bottomLeft1.AddLine(rect.Left + 10.75f, rect.Bottom - 5, rect.Left + 13, rect.Bottom - 2);
- bottomLeft1.AddLine(rect.Left + 13, rect.Bottom - 2, rect.Right - 11, rect.Bottom - 2);
- bottomLeft1.AddLine(rect.Right - 11, rect.Bottom - 2, rect.Right - 8.5f, rect.Bottom - 3);
- bottomLeft1.AddLine(rect.Right - 8.5f, rect.Bottom - 3, rect.Right - 4.5f, rect.Bottom - 7);
- bottomLeft1.AddLine(rect.Right - 4.5f, rect.Bottom - 7, rect.Right - 2.5f, rect.Bottom - 9);
- bottomLeft1.AddLine(rect.Right - 2.5f, rect.Bottom - 9, rect.Right - 2, rect.Bottom - 11);
- bottomLeft1.AddLine(rect.Right - 2, rect.Bottom - 11, rect.Right - 2, rect.Bottom - 15);
-
- RectangleF gradientRect = rect;
- gradientRect.Y += 1.5f;
- gradientRect.Height *= 1.25f;
- cache.innerBrush = new LinearGradientBrush(gradientRect, c2, c3, 90f);
- cache.innerBrush.SetSigmaBellShape(0.5f);
-
- cache.borderPath = borderPath;
- cache.topRight1 = topRight1;
- cache.bottomLeft1 = bottomLeft1;
- cache.lightPen = new Pen(c4, 2f);
- cache.borderPen = new Pen(c1);
- cache.whitenPen = new Pen(c5);
- }
-
- using (AntiAlias aa = new AntiAlias(context.Graphics))
- {
- if (!composition)
- {
- // Draw the light borders
- context.Graphics.DrawPath(cache.lightPen, cache.topRight1);
- context.Graphics.DrawPath(cache.lightPen, cache.bottomLeft1);
-
- // Draw the inside background and main border
- context.Graphics.FillPath(cache.innerBrush, cache.borderPath);
- context.Graphics.DrawPath(cache.borderPen, cache.borderPath);
-
- // Overdraw top for lighter effect
- context.Graphics.DrawLine(cache.whitenPen, rect.Left + 10, rect.Top + 2, rect.Right - 10, rect.Top + 2);
- context.Graphics.DrawLine(cache.whitenPen, rect.Left + 12, rect.Top + 3, rect.Right - 8, rect.Top + 3);
- context.Graphics.DrawLine(cache.whitenPen, rect.Left + 14, rect.Top + 4, rect.Right - 7, rect.Top + 4);
- }
- else
- {
- // Fill with a semi-transparent background/border
- context.Graphics.FillPath(_compositionBrush, cache.borderPath);
- context.Graphics.DrawPath(_compositionPen, cache.borderPath);
- }
- }
- }
-
- return memento;
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual IDisposable DrawRibbonQATMinibarDouble(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- PaletteState state,
- IPaletteRibbonBack palette,
- bool composition,
- IDisposable memento)
- {
- if ((rect.Width > 0) && (rect.Height > 0))
- {
- Color c1 = palette.GetRibbonBackColor1(state);
- Color c2 = palette.GetRibbonBackColor2(state);
- Color c3 = palette.GetRibbonBackColor3(state);
- Color c4 = palette.GetRibbonBackColor4(state);
- Color c5 = palette.GetRibbonBackColor5(state);
-
- bool generate = true;
- MementoRibbonQATMinibar cache;
-
- // Access a cache instance and decide if cache resources need generating
- if (!(memento is MementoRibbonQATMinibar))
- {
- memento?.Dispose();
-
- cache = new MementoRibbonQATMinibar(rect, c1, c2, c3, c4, c5);
- memento = cache;
- }
- else
- {
- cache = (MementoRibbonQATMinibar)memento;
- generate = !cache.UseCachedValues(rect, c1, c2, c3, c4, c5);
- }
-
- // Do we need to generate the contents of the cache?
- if (generate)
- {
- // Dispose of existing values
- cache.Dispose();
-
- GraphicsPath borderPath = new GraphicsPath();
- GraphicsPath topRight1 = new GraphicsPath();
- GraphicsPath bottomLeft1 = new GraphicsPath();
-
- // Find values needed for drawing the main border
- int left = rect.X + 1;
- int right = rect.Right - 3;
- int top = rect.Y + 2;
- int bottom = rect.Bottom - 3;
- int middle = top + ((bottom - top) / 2);
-
- // Construct closed path for the main border
- borderPath.AddLine(right - 8, top + 0.25f, right - 5, top + 1);
- borderPath.AddLine(right - 5, top + 1, right - 1, top + 5);
- borderPath.AddLine(right - 1, top + 5, right, top + 8);
- borderPath.AddLine(right, top + 8, right + 0.40f, middle);
- borderPath.AddLine(right + 0.40f, middle, right, bottom - 8.25f);
- borderPath.AddLine(right, bottom - 8.25f, right - 1, bottom - 5.25f);
- borderPath.AddLine(right - 1, bottom - 5.25f, right - 5, bottom - 1.25f);
- borderPath.AddLine(right - 5, bottom - 1.25f, right - 8, bottom);
- borderPath.AddLine(right - 8, bottom, left + 9, bottom);
- borderPath.AddLine(left + 9, bottom, left + 6, bottom - 1.25f);
- borderPath.AddLine(left + 6, bottom - 1.25f, left + 2, bottom - 5.25f);
- borderPath.AddLine(left + 2, bottom - 5.25f, left + 1, bottom - 8.25f);
- borderPath.AddLine(left + 1, bottom - 8.25f, left + 0.40f, middle);
- borderPath.AddLine(left + 0.40f, middle, left + 1, top + 8);
- borderPath.AddLine(left + 1, top + 8, left + 2, top + 5);
- borderPath.AddLine(left + 2, top + 5, left + 6, top + 1);
- borderPath.AddLine(left + 6, top + 1, left + 9, top + 0.25f);
- borderPath.AddLine(left + 9, top + 0.25f, right - 8, top + 0.25f);
-
- // Create the top right light paths
- topRight1.AddLine(rect.Left + 8, rect.Top + 3.25f, rect.Left + 10, rect.Top + 1.25f);
- topRight1.AddLine(rect.Left + 10, rect.Top + 1.25f, rect.Right - 11, rect.Top + 1.25f);
- topRight1.AddLine(rect.Right - 11, rect.Top + 1.5f, rect.Right - 8, rect.Top + 2.25f);
- topRight1.AddLine(rect.Right - 8, rect.Top + 2.25f, rect.Right - 5, rect.Top + 5.75f);
-
- // Create the bottom left light paths
- bottomLeft1.AddLine(rect.Left + 13, rect.Bottom - 2, rect.Right - 11, rect.Bottom - 2);
- bottomLeft1.AddLine(rect.Right - 11, rect.Bottom - 2, rect.Right - 8.5f, rect.Bottom - 3);
- bottomLeft1.AddLine(rect.Right - 8.5f, rect.Bottom - 3, rect.Right - 4.5f, rect.Bottom - 7);
- bottomLeft1.AddLine(rect.Right - 4.5f, rect.Bottom - 7, rect.Right - 2.5f, rect.Bottom - 9);
- bottomLeft1.AddLine(rect.Right - 2.5f, rect.Bottom - 9, rect.Right - 2, rect.Bottom - 11);
- bottomLeft1.AddLine(rect.Right - 2, rect.Bottom - 11, rect.Right - 2, rect.Bottom - 15);
-
- RectangleF gradientRect = rect;
- gradientRect.Y += 1.5f;
- gradientRect.Height *= 1.25f;
- cache.innerBrush = new LinearGradientBrush(gradientRect, c2, c3, 90f);
- cache.innerBrush.SetSigmaBellShape(0.5f);
-
- cache.borderPath = borderPath;
- cache.topRight1 = topRight1;
- cache.bottomLeft1 = bottomLeft1;
- cache.lightPen = new Pen(c4, 2f);
- cache.borderPen = new Pen(c1);
- cache.whitenPen = new Pen(c5);
- }
-
- using (AntiAlias aa = new AntiAlias(context.Graphics))
- {
- if (!composition)
- {
- // Draw the light borders
- context.Graphics.DrawPath(cache.lightPen, cache.topRight1);
- context.Graphics.DrawPath(cache.lightPen, cache.bottomLeft1);
-
- // Draw the inside background and main border
- context.Graphics.FillPath(cache.innerBrush, cache.borderPath);
- context.Graphics.DrawPath(cache.borderPen, cache.borderPath);
- }
- else
- {
- // Fill with a semi-transparent background/border
- context.Graphics.FillPath(_compositionBrush, cache.borderPath);
- context.Graphics.DrawPath(_compositionPen, cache.borderPath);
- }
- }
- }
-
- return memento;
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual IDisposable DrawRibbonLinear(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- PaletteState state,
- IPaletteRibbonBack palette,
- IDisposable memento)
- {
- if ((rect.Width > 0) && (rect.Height > 0))
- {
- Color c1 = palette.GetRibbonBackColor1(state);
- Color c2 = palette.GetRibbonBackColor2(state);
-
- bool generate = true;
- MementoRibbonLinear cache;
-
- // Access a cache instance and decide if cache resources need generating
- if (!(memento is MementoRibbonLinear))
- {
- memento?.Dispose();
-
- cache = new MementoRibbonLinear(rect, c1, c2);
- memento = cache;
- }
- else
- {
- cache = (MementoRibbonLinear)memento;
- generate = !cache.UseCachedValues(rect, c1, c2);
- }
-
- // Do we need to generate the contents of the cache?
- if (generate)
- {
- // Dispose of existing values
- cache.Dispose();
-
- cache.linearBrush = new LinearGradientBrush(new RectangleF(rect.X - 1, rect.Y - 1, rect.Width + 2, rect.Height + 2), c1, c2, 90f);
- }
-
- context.Graphics.FillRectangle(cache.linearBrush, rect);
- }
-
- return memento;
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual IDisposable DrawRibbonLinearBorder(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- PaletteState state,
- IPaletteRibbonBack palette,
- IDisposable memento)
- {
- if ((rect.Width > 0) && (rect.Height > 0))
- {
- Color c1 = palette.GetRibbonBackColor1(state);
- Color c2 = palette.GetRibbonBackColor2(state);
-
- bool generate = true;
- MementoRibbonLinearBorder cache;
-
- // Access a cache instance and decide if cache resources need generating
- if (!(memento is MementoRibbonLinearBorder))
- {
- memento?.Dispose();
-
- cache = new MementoRibbonLinearBorder(rect, c1, c2);
- memento = cache;
- }
- else
- {
- cache = (MementoRibbonLinearBorder)memento;
- generate = !cache.UseCachedValues(rect, c1, c2);
- }
-
- // Do we need to generate the contents of the cache?
- if (generate)
- {
- // Dispose of existing values
- cache.Dispose();
-
- cache.linearBrush = new LinearGradientBrush(new RectangleF(rect.X - 1, rect.Y - 1, rect.Width + 2, rect.Height + 2), c1, c2, 90f);
- cache.linearPen = new Pen(cache.linearBrush);
-
- // Create the rounded complete border
- GraphicsPath borderPath = new GraphicsPath();
- borderPath.AddLine(rect.Left + 2, rect.Top, rect.Right - 3, rect.Top);
- borderPath.AddLine(rect.Right - 3, rect.Top, rect.Right - 1, rect.Top + 2);
- borderPath.AddLine(rect.Right - 1, rect.Top + 2, rect.Right - 1, rect.Bottom - 3);
- borderPath.AddLine(rect.Right - 1, rect.Bottom - 3, rect.Right - 3, rect.Bottom - 1);
- borderPath.AddLine(rect.Right - 3, rect.Bottom - 1, rect.Left + 2, rect.Bottom - 1);
- borderPath.AddLine(rect.Left + 2, rect.Bottom - 1, rect.Left, rect.Bottom - 3);
- borderPath.AddLine(rect.Left, rect.Bottom - 3, rect.Left, rect.Top + 2);
- borderPath.AddLine(rect.Left, rect.Top + 2, rect.Left + 2, rect.Top);
- cache.borderPath = borderPath;
-
- }
-
- context.Graphics.DrawPath(cache.linearPen, cache.borderPath);
- }
-
- return memento;
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual IDisposable DrawRibbonAppMenuInner(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- PaletteState state,
- IPaletteRibbonBack palette,
- IDisposable memento)
- {
- if ((rect.Width > 0) && (rect.Height > 0))
- {
- Color c1 = palette.GetRibbonBackColor1(state);
- Color c2 = palette.GetRibbonBackColor2(state);
-
- bool generate = true;
- MementoRibbonAppButtonInner cache;
-
- // Access a cache instance and decide if cache resources need generating
- if (!(memento is MementoRibbonAppButtonInner))
- {
- memento?.Dispose();
-
- cache = new MementoRibbonAppButtonInner(rect, c1, c2);
- memento = cache;
- }
- else
- {
- cache = (MementoRibbonAppButtonInner)memento;
- generate = !cache.UseCachedValues(rect, c1, c2);
- }
-
- // Do we need to generate the contents of the cache?
- if (generate)
- {
- // Dispose of existing values
- cache.Dispose();
-
- cache.outsideBrush = new SolidBrush(c1);
- cache.insideBrush = new SolidBrush(c2);
- }
-
- // Draw the outside in one color and the inside with another
- context.Graphics.FillRectangle(cache.outsideBrush, rect);
- rect.Inflate(-1, -1);
- context.Graphics.FillRectangle(cache.insideBrush, rect);
- }
-
- return memento;
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual IDisposable DrawRibbonAppMenuOuter(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- PaletteState state,
- IPaletteRibbonBack palette,
- IDisposable memento)
- {
- if ((rect.Width > 0) && (rect.Height > 0))
- {
- Color c1 = palette.GetRibbonBackColor1(state);
- Color c2 = palette.GetRibbonBackColor2(state);
- Color c3 = palette.GetRibbonBackColor3(state);
-
- bool generate = true;
- MementoRibbonAppButtonOuter cache;
-
- // Access a cache instance and decide if cache resources need generating
- if (!(memento is MementoRibbonAppButtonOuter))
- {
- memento?.Dispose();
-
- cache = new MementoRibbonAppButtonOuter(rect, c1, c2, c3);
- memento = cache;
- }
- else
- {
- cache = (MementoRibbonAppButtonOuter)memento;
- generate = !cache.UseCachedValues(rect, c1, c2, c3);
- }
-
- // Do we need to generate the contents of the cache?
- if (generate)
- {
- // Dispose of existing values
- cache.Dispose();
-
- cache.wholeBrush = new SolidBrush(c1);
- cache.backPath = new GraphicsPath();
- cache.backPath.AddLine(rect.X + 1, rect.Y, rect.Right - 1, rect.Y);
- cache.backPath.AddLine(rect.Right - 1, rect.Y, rect.Right, rect.Y + 1);
- cache.backPath.AddLine(rect.Right, rect.Y + 1, rect.Right, rect.Bottom - 2);
- cache.backPath.AddLine(rect.Right, rect.Bottom - 2, rect.Right - 2, rect.Bottom);
- cache.backPath.AddLine(rect.Right - 2, rect.Bottom, rect.X + 1, rect.Bottom);
- cache.backPath.AddLine(rect.X + 2, rect.Bottom, rect.X, rect.Bottom - 2);
- cache.backPath.AddLine(rect.X, rect.Bottom - 2, rect.X, rect.Y + 1);
- cache.backPath.AddLine(rect.X, rect.Y + 1, rect.X + 1, rect.Y);
- cache.bottomDarkGradient = new LinearGradientBrush(new Point(rect.X, rect.Bottom - 15), new Point(rect.X, rect.Bottom), c2, c3);
- cache.topLightenGradient = new LinearGradientBrush(new Point(rect.X, rect.Y - 1), new Point(rect.X, rect.Y + 7), _whiten64, _whiten32);
- }
-
- // Draw entire background in solid brush
- context.Graphics.FillPath(cache.wholeBrush, cache.backPath);
- context.Graphics.FillRectangle(cache.bottomDarkGradient, new Rectangle(rect.X, rect.Bottom - 14, rect.Width, 13));
- context.Graphics.FillRectangle(cache.topLightenGradient, new Rectangle(rect.X, rect.Y, rect.Width, 6));
- }
-
- return memento;
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual IDisposable DrawRibbonQATFullbarRound(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- PaletteState state,
- IPaletteRibbonBack palette,
- IDisposable memento)
- {
- // We never draw the top line
- rect.Y++;
- rect.Height--;
-
- if ((rect.Width > 0) && (rect.Height > 0))
- {
- Color c1 = palette.GetRibbonBackColor1(state);
- Color c2 = palette.GetRibbonBackColor2(state);
- Color c3 = palette.GetRibbonBackColor3(state);
-
- bool generate = true;
- MementoRibbonQATFullbarRound cache;
-
- // Access a cache instance and decide if cache resources need generating
- if (!(memento is MementoRibbonQATFullbarRound))
- {
- memento?.Dispose();
-
- cache = new MementoRibbonQATFullbarRound(rect, c1, c2, c3);
- memento = cache;
- }
- else
- {
- cache = (MementoRibbonQATFullbarRound)memento;
- generate = !cache.UseCachedValues(rect, c1, c2, c3);
- }
-
- // Do we need to generate the contents of the cache?
- if (generate)
- {
- // Dispose of existing values
- cache.Dispose();
-
- cache.innerRect = new Rectangle(rect.X + 1, rect.Y + 1, rect.Width - 2, rect.Height - 2);
- cache.innerBrush = new LinearGradientBrush(rect, c1, c2, 90f);
- cache.darkPen = new Pen(c3);
-
- GraphicsPath darkPath = new GraphicsPath();
- GraphicsPath lightPath1 = new GraphicsPath();
- GraphicsPath lightPath2 = new GraphicsPath();
-
- // Create the dark border
- darkPath.AddLine(rect.Left, rect.Top + 0.75f, rect.Left + 1, rect.Top);
- darkPath.AddLine(rect.Left + 1, rect.Top, rect.Right - 3.5f, rect.Top);
- darkPath.AddLine(rect.Right - 3.5f, rect.Top, rect.Right - 2, rect.Top + 2);
- darkPath.AddLine(rect.Right - 2, rect.Top + 2, rect.Right - 2, rect.Bottom - 3.25f);
- darkPath.AddLine(rect.Right - 2, rect.Bottom - 3.25f, rect.Right - 3.25f, rect.Bottom - 2);
- darkPath.AddLine(rect.Right - 3.25f, rect.Bottom - 2, rect.Left, rect.Bottom - 2);
-
- // Create the first light border
- lightPath1.AddLine(rect.Left, rect.Bottom - 3, rect.Left, rect.Top + 2.5f);
- lightPath1.AddLine(rect.Left, rect.Top + 2.5f, rect.Left + 1, rect.Top + 1);
- lightPath1.AddLine(rect.Left + 1, rect.Top + 1, rect.Right - 4, rect.Top + 1);
-
- // Create the second light border
- lightPath2.AddLine(rect.Right - 1, rect.Top + 2, rect.Right - 1, rect.Bottom - 2);
- lightPath2.AddLine(rect.Right - 1, rect.Bottom - 2, rect.Right - 2, rect.Bottom - 1);
- lightPath2.AddLine(rect.Right - 2, rect.Bottom - 1, rect.Left + 1, rect.Bottom - 1);
-
- cache.darkPath = darkPath;
- cache.lightPath1 = lightPath1;
- cache.lightPath2 = lightPath2;
- }
-
- // Draw a gradient for the inside of the area
- context.Graphics.FillRectangle(cache.innerBrush, cache.innerRect);
-
- // Draw the dark/light lines
- using (AntiAlias aa = new AntiAlias(context.Graphics))
- {
- context.Graphics.DrawPath(cache.darkPen, cache.darkPath);
- context.Graphics.DrawPath(_light1Pen, cache.lightPath1);
- context.Graphics.DrawPath(_light2Pen, cache.lightPath2);
- }
- }
-
- return memento;
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual IDisposable DrawRibbonQATFullbarSquare(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- PaletteState state,
- IPaletteRibbonBack palette,
- IDisposable memento)
- {
- if ((rect.Width > 0) && (rect.Height > 0))
- {
- Color c1 = palette.GetRibbonBackColor1(state);
- Color c2 = palette.GetRibbonBackColor2(state);
- Color c3 = palette.GetRibbonBackColor3(state);
-
- bool generate = true;
- MementoRibbonQATFullbarSquare cache;
-
- // Access a cache instance and decide if cache resources need generating
- if (!(memento is MementoRibbonQATFullbarSquare))
- {
- memento?.Dispose();
-
- cache = new MementoRibbonQATFullbarSquare(rect, c1, c2, c3);
- memento = cache;
- }
- else
- {
- cache = (MementoRibbonQATFullbarSquare)memento;
- generate = !cache.UseCachedValues(rect, c1, c2, c3);
- }
-
- // Do we need to generate the contents of the cache?
- if (generate)
- {
- // Dispose of existing values
- cache.Dispose();
-
- cache.lightPen = new Pen(c1);
- cache.mediumBrush = new SolidBrush(c2);
- cache.darkPen = new Pen(c3);
- }
-
- // Fill entire area in background brush
- context.Graphics.FillRectangle(cache.mediumBrush, rect);
-
- // Draw the outside border
- context.Graphics.DrawRectangle(cache.darkPen, rect.X, rect.Y, rect.Width - 1, rect.Height - 1);
-
- // Draw ligher top and bottom lines
- context.Graphics.DrawLine(cache.lightPen, rect.X + 1, rect.Y + 1, rect.Width - 2, rect.Y + 1);
- context.Graphics.DrawLine(cache.lightPen, rect.X + 1, rect.Bottom - 2, rect.Width - 2, rect.Bottom - 2);
- }
-
- return memento;
- }
-
- ///
- /// Internal rendering method.
- ///
- protected virtual IDisposable DrawRibbonQATOverflow(PaletteRibbonShape shape,
- ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- PaletteState state,
- IPaletteRibbonBack palette,
- IDisposable memento)
- {
- if ((rect.Width > 0) && (rect.Height > 0))
- {
- Color c1 = palette.GetRibbonBackColor1(state);
- Color c2 = palette.GetRibbonBackColor2(state);
-
- bool generate = true;
- MementoRibbonQATOverflow cache;
-
- // Access a cache instance and decide if cache resources need generating
- if (!(memento is MementoRibbonQATOverflow))
- {
- memento?.Dispose();
-
- cache = new MementoRibbonQATOverflow(rect, c1, c2);
- memento = cache;
- }
- else
- {
- cache = (MementoRibbonQATOverflow)memento;
- generate = !cache.UseCachedValues(rect, c1, c2);
- }
-
- // Do we need to generate the contents of the cache?
- if (generate)
- {
- // Dispose of existing values
- cache.Dispose();
-
- cache.backBrush = new SolidBrush(c1);
- cache.borderPen = new Pen(c2);
- }
-
- // Draw a gradient for the inside of the area
- context.Graphics.FillRectangle(cache.backBrush, rect);
-
- using (AntiAlias aa = new AntiAlias(context.Graphics))
- {
- if (shape == PaletteRibbonShape.Office2010)
- {
- context.Graphics.DrawPolygon(cache.borderPen, new Point[]{ new Point(rect.Left + 1, rect.Top),
- new Point(rect.Right - 2, rect.Top),
- new Point(rect.Right - 1, rect.Top + 1),
- new Point(rect.Right - 1, rect.Bottom - 2),
- new Point(rect.Right - 2, rect.Bottom - 1),
- new Point(rect.Left + 1, rect.Bottom - 1),
- new Point(rect.Left, rect.Bottom - 2),
- new Point(rect.Left, rect.Top + 1) });
- }
- else
- {
- context.Graphics.DrawLine(cache.borderPen, rect.Left + 1f, rect.Top, rect.Right - 2f, rect.Top);
- context.Graphics.DrawLine(cache.borderPen, rect.Right - 2f, rect.Top, rect.Right - 1f, rect.Top + 2f);
- context.Graphics.DrawLine(cache.borderPen, rect.Right - 1f, rect.Top + 2f, rect.Right - 1f, rect.Bottom - 2f);
- context.Graphics.DrawLine(cache.borderPen, rect.Right - 1f, rect.Bottom - 2f, rect.Right - 2f, rect.Bottom - 1f);
- context.Graphics.DrawLine(cache.borderPen, rect.Right - 2f, rect.Bottom - 1f, rect.Left + 1f, rect.Bottom - 1f);
- context.Graphics.DrawLine(cache.borderPen, rect.Left + 1f, rect.Bottom - 1f, rect.Left, rect.Bottom - 2f);
- context.Graphics.DrawLine(cache.borderPen, rect.Left, rect.Bottom - 2f, rect.Left, rect.Top + 1f);
- context.Graphics.DrawLine(cache.borderPen, rect.Left, rect.Top + 1f, rect.Left + 1f, rect.Top);
- }
- }
- }
-
- return memento;
- }
- #endregion
-
- #region StandardContentMemento
- ///
- /// Internal help class used to store content rendering details.
- ///
- private class StandardContentMemento : IDisposable
- {
- // Instance fields
- public bool DrawImage;
- public bool DrawShortText;
- public bool DrawLongText;
- public Image Image;
- public Color ImageTransparentColor;
- public Rectangle ImageRect;
- public PaletteTextTrim ShortTextTrimming;
- public AccurateTextMemento ShortTextMemento;
- public Rectangle ShortTextRect;
- public TextRenderingHint ShortTextHint;
- public PaletteTextTrim LongTextTrimming;
- public AccurateTextMemento LongTextMemento;
- public Rectangle LongTextRect;
- public TextRenderingHint LongTextHint;
- public VisualOrientation Orientation;
-
- ///
- /// Inititialize a new instance of the StandardContentMemento class.
- ///
- public StandardContentMemento()
- {
- LongTextTrimming = PaletteTextTrim.EllipsisCharacter;
- ShortTextTrimming = PaletteTextTrim.EllipsisCharacter;
- Orientation = VisualOrientation.Top;
- }
-
- ///
- /// Dispose of resources.
- ///
- public void Dispose()
- {
- if (ShortTextMemento != null)
- {
- ShortTextMemento.Dispose();
- ShortTextMemento = null;
- }
-
- if (LongTextMemento != null)
- {
- LongTextMemento.Dispose();
- LongTextMemento = null;
- }
- }
-
- ///
- /// Adjust the memento values to apply an orientation.
- ///
- /// Visual orientation of contents.
- /// Rectangle that contains the contents.
- public void AdjustForOrientation(VisualOrientation orientation,
- Rectangle displayRect)
- {
- switch (orientation)
- {
- case VisualOrientation.Top:
- // Do nothing, the contents are in top orientation to start with
- break;
- case VisualOrientation.Bottom:
- Orientation = VisualOrientation.Bottom;
-
- // Reposition the image relative the display rectangle
- if (DrawImage)
- {
- ImageRect.X = displayRect.Right - ImageRect.Width - (ImageRect.X - displayRect.Left);
- ImageRect.Y = displayRect.Bottom - ImageRect.Height - (ImageRect.Y - displayRect.Top);
- }
-
- // Reposition the short text relative the display rectangle
- if (DrawShortText)
- {
- ShortTextRect.X = displayRect.Right - ShortTextRect.Width - (ShortTextRect.X - displayRect.Left);
- ShortTextRect.Y = displayRect.Bottom - ShortTextRect.Height - (ShortTextRect.Y - displayRect.Top);
- }
-
- // Reposition the long text relative the display rectangle
- if (DrawLongText)
- {
- LongTextRect.X = displayRect.Right - LongTextRect.Width - (LongTextRect.X - displayRect.Left);
- LongTextRect.Y = displayRect.Bottom - LongTextRect.Height - (LongTextRect.Y - displayRect.Top);
- }
- break;
- case VisualOrientation.Left:
- Orientation = VisualOrientation.Left;
-
- // Reposition the image relative the display rectangle
- if (DrawImage)
- {
- int x = ImageRect.Y - displayRect.Top;
- ImageRect.Y = (displayRect.Top + displayRect.Width) - ImageRect.Width - (ImageRect.X - displayRect.X);
- ImageRect.X = x + displayRect.Left;
- }
-
- // Reposition the short text relative the display rectangle
- if (DrawShortText)
- {
- int x = ShortTextRect.Y - displayRect.Top;
- ShortTextRect.Y = (displayRect.Top + displayRect.Width) - ShortTextRect.Width - (ShortTextRect.X - displayRect.X);
- ShortTextRect.X = x + displayRect.Left;
- SwapRectangleSizes(ref ShortTextRect);
- }
-
- // Reposition the long text relative the display rectangle
- if (DrawLongText)
- {
- int x = LongTextRect.Y - displayRect.Top;
- LongTextRect.Y = (displayRect.Top + displayRect.Width) - LongTextRect.Width - (LongTextRect.X - displayRect.X);
- LongTextRect.X = x + displayRect.Left;
- SwapRectangleSizes(ref LongTextRect);
- }
- break;
- case VisualOrientation.Right:
- Orientation = VisualOrientation.Right;
-
- // Reposition the image relative the display rectangle
- if (DrawImage)
- {
- int y = ImageRect.X - displayRect.Left;
- ImageRect.X = (displayRect.Left + displayRect.Bottom) - ImageRect.Bottom;
- ImageRect.Y = y + displayRect.Top;
- }
-
- // Reposition the short text relative the display rectangle
- if (DrawShortText)
- {
- int y = ShortTextRect.X - displayRect.Left;
- ShortTextRect.X = (displayRect.Left + displayRect.Bottom) - ShortTextRect.Bottom;
- ShortTextRect.Y = y + displayRect.Top;
- SwapRectangleSizes(ref ShortTextRect);
- }
-
- // Reposition the long text relative the display rectangle
- if (DrawLongText)
- {
- int y = LongTextRect.X - displayRect.Left;
- LongTextRect.X = (displayRect.Left + displayRect.Bottom) - LongTextRect.Bottom;
- LongTextRect.Y = y + displayRect.Top;
- SwapRectangleSizes(ref LongTextRect);
- }
- break;
- }
- }
-
- private static void SwapRectangleSizes(ref Rectangle rect)
- {
- int temp = rect.Width;
- rect.Width = rect.Height;
- rect.Height = temp;
- }
- }
- #endregion
- }
-}
\ No newline at end of file
diff --git a/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/Core/KryptonOffice2007Renderer.cs b/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/Core/KryptonOffice2007Renderer.cs
deleted file mode 100644
index 8490152a..00000000
--- a/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/Core/KryptonOffice2007Renderer.cs
+++ /dev/null
@@ -1,1566 +0,0 @@
-using ComponentFactory.Krypton.Toolkit;
-using System;
-using System.Collections.Generic;
-using System.Drawing;
-using System.Drawing.Drawing2D;
-using System.Drawing.Imaging;
-using System.Drawing.Text;
-using System.Windows.Forms;
-
-namespace ExtendedControls.Base.Renderers.Core
-{
- internal class KryptonOffice2007Renderer : KryptonProfessionalRenderer
- {
- #region GradientItemColors
- private class GradientItemColors
- {
- #region Public Fields
- public Color InsideTop1;
- public Color InsideTop2;
- public Color InsideBottom1;
- public Color InsideBottom2;
- public Color FillTop1;
- public Color FillTop2;
- public Color FillBottom1;
- public Color FillBottom2;
- public Color Border1;
- public Color Border2;
- #endregion
-
- #region Identity
- public GradientItemColors()
- {
- }
-
- public GradientItemColors(Color insideTop1, Color insideTop2,
- Color insideBottom1, Color insideBottom2,
- Color fillTop1, Color fillTop2,
- Color fillBottom1, Color fillBottom2,
- Color border1, Color border2)
- {
- InsideTop1 = insideTop1;
- InsideTop2 = insideTop2;
- InsideBottom1 = insideBottom1;
- InsideBottom2 = insideBottom2;
- FillTop1 = fillTop1;
- FillTop2 = fillTop2;
- FillBottom1 = fillBottom1;
- FillBottom2 = fillBottom2;
- Border1 = border1;
- Border2 = border2;
- }
- #endregion
- }
-
- private class GradientItemColorsItem : GradientItemColors
- {
- ///
- /// Initialize a new instance of the GradientItemColorsItem class.
- ///
- /// Base border color.
- /// Beginning background color.
- /// Ending background color.
- public GradientItemColorsItem(Color border,
- Color begin,
- Color end)
- {
- // Calculate all colors from the provided parameters
- Border1 = CommonHelper.WhitenColor(border, 1.17f, 1.11f, 0.99f);
- Border2 = CommonHelper.WhitenColor(border, 1.32f, 1.35f, 1.26f);
- FillTop1 = CommonHelper.WhitenColor(begin, 0.71f, 0.93f, 0.72f);
- FillTop2 = begin;
- FillBottom1 = end;
- FillBottom2 = CommonHelper.WhitenColor(end, 0.71f, 0.93f, 0.71f);
- begin = CommonHelper.WhitenColor(begin, 0.94f, 0.94f, 0.73f);
- end = CommonHelper.WhitenColor(end, 0.88f, 0.88f, 0.51f);
- InsideTop1 = CommonHelper.WhitenColor(begin, 0.71f, 0.93f, 0.90f);
- InsideTop2 = begin;
- InsideBottom1 = end;
- InsideBottom2 = CommonHelper.WhitenColor(end, 0.71f, 0.97f, 1.11f);
- }
- }
-
- private class GradientItemColorsTracking : GradientItemColors
- {
- ///
- /// Initialize a new instance of the GradientItemColorsTracking class.
- ///
- /// Base border color.
- /// Beginning background color.
- /// Ending background color.
- public GradientItemColorsTracking(Color border,
- Color begin,
- Color end)
- {
- // Calculate all colors from the provided parameters
- Border1 = CommonHelper.WhitenColor(border, 0.85f, 0.85f, 0.85f);
- Border2 = border;
- FillTop1 = CommonHelper.WhitenColor(begin, 0.71f, 0.93f, 0.72f);
- FillTop2 = begin;
- FillBottom1 = end;
- FillBottom2 = CommonHelper.WhitenColor(end, 0.71f, 0.93f, 0.71f);
- begin = CommonHelper.WhitenColor(begin, 0.94f, 0.94f, 0.73f);
- end = CommonHelper.WhitenColor(end, 0.88f, 0.88f, 0.51f);
- InsideTop1 = CommonHelper.WhitenColor(begin, 0.71f, 0.93f, 0.90f);
- InsideTop2 = begin;
- InsideBottom1 = end;
- InsideBottom2 = CommonHelper.WhitenColor(end, 0.71f, 0.97f, 1.11f);
- }
- }
-
- private class GradientItemColorsPressed : GradientItemColors
- {
- ///
- /// Initialize a new instance of the GradientItemColorsPressed class.
- ///
- /// Base border color.
- /// Beginning background color.
- /// Ending background color.
- public GradientItemColorsPressed(Color border,
- Color begin,
- Color end)
- {
- // Calculate all colors from the provided parameters
- Border1 = CommonHelper.WhitenColor(border, 0.85f, 0.85f, 0.85f);
- Border2 = border;
- FillTop1 = CommonHelper.WhitenColor(begin, 0.99f, 0.89f, 0.89f);
- FillTop2 = begin;
- FillBottom1 = end;
- FillBottom2 = CommonHelper.WhitenColor(end, 0.98f, 0.68f, 0.45f);
- begin = CommonHelper.WhitenColor(begin, 1.02f, 1.00f, 2.48f);
- end = CommonHelper.WhitenColor(end, 1.02f, 0.91f, 2.54f);
- InsideTop1 = CommonHelper.WhitenColor(begin, 1.06f, 0.97f, 0.40f);
- InsideTop2 = begin;
- InsideBottom1 = end;
- InsideBottom2 = CommonHelper.WhitenColor(end, 0.97f, 0.90f, 1.40f);
- }
- }
-
- private class GradientItemColorsChecked : GradientItemColors
- {
- ///
- /// Initialize a new instance of the GradientItemColorsChecked class.
- ///
- /// Base border color.
- /// Beginning background color.
- /// Ending background color.
- public GradientItemColorsChecked(Color border,
- Color begin,
- Color end)
- {
- // Calculate all colors from the provided parameters
- Border1 = CommonHelper.WhitenColor(border, 0.85f, 0.85f, 0.85f);
- Border2 = border;
- FillTop1 = CommonHelper.WhitenColor(begin, 0.99f, 0.84f, 0.59f);
- FillTop2 = begin;
- FillBottom1 = end;
- FillBottom2 = CommonHelper.WhitenColor(end, 0.99f, 0.67f, 0.31f);
- begin = CommonHelper.WhitenColor(begin, 1.01f, 0.92f, 1.07f);
- end = CommonHelper.WhitenColor(end, 1.01f, 0.84f, 0.66f);
- InsideTop1 = CommonHelper.WhitenColor(begin, 1.00f, 1.01f, 0.90f);
- InsideTop2 = begin;
- InsideBottom1 = end;
- InsideBottom2 = CommonHelper.WhitenColor(end, 0.97f, 0.91f, 1.65f);
- }
- }
-
- private class GradientItemColorsCheckedTracking : GradientItemColors
- {
- ///
- /// Initialize a new instance of the GradientItemColorsCheckedTracking class.
- ///
- /// Base border color.
- /// Beginning background color.
- /// Ending background color.
- public GradientItemColorsCheckedTracking(Color border,
- Color begin,
- Color end)
- {
- // Calculate all colors from the provided parameters
- Border1 = CommonHelper.WhitenColor(border, 0.85f, 0.85f, 0.85f);
- Border2 = border;
- FillTop1 = CommonHelper.WhitenColor(begin, 0.99f, 0.88f, 0.89f);
- FillTop2 = begin;
- FillBottom1 = end;
- FillBottom2 = CommonHelper.WhitenColor(end, 0.99f, 0.67f, 0.31f);
- begin = CommonHelper.WhitenColor(begin, 1.01f, 0.80f, 0.94f);
- end = CommonHelper.WhitenColor(end, 1.01f, 0.80f, 0.59f);
- InsideTop1 = CommonHelper.WhitenColor(begin, 1.00f, 1.01f, 0.91f);
- InsideTop2 = begin;
- InsideBottom1 = end;
- InsideBottom2 = CommonHelper.WhitenColor(end, 0.97f, 0.91f, 1.54f);
- }
- }
- #endregion
-
- #region Static Fields
-
- private const int GRIP_OFFSET = 1;
- private const int GRIP_SQUARE = 2;
- private const int GRIP_SIZE = 3;
- private const int GRIP_MOVE = 4;
- private const int GRIP_LINES = 3;
- private const int MARGIN_INSET = 2;
- private const int CHECK_INSET = 1;
- private const int SEPARATOR_INSET = 31;
- private const float CONTEXT_CHECK_TICK_THICKNESS = 1.6f;
- private const float CUT_CONTEXT_MENU = 0f;
- private const float CUT_MENU_ITEM_BACK = 1.2f;
- private const float CUT_TOOL_ITEM_MENU = 1.0f;
- private static readonly Blend _statusStripBlend;
- private static readonly Color _disabled = Color.FromArgb(167, 167, 167);
- private static readonly GradientItemColors _disabledItem = new GradientItemColors(Color.FromArgb(250, 250, 250), Color.FromArgb(243, 243, 243),
- Color.FromArgb(236, 236, 236), Color.FromArgb(230, 230, 230),
- Color.FromArgb(243, 243, 243), Color.FromArgb(224, 224, 224),
- Color.FromArgb(200, 200, 200), Color.FromArgb(210, 210, 210),
- Color.FromArgb(212, 212, 212), Color.FromArgb(195, 195, 195));
- #endregion
-
- #region Instance Fields
- private GradientItemColorsItem _gradientItem;
- private GradientItemColorsTracking _gradientTracking;
- private GradientItemColorsPressed _gradientPressed;
- private GradientItemColorsChecked _gradientChecked;
- private GradientItemColorsCheckedTracking _gradientCheckedTracking;
- #endregion
-
- #region Identity
- static KryptonOffice2007Renderer()
- {
- // One time creation of the blend for the status strip gradient brush
- _statusStripBlend = new Blend
- {
- Positions = new float[] { 0.0f, 0.25f, 0.25f, 0.57f, 0.86f, 1.0f },
- Factors = new float[] { 0.1f, 0.6f, 1.0f, 0.4f, 0.0f, 0.95f }
- };
- }
-
- ///
- /// Initialise a new instance of the KryptonOffice2007Renderer class.
- ///
- /// Source for text colors.
- public KryptonOffice2007Renderer(KryptonColorTable kct)
- : base(kct)
- {
- }
- #endregion
-
- #region OnRenderArrow
- ///
- /// Raises the RenderArrow event.
- ///
- /// An ToolStripArrowRenderEventArgs containing the event data.
- protected override void OnRenderArrow(ToolStripArrowRenderEventArgs e)
- {
- // Cannot paint a zero sized area
- if ((e.ArrowRectangle.Width > 0) &&
- (e.ArrowRectangle.Height > 0))
- {
- // Create a path that is used to fill the arrow
- using (GraphicsPath arrowPath = CreateArrowPath(e.Item,
- e.ArrowRectangle,
- e.Direction))
- {
- // Get the rectangle that encloses the arrow and expand slightly
- // so that the gradient is always within the expanding bounds
- RectangleF boundsF = arrowPath.GetBounds();
- boundsF.Inflate(1f, 1f);
-
- Color color1 = (e.Item.Enabled ? KCT.ToolStripText : _disabled);
- Color color2 = (e.Item.Enabled ? CommonHelper.WhitenColor(KCT.ToolStripText, 0.7f, 0.7f, 0.7f) : _disabled);
-
- float angle = 0;
-
- // Use gradient angle to match the arrow direction
- switch (e.Direction)
- {
- case ArrowDirection.Right:
- angle = 0;
- break;
- case ArrowDirection.Left:
- angle = 180f;
- break;
- case ArrowDirection.Down:
- angle = 90f;
- break;
- case ArrowDirection.Up:
- angle = 270f;
- break;
- }
-
- // Draw the actual arrow using a gradient
- using (LinearGradientBrush arrowBrush = new LinearGradientBrush(boundsF, color1, color2, angle))
- {
- e.Graphics.FillPath(arrowBrush, arrowPath);
- }
- }
- }
- }
- #endregion
-
- #region OnRenderButtonBackground
- ///
- /// Raises the RenderButtonBackground event.
- ///
- /// An ToolStripItemRenderEventArgs containing the event data.
- protected override void OnRenderButtonBackground(ToolStripItemRenderEventArgs e)
- {
- // Cast to correct type
- ToolStripButton button = (ToolStripButton)e.Item;
-
- if (button.Selected || button.Pressed || button.Checked)
- {
- RenderToolButtonBackground(e.Graphics, button, e.ToolStrip);
- }
- }
- #endregion
-
- #region OnRenderDropDownButtonBackground
- ///
- /// Raises the RenderDropDownButtonBackground event.
- ///
- /// An ToolStripItemRenderEventArgs containing the event data.
- protected override void OnRenderDropDownButtonBackground(ToolStripItemRenderEventArgs e)
- {
- if (e.Item.Selected || e.Item.Pressed)
- {
- RenderToolDropButtonBackground(e.Graphics, e.Item, e.ToolStrip);
- }
- }
- #endregion
-
- #region OnRenderItemCheck
- ///
- /// Raises the RenderItemCheck event.
- ///
- /// An ToolStripItemImageRenderEventArgs containing the event data.
- protected override void OnRenderItemCheck(ToolStripItemImageRenderEventArgs e)
- {
- // Staring size of the checkbox is the image rectangle
- Rectangle checkBox = e.ImageRectangle;
-
- // Make the border of the check box 1 pixel bigger on all sides, as a minimum
- checkBox.Inflate(1, 1);
-
- // Can we extend upwards?
- if (checkBox.Top > CHECK_INSET)
- {
- int diff = checkBox.Top - CHECK_INSET;
- checkBox.Y -= diff;
- checkBox.Height += diff;
- }
-
- // Can we extend downwards?
- if (checkBox.Height <= (e.Item.Bounds.Height - (CHECK_INSET * 2)))
- {
- int diff = e.Item.Bounds.Height - (CHECK_INSET * 2) - checkBox.Height;
- checkBox.Height += diff;
- }
-
- // Drawing with anti aliasing to create smoother appearance
- using (AntiAlias aa = new AntiAlias(e.Graphics))
- {
- // Create border path for the check box
- using (GraphicsPath borderPath = CreateBorderPath(checkBox, CUT_MENU_ITEM_BACK))
- {
- // Fill the background in a solid color
- using (SolidBrush fillBrush = new SolidBrush(KCT.CheckBackground))
- {
- e.Graphics.FillPath(fillBrush, borderPath);
- }
-
- // Draw the border around the check box
- using (Pen borderPen = new Pen(CommonHelper.WhitenColor(KCT.CheckBackground, 1.05f, 1.52f, 2.75f)))
- {
- e.Graphics.DrawPath(borderPen, borderPath);
- }
-
- // If there is not an image, then we can draw the tick, square etc...
- if (e.Item.Image == null)
- {
- CheckState checkState = CheckState.Unchecked;
-
- // Extract the check state from the item
- if (e.Item is ToolStripMenuItem item)
- {
- checkState = item.CheckState;
- }
-
- // Decide what graphic to draw
- switch (checkState)
- {
- case CheckState.Checked:
- // Create a path for the tick
- using (GraphicsPath tickPath = CreateTickPath(checkBox))
- {
- // Draw the tick with a thickish brush
- using (Pen tickPen = new Pen(CommonHelper.WhitenColor(KCT.CheckBackground, 3.86f, 3.02f, 1.07f), CONTEXT_CHECK_TICK_THICKNESS))
- {
- e.Graphics.DrawPath(tickPen, tickPath);
- }
- }
- break;
- case CheckState.Indeterminate:
- // Create a path for the indeterminate diamond
- using (GraphicsPath tickPath = CreateIndeterminatePath(checkBox))
- {
- // Draw the tick with a thickish brush
- using (SolidBrush tickBrush = new SolidBrush(CommonHelper.WhitenColor(KCT.CheckBackground, 3.86f, 3.02f, 1.07f)))
- {
- e.Graphics.FillPath(tickBrush, tickPath);
- }
- }
- break;
- }
- }
- }
- }
- }
- #endregion
-
- #region OnRenderItemText
- ///
- /// Raises the RenderItemText event.
- ///
- /// A ToolStripItemTextRenderEventArgs that contains the event data.
- protected override void OnRenderItemText(ToolStripItemTextRenderEventArgs e)
- {
- if ((e.ToolStrip is ToolStrip) ||
- (e.ToolStrip is ContextMenuStrip) ||
- (e.ToolStrip is ToolStripDropDownMenu))
- {
- e.TextColor = KCT.ToolStripText;
- if (!e.Item.Enabled)
- {
- e.TextColor = _disabled;
- }
- else if (!e.Item.Pressed && !e.Item.Selected)
- {
- switch (e.ToolStrip)
- {
- case MenuStrip _:
- e.TextColor = KCT.MenuStripText;
- break;
- case StatusStrip _:
- e.TextColor = KCT.StatusStripText;
- break;
- case ContextMenuStrip _:
- e.TextColor = KCT.MenuItemText;
- break;
- case ToolStripDropDownMenu _:
- e.TextColor = KCT.MenuItemText;
- break;
- }
- }
-
- // Status strips under XP cannot use clear type because it ends up being cut off at edges
- if ((e.ToolStrip is StatusStrip) && (Environment.OSVersion.Version.Major < 6))
- {
- base.OnRenderItemText(e);
- }
- else
- {
- using (GraphicsTextHint clearTypeGridFit = new GraphicsTextHint(e.Graphics, TextRenderingHint.ClearTypeGridFit))
- {
- base.OnRenderItemText(e);
- }
- }
- }
- else
- {
- base.OnRenderItemText(e);
- }
- }
- #endregion
-
- #region OnRenderItemImage
- ///
- /// Raises the RenderItemImage event.
- ///
- /// An ToolStripItemImageRenderEventArgs containing the event data.
- protected override void OnRenderItemImage(ToolStripItemImageRenderEventArgs e)
- {
- // We only override the image drawing for context menus
- if ((e.ToolStrip is ContextMenuStrip) ||
- (e.ToolStrip is ToolStripDropDownMenu))
- {
- if (e.Image != null)
- {
- if (e.Item.Enabled)
- {
- e.Graphics.DrawImage(e.Image, e.ImageRectangle);
- }
- else
- {
- using (ImageAttributes attribs = new ImageAttributes())
- {
- attribs.SetColorMatrix(CommonHelper.MatrixDisabled);
-
- // Draw using the disabled matrix to make it look disabled
- e.Graphics.DrawImage(e.Image, e.ImageRectangle,
- 0, 0, e.Image.Width, e.Image.Height,
- GraphicsUnit.Pixel, attribs);
- }
- }
- }
- }
- else
- {
- base.OnRenderItemImage(e);
- }
- }
- #endregion
-
- #region OnRenderMenuItemBackground
- ///
- /// Raises the RenderMenuItemBackground event.
- ///
- /// An ToolStripItemRenderEventArgs containing the event data.
- protected override void OnRenderMenuItemBackground(ToolStripItemRenderEventArgs e)
- {
- if ((e.ToolStrip is MenuStrip) ||
- (e.ToolStrip is ContextMenuStrip) ||
- (e.ToolStrip is ToolStripDropDownMenu))
- {
- if ((e.Item.Pressed) && (e.ToolStrip is MenuStrip))
- {
- // Draw the menu/tool strip as a header for a context menu item
- DrawContextMenuHeader(e.Graphics, e.Item);
- }
- else
- {
- // We only draw a background if the item is selected and enabled
- if (e.Item.Selected)
- {
- if (e.Item.Enabled)
- {
- // Ensure we have cached the objects we need
- UpdateCache();
-
- // Do we draw as a menu strip or context menu item?
- if (e.ToolStrip is MenuStrip)
- {
- DrawGradientToolItem(e.Graphics, e.Item, _gradientTracking);
- }
- else
- {
- DrawGradientContextMenuItem(e.Graphics, e.Item, _gradientItem);
- }
- }
- else
- {
- // Get the mouse position in tool strip coordinates
- Point mousePos = e.ToolStrip.PointToClient(Control.MousePosition);
-
- // If the mouse is not in the item area, then draw disabled
- if (!e.Item.Bounds.Contains(mousePos))
- {
- // Do we draw as a menu strip or context menu item?
- if (e.ToolStrip is MenuStrip)
- {
- DrawGradientToolItem(e.Graphics, e.Item, _disabledItem);
- }
- else
- {
- DrawGradientContextMenuItem(e.Graphics, e.Item, _disabledItem);
- }
- }
- }
- }
- }
- }
- else
- {
- base.OnRenderMenuItemBackground(e);
- }
- }
- #endregion
-
- #region OnRenderSplitButtonBackground
- ///
- /// Raises the RenderSplitButtonBackground event.
- ///
- /// An ToolStripItemRenderEventArgs containing the event data.
- protected override void OnRenderSplitButtonBackground(ToolStripItemRenderEventArgs e)
- {
- if (e.Item.Selected || e.Item.Pressed)
- {
- // Cast to correct type
- ToolStripSplitButton splitButton = (ToolStripSplitButton)e.Item;
-
- // Draw the border and background
- RenderToolSplitButtonBackground(e.Graphics, splitButton, e.ToolStrip);
-
- // Get the rectangle that needs to show the arrow
- Rectangle arrowBounds = splitButton.DropDownButtonBounds;
-
- // Draw the arrow on top of the background
- OnRenderArrow(new ToolStripArrowRenderEventArgs(e.Graphics,
- splitButton,
- arrowBounds,
- SystemColors.ControlText,
- ArrowDirection.Down));
- }
- else
- {
- base.OnRenderSplitButtonBackground(e);
- }
- }
- #endregion
-
- #region OnRenderStatusStripSizingGrip
- ///
- /// Raises the RenderStatusStripSizingGrip event.
- ///
- /// An ToolStripRenderEventArgs containing the event data.
- protected override void OnRenderStatusStripSizingGrip(ToolStripRenderEventArgs e)
- {
- using (SolidBrush darkBrush = new SolidBrush(KCT.GripDark),
- lightBrush = new SolidBrush(KCT.GripLight))
- {
- // Do we need to invert the drawing edge?
- bool rtl = (e.ToolStrip.RightToLeft == RightToLeft.Yes);
-
- // Find vertical position of the lowest grip line
- int y = (e.AffectedBounds.Bottom - (GRIP_SIZE * 2)) + 1;
-
- // Draw three lines of grips
- for (int i = GRIP_LINES; i >= 1; i--)
- {
- // Find the rightmost grip position on the line
- int x = (rtl ? e.AffectedBounds.Left + 1 :
- (e.AffectedBounds.Right - (GRIP_SIZE * 2)) + 1);
-
- // Draw grips from right to left on line
- for (int j = 0; j < i; j++)
- {
- // Just the single grip glyph
- DrawGripGlyph(e.Graphics, x, y, darkBrush, lightBrush);
-
- // Move left to next grip position
- x -= (rtl ? -GRIP_MOVE : GRIP_MOVE);
- }
-
- // Move upwards to next grip line
- y -= GRIP_MOVE;
- }
- }
- }
- #endregion
-
- #region OnRenderToolStripContentPanelBackground
- ///
- /// Raises the RenderToolStripContentPanelBackground event.
- ///
- /// An ToolStripContentPanelRenderEventArgs containing the event data.
- protected override void OnRenderToolStripContentPanelBackground(ToolStripContentPanelRenderEventArgs e)
- {
- // Must call base class, otherwise the subsequent drawing does not appear!
- base.OnRenderToolStripContentPanelBackground(e);
-
- // Cannot paint a zero sized area
- if ((e.ToolStripContentPanel.Width > 0) &&
- (e.ToolStripContentPanel.Height > 0))
- {
- using (LinearGradientBrush backBrush = new LinearGradientBrush(e.ToolStripContentPanel.ClientRectangle,
- KCT.ToolStripContentPanelGradientEnd,
- KCT.ToolStripContentPanelGradientBegin,
- 90f))
- {
- e.Graphics.FillRectangle(backBrush, e.ToolStripContentPanel.ClientRectangle);
- }
- }
- }
- #endregion
-
- #region OnRenderSeparator
- ///
- /// Raises the RenderSeparator event.
- ///
- /// An ToolStripSeparatorRenderEventArgs containing the event data.
- protected override void OnRenderSeparator(ToolStripSeparatorRenderEventArgs e)
- {
- switch (e.ToolStrip)
- {
- case ContextMenuStrip _:
- case ToolStripDropDownMenu _:
- // Create the light and dark line pens
- using (Pen lightPen = new Pen(CommonHelper.WhitenColor(KCT.ToolStripDropDownBackground, 1.02f, 1.02f, 1.02f)),
- darkPen = new Pen(CommonHelper.WhitenColor(KCT.ToolStripDropDownBackground, 1.26f, 1.26f, 1.26f)))
- {
- DrawSeparator(e.Graphics, e.Vertical, e.Item.Bounds,
- lightPen, darkPen, SEPARATOR_INSET,
- (e.ToolStrip.RightToLeft == RightToLeft.Yes));
- }
- break;
- case StatusStrip _:
- // Create the light and dark line pens
- using (Pen lightPen = new Pen(KCT.SeparatorLight),
- darkPen = new Pen(KCT.SeparatorDark))
- {
- DrawSeparator(e.Graphics, e.Vertical, e.Item.Bounds,
- lightPen, darkPen, 0, false);
- }
- break;
- default:
- base.OnRenderSeparator(e);
- break;
- }
- }
- #endregion
-
- #region OnRenderToolStripBackground
- ///
- /// Raises the RenderToolStripBackground event.
- ///
- /// An ToolStripRenderEventArgs containing the event data.
- protected override void OnRenderToolStripBackground(ToolStripRenderEventArgs e)
- {
- switch (e.ToolStrip)
- {
- case ContextMenuStrip _:
- case ToolStripDropDownMenu _:
- // Make sure the font is current
- if (e.ToolStrip.Font != KCT.MenuStripFont)
- {
- e.ToolStrip.Font = KCT.MenuStripFont;
- }
-
- // Create border and clipping paths
- using (GraphicsPath borderPath = CreateBorderPath(e.AffectedBounds, CUT_CONTEXT_MENU),
- clipPath = CreateClipBorderPath(e.AffectedBounds, CUT_CONTEXT_MENU))
- {
- // Clip all drawing to within the border path
- using (Clipping clipping = new Clipping(e.Graphics, clipPath))
- {
- // Create the background brush
- using (SolidBrush backBrush = new SolidBrush(KCT.ToolStripDropDownBackground))
- {
- e.Graphics.FillPath(backBrush, borderPath);
- }
- }
- }
- break;
- case StatusStrip _:
- // Make sure the font is current
- if (e.ToolStrip.Font != KCT.StatusStripFont)
- {
- e.ToolStrip.Font = KCT.StatusStripFont;
- }
-
- // We do not paint the top two pixel lines, so are drawn by the status strip border render method
- RectangleF backRect = new RectangleF(0, 1.5f, e.ToolStrip.Width, e.ToolStrip.Height - 2);
-
- Form owner = e.ToolStrip.FindForm();
-
- // Check if the status strip is inside a KryptonForm and using the Office 2007 renderer, in
- // which case we want to extend the drawing down into the border area for an integrated look
- if (e.ToolStrip.Visible
- && (e.ToolStrip.Dock == DockStyle.Bottom)
- && (e.ToolStrip.RenderMode == ToolStripRenderMode.ManagerRenderMode)
- && (ToolStripManager.Renderer is KryptonOffice2007Renderer)
- && owner is KryptonForm kryptonForm
- && (e.ToolStrip.Bottom == owner.ClientSize.Height)
- )
- {
- // Get the window borders
-
- // Finally check that the actual form is using custom chrome
- if (kryptonForm.ApplyCustomChrome)
- {
- // Extend down into the bottom border
- backRect.Height += kryptonForm.RealWindowBorders.Bottom;
- }
- }
-
- // Cannot paint a zero sized area
- if ((backRect.Width > 0) && (backRect.Height > 0))
- {
- using (LinearGradientBrush backBrush = new LinearGradientBrush(backRect,
- KCT.StatusStripGradientBegin,
- KCT.StatusStripGradientEnd,
- 90f))
- {
- backBrush.Blend = _statusStripBlend;
- e.Graphics.FillRectangle(backBrush, backRect);
- }
- }
- break;
- default:
- if (e.ToolStrip is MenuStrip)
- {
- // Make sure the font is current
- if (e.ToolStrip.Font != KCT.MenuStripFont)
- {
- e.ToolStrip.Font = KCT.MenuStripFont;
- }
- }
- else
- {
- // Make sure the font is current
- if (e.ToolStrip.Font != KCT.ToolStripFont)
- {
- e.ToolStrip.Font = KCT.ToolStripFont;
- }
- }
-
- base.OnRenderToolStripBackground(e);
- break;
- }
- }
- #endregion
-
- #region OnRenderImageMargin
- ///
- /// Raises the RenderImageMargin event.
- ///
- /// An ToolStripRenderEventArgs containing the event data.
- protected override void OnRenderImageMargin(ToolStripRenderEventArgs e)
- {
- if ((e.ToolStrip is ContextMenuStrip) ||
- (e.ToolStrip is ToolStripDropDownMenu))
- {
- // Start with the total margin area
- Rectangle marginRect = e.AffectedBounds;
-
- // Do we need to draw with separator on the opposite edge?
- bool rtl = (e.ToolStrip.RightToLeft == RightToLeft.Yes);
-
- marginRect.Y += MARGIN_INSET;
- marginRect.Height -= MARGIN_INSET * 2;
-
- // Reduce so it is inside the border
- if (!rtl)
- {
- marginRect.X += MARGIN_INSET;
- }
- else
- {
- marginRect.X += MARGIN_INSET / 2;
- }
-
- // Draw the entire margine area in a solid color
- using (SolidBrush backBrush = new SolidBrush(KCT.ImageMarginGradientBegin))
- {
- e.Graphics.FillRectangle(backBrush, marginRect);
- }
-
- // Create the light and dark line pens
- using (Pen lightPen = new Pen(CommonHelper.WhitenColor(KCT.ToolStripDropDownBackground, 1.02f, 1.02f, 1.02f)),
- darkPen = new Pen(CommonHelper.WhitenColor(KCT.ToolStripDropDownBackground, 1.26f, 1.26f, 1.26f)))
- {
- if (!rtl)
- {
- // Draw the light and dark lines on the right hand side
- e.Graphics.DrawLine(lightPen, marginRect.Right, marginRect.Top, marginRect.Right, marginRect.Bottom);
- e.Graphics.DrawLine(darkPen, marginRect.Right - 1, marginRect.Top, marginRect.Right - 1, marginRect.Bottom);
- }
- else
- {
- // Draw the light and dark lines on the left hand side
- e.Graphics.DrawLine(lightPen, marginRect.Left - 1, marginRect.Top, marginRect.Left - 1, marginRect.Bottom);
- e.Graphics.DrawLine(darkPen, marginRect.Left, marginRect.Top, marginRect.Left, marginRect.Bottom);
- }
- }
- }
- else
- {
- base.OnRenderImageMargin(e);
- }
- }
- #endregion
-
- #region OnRenderToolStripBorder
- ///
- /// Raises the RenderToolStripBorder event.
- ///
- /// An ToolStripRenderEventArgs containing the event data.
- protected override void OnRenderToolStripBorder(ToolStripRenderEventArgs e)
- {
- switch (e.ToolStrip)
- {
- case ContextMenuStrip _:
- case ToolStripDropDownMenu _:
- // If there is a connected area to be drawn
- if (!e.ConnectedArea.IsEmpty)
- {
- using (SolidBrush excludeBrush = new SolidBrush(KCT.ToolStripDropDownBackground))
- {
- e.Graphics.FillRectangle(excludeBrush, e.ConnectedArea);
- }
- }
-
- // Create border and clipping paths
- using (GraphicsPath borderPath = CreateBorderPath(e.AffectedBounds, e.ConnectedArea, CUT_CONTEXT_MENU),
- insidePath = CreateInsideBorderPath(e.AffectedBounds, e.ConnectedArea, CUT_CONTEXT_MENU),
- clipPath = CreateClipBorderPath(e.AffectedBounds, e.ConnectedArea, CUT_CONTEXT_MENU))
- {
- // Create the different pen colors we need
- using (Pen borderPen = new Pen(KCT.MenuBorder),
- insidePen = new Pen(CommonHelper.WhitenColor(KCT.ToolStripDropDownBackground, 1.02f, 1.02f, 1.02f)))
- {
- // Clip all drawing to within the border path
- using (Clipping clipping = new Clipping(e.Graphics, clipPath))
- {
- // Drawing with anti aliasing to create smoother appearance
- using (AntiAlias aa = new AntiAlias(e.Graphics))
- {
- // Draw the inside area first
- e.Graphics.DrawPath(insidePen, insidePath);
-
- // Draw the border area second, so any overlapping gives it priority
- e.Graphics.DrawPath(borderPen, borderPath);
- }
-
- // Draw the pixel at the bottom right of the context menu
- e.Graphics.DrawLine(borderPen, e.AffectedBounds.Right, e.AffectedBounds.Bottom,
- e.AffectedBounds.Right - 1, e.AffectedBounds.Bottom - 1);
- }
- }
- }
- break;
- case StatusStrip _:
- // Draw two lines at top of the status strip
- using (Pen darkBorder = new Pen(CommonHelper.WhitenColor(KCT.StatusStripGradientEnd, 1.6f, 1.6f, 1.6f)),
- lightBorder = new Pen(ControlPaint.LightLight(KCT.StatusStripGradientBegin)))
- {
- e.Graphics.DrawLine(darkBorder, 0, 0, e.ToolStrip.Width, 0);
- e.Graphics.DrawLine(lightBorder, 0, 1, e.ToolStrip.Width, 1);
- }
- break;
- default:
- base.OnRenderToolStripBorder(e);
- break;
- }
- }
- #endregion
-
- #region Implementation
- private void UpdateCache()
- {
- // Only need to create the cache objects first time around
- if (_gradientItem == null)
- {
- _gradientItem = new GradientItemColorsItem(KCT.CheckBackground,
- KCT.ButtonSelectedGradientBegin,
- KCT.ButtonSelectedGradientEnd);
-
- _gradientTracking = new GradientItemColorsTracking(KCT.ButtonSelectedBorder,
- KCT.ButtonSelectedGradientBegin,
- KCT.ButtonSelectedGradientEnd);
-
- _gradientPressed = new GradientItemColorsPressed(KCT.ButtonPressedBorder,
- KCT.ButtonPressedGradientBegin,
- KCT.ButtonPressedGradientEnd);
-
- _gradientChecked = new GradientItemColorsChecked(KCT.ButtonPressedBorder,
- KCT.ButtonCheckedGradientBegin,
- KCT.ButtonCheckedGradientEnd);
-
- _gradientCheckedTracking = new GradientItemColorsCheckedTracking(KCT.ButtonSelectedBorder,
- KCT.ButtonPressedGradientBegin,
- KCT.ButtonCheckedGradientEnd);
- }
- }
-
- private void RenderToolButtonBackground(Graphics g,
- ToolStripButton button,
- ToolStrip toolstrip)
- {
- // We only draw a background if the item is selected or being pressed
- if (button.Enabled)
- {
- // Ensure we have cached the objects we need
- UpdateCache();
-
- if (button.Checked)
- {
- if (button.Pressed)
- {
- DrawGradientToolItem(g, button, _gradientPressed);
- }
- else if (button.Selected)
- {
- DrawGradientToolItem(g, button, _gradientCheckedTracking);
- }
- else
- {
- DrawGradientToolItem(g, button, _gradientChecked);
- }
- }
- else
- {
- if (button.Pressed)
- {
- DrawGradientToolItem(g, button, _gradientPressed);
- }
- else if (button.Selected)
- {
- DrawGradientToolItem(g, button, _gradientTracking);
- }
- }
- }
- else
- {
- if (button.Selected)
- {
- // Get the mouse position in tool strip coordinates
- Point mousePos = toolstrip.PointToClient(Control.MousePosition);
-
- // If the mouse is not in the item area, then draw disabled
- if (!button.Bounds.Contains(mousePos))
- {
- DrawGradientToolItem(g, button, _disabledItem);
- }
- }
- }
- }
-
- private void RenderToolDropButtonBackground(Graphics g,
- ToolStripItem item,
- ToolStrip toolstrip)
- {
- // We only draw a background if the item is selected or being pressed
- if (item.Selected || item.Pressed)
- {
- if (item.Enabled)
- {
- if (item.Pressed)
- {
- DrawContextMenuHeader(g, item);
- }
- else
- {
- // Ensure we have cached the objects we need
- UpdateCache();
-
- DrawGradientToolItem(g, item, _gradientTracking);
- }
- }
- else
- {
- // Get the mouse position in tool strip coordinates
- Point mousePos = toolstrip.PointToClient(Control.MousePosition);
-
- // If the mouse is not in the item area, then draw disabled
- if (!item.Bounds.Contains(mousePos))
- {
- DrawGradientToolItem(g, item, _disabledItem);
- }
- }
- }
- }
-
- private void DrawGradientToolSplitItem(Graphics g,
- ToolStripSplitButton splitButton,
- GradientItemColors colorsButton,
- GradientItemColors colorsDrop,
- GradientItemColors colorsSplit)
- {
- // Create entire area and just the drop button area rectangles
- Rectangle backRect = new Rectangle(Point.Empty, splitButton.Bounds.Size);
- Rectangle backRectDrop = splitButton.DropDownButtonBounds;
-
- // Cannot paint zero sized areas
- if ((backRect.Width > 0) && (backRectDrop.Width > 0) &&
- (backRect.Height > 0) && (backRectDrop.Height > 0))
- {
- // Area that is the normal button starts as everything
- Rectangle backRectButton = backRect;
-
- // The X offset to draw the split line
- int splitOffset;
-
- // Is the drop button on the right hand side of entire area?
- if (backRectDrop.X > 0)
- {
- backRectButton.Width = backRectDrop.Left;
- backRectDrop.X -= 1;
- backRectDrop.Width++;
- splitOffset = backRectDrop.X;
- }
- else
- {
- backRectButton.Width -= backRectDrop.Width - 2;
- backRectButton.X = backRectDrop.Right - 1;
- backRectDrop.Width++;
- splitOffset = backRectDrop.Right - 1;
- }
-
- // Create border path around the item
- using (GraphicsPath borderPath = CreateBorderPath(backRect, CUT_MENU_ITEM_BACK))
- {
- // Draw the normal button area background
- DrawGradientBack(g, backRectButton, colorsButton);
-
- // Draw the drop button area background
- DrawGradientBack(g, backRectDrop, colorsDrop);
-
- // Draw the split line between the areas
- using (LinearGradientBrush splitBrush = new LinearGradientBrush(new Rectangle(backRect.X + splitOffset, backRect.Top, 1, backRect.Height + 1),
- colorsSplit.Border1, colorsSplit.Border2, 90f))
- {
- // Sigma curve, so go from color1 to color2 and back to color1 again
- splitBrush.SetSigmaBellShape(0.5f);
-
- // Convert the brush to a pen for DrawPath call
- using (Pen splitPen = new Pen(splitBrush))
- {
- g.DrawLine(splitPen, backRect.X + splitOffset, backRect.Top + 1, backRect.X + splitOffset, backRect.Bottom - 1);
- }
- }
-
- // Draw the border of the entire item
- DrawGradientBorder(g, backRect, colorsButton);
- }
- }
- }
-
- private void DrawContextMenuHeader(Graphics g, ToolStripItem item)
- {
- // Get the rectangle that is the items area
- Rectangle itemRect = new Rectangle(Point.Empty, item.Bounds.Size);
-
- // Create border and clipping paths
- using (GraphicsPath borderPath = CreateBorderPath(itemRect, CUT_TOOL_ITEM_MENU),
- insidePath = CreateInsideBorderPath(itemRect, CUT_TOOL_ITEM_MENU),
- clipPath = CreateClipBorderPath(itemRect, CUT_TOOL_ITEM_MENU))
- {
- // Clip all drawing to within the border path
- using (Clipping clipping = new Clipping(g, clipPath))
- {
- // Draw the entire background area first
- using (SolidBrush backBrush = new SolidBrush(CommonHelper.WhitenColor(KCT.ToolStripDropDownBackground, 1.02f, 1.02f, 1.02f)))
- {
- g.FillPath(backBrush, borderPath);
- }
-
- // Draw the border
- using (Pen borderPen = new Pen(KCT.MenuBorder))
- {
- g.DrawPath(borderPen, borderPath);
- }
- }
- }
- }
-
- private void DrawGradientToolItem(Graphics g,
- ToolStripItem item,
- GradientItemColors colors)
- {
- // Perform drawing into the entire background of the item
- DrawGradientItem(g, new Rectangle(Point.Empty, item.Bounds.Size), colors);
- }
-
- private void RenderToolSplitButtonBackground(Graphics g,
- ToolStripSplitButton splitButton,
- ToolStrip toolstrip)
- {
- // We only draw a background if the item is selected or being pressed
- if (splitButton.Selected || splitButton.Pressed)
- {
- if (splitButton.Enabled)
- {
- // Ensure we have cached the objects we need
- UpdateCache();
-
- if (!splitButton.Pressed && splitButton.ButtonPressed)
- {
- DrawGradientToolSplitItem(g, splitButton, _gradientPressed, _gradientTracking, _gradientItem);
- }
- else if (splitButton.Pressed && !splitButton.ButtonPressed)
- {
- DrawContextMenuHeader(g, splitButton);
- }
- else
- {
- DrawGradientToolSplitItem(g, splitButton, _gradientTracking, _gradientTracking, _gradientItem);
- }
- }
- else
- {
- // Get the mouse position in tool strip coordinates
- Point mousePos = toolstrip.PointToClient(Control.MousePosition);
-
- // If the mouse is not in the item area, then draw disabled
- if (!splitButton.Bounds.Contains(mousePos))
- {
- DrawGradientToolItem(g, splitButton, _disabledItem);
- }
- }
- }
-
- }
-
- private void DrawGradientContextMenuItem(Graphics g,
- ToolStripItem item,
- GradientItemColors colors)
- {
- // Do we need to draw with separator on the opposite edge?
- Rectangle backRect = new Rectangle(2, 0, item.Bounds.Width - 3, item.Bounds.Height);
-
- // Perform actual drawing into the background
- DrawGradientItem(g, backRect, colors);
- }
-
- private static void DrawGradientItem(Graphics g,
- Rectangle backRect,
- GradientItemColors colors)
- {
- // Cannot paint a zero sized area
- if ((backRect.Width > 0) && (backRect.Height > 0))
- {
- // Draw the background of the entire item
- DrawGradientBack(g, backRect, colors);
-
- // Draw the border of the entire item
- DrawGradientBorder(g, backRect, colors);
- }
- }
-
- private static void DrawGradientBack(Graphics g,
- Rectangle backRect,
- GradientItemColors colors)
- {
- // Reduce rect draw drawing inside the border
- backRect.Inflate(-1, -1);
-
- int y2 = backRect.Height / 2;
- Rectangle backRect1 = new Rectangle(backRect.X, backRect.Y, backRect.Width, y2);
- Rectangle backRect2 = new Rectangle(backRect.X, backRect.Y + y2, backRect.Width, backRect.Height - y2);
- Rectangle backRect1I = backRect1;
- Rectangle backRect2I = backRect2;
- backRect1I.Inflate(1, 1);
- backRect2I.Inflate(1, 1);
-
- using (LinearGradientBrush insideBrush1 = new LinearGradientBrush(backRect1I, colors.InsideTop1, colors.InsideTop2, 90f),
- insideBrush2 = new LinearGradientBrush(backRect2I, colors.InsideBottom1, colors.InsideBottom2, 90f))
- {
- g.FillRectangle(insideBrush1, backRect1);
- g.FillRectangle(insideBrush2, backRect2);
- }
-
- y2 = backRect.Height / 2;
- backRect1 = new Rectangle(backRect.X, backRect.Y, backRect.Width, y2);
- backRect2 = new Rectangle(backRect.X, backRect.Y + y2, backRect.Width, backRect.Height - y2);
- backRect1I = backRect1;
- backRect2I = backRect2;
- backRect1I.Inflate(1, 1);
- backRect2I.Inflate(1, 1);
-
- using (LinearGradientBrush fillBrush1 = new LinearGradientBrush(backRect1I, colors.FillTop1, colors.FillTop2, 90f),
- fillBrush2 = new LinearGradientBrush(backRect2I, colors.FillBottom1, colors.FillBottom2, 90f))
- {
- // Reduce rect one more time for the innermost drawing
- backRect.Inflate(-1, -1);
-
- y2 = backRect.Height / 2;
- backRect1 = new Rectangle(backRect.X, backRect.Y, backRect.Width, y2);
- backRect2 = new Rectangle(backRect.X, backRect.Y + y2, backRect.Width, backRect.Height - y2);
-
- g.FillRectangle(fillBrush1, backRect1);
- g.FillRectangle(fillBrush2, backRect2);
- }
- }
-
- private static void DrawGradientBorder(Graphics g,
- Rectangle backRect,
- GradientItemColors colors)
- {
- // Drawing with anti aliasing to create smoother appearance
- using (AntiAlias aa = new AntiAlias(g))
- {
- Rectangle backRectI = backRect;
- backRectI.Inflate(1, 1);
-
- // Finally draw the border around the menu item
- using (LinearGradientBrush borderBrush = new LinearGradientBrush(backRectI, colors.Border1, colors.Border2, 90f))
- {
- // Sigma curve, so go from color1 to color2 and back to color1 again
- borderBrush.SetSigmaBellShape(0.5f);
-
- // Convert the brush to a pen for DrawPath call
- using (Pen borderPen = new Pen(borderBrush))
- {
- // Create border path around the entire item
- using (GraphicsPath borderPath = CreateBorderPath(backRect, CUT_MENU_ITEM_BACK))
- {
- g.DrawPath(borderPen, borderPath);
- }
- }
- }
- }
- }
-
- private void DrawGripGlyph(Graphics g,
- int x,
- int y,
- Brush darkBrush,
- Brush lightBrush)
- {
- g.FillRectangle(lightBrush, x + GRIP_OFFSET, y + GRIP_OFFSET, GRIP_SQUARE, GRIP_SQUARE);
- g.FillRectangle(darkBrush, x, y, GRIP_SQUARE, GRIP_SQUARE);
- }
-
- private void DrawSeparator(Graphics g,
- bool vertical,
- Rectangle rect,
- Pen lightPen,
- Pen darkPen,
- int horizontalInset,
- bool rtl)
- {
- if (vertical)
- {
- int l = rect.Width / 2;
- int t = rect.Y;
- int b = rect.Bottom;
-
- // Draw vertical lines centered
- g.DrawLine(darkPen, l, t, l, b);
- g.DrawLine(lightPen, l + 1, t, l + 1, b);
- }
- else
- {
- int y = rect.Height / 2;
- int l = rect.X + (rtl ? 0 : horizontalInset);
- int r = rect.Right - (rtl ? horizontalInset : 0);
-
- // Draw horizontal lines centered
- g.DrawLine(darkPen, l, y, r, y);
- g.DrawLine(lightPen, l, y + 1, r, y + 1);
- }
- }
-
- private static GraphicsPath CreateBorderPath(Rectangle rect,
- Rectangle exclude,
- float cut)
- {
- // If nothing to exclude, then use quicker method
- if (exclude.IsEmpty)
- {
- return CreateBorderPath(rect, cut);
- }
-
- // Drawing lines requires we draw inside the area we want
- rect.Width--;
- rect.Height--;
-
- // Create an array of points to draw lines between
- List pts = new List();
-
- float l = rect.X;
- float t = rect.Y;
- float r = rect.Right;
- float b = rect.Bottom;
- float x0 = rect.X + cut;
- float x3 = rect.Right - cut;
- float y0 = rect.Y + cut;
- float y3 = rect.Bottom - cut;
- float cutBack = (cut == 0f ? 1 : cut);
-
- // Does the exclude intercept the top line
- if ((rect.Y >= exclude.Top) && (rect.Y <= exclude.Bottom))
- {
- float x1 = exclude.X - 1 - cut;
- float x2 = exclude.Right + cut;
-
- if (x0 <= x1)
- {
- pts.Add(new PointF(x0, t));
- pts.Add(new PointF(x1, t));
- pts.Add(new PointF(x1 + cut, t - cutBack));
- }
- else
- {
- x1 = exclude.X - 1;
- pts.Add(new PointF(x1, t));
- pts.Add(new PointF(x1, t - cutBack));
- }
-
- if (x3 > x2)
- {
- pts.Add(new PointF(x2 - cut, t - cutBack));
- pts.Add(new PointF(x2, t));
- pts.Add(new PointF(x3, t));
- }
- else
- {
- x2 = exclude.Right;
- pts.Add(new PointF(x2, t - cutBack));
- pts.Add(new PointF(x2, t));
- }
- }
- else
- {
- pts.Add(new PointF(x0, t));
- pts.Add(new PointF(x3, t));
- }
-
- pts.Add(new PointF(r, y0));
- pts.Add(new PointF(r, y3));
- pts.Add(new PointF(x3, b));
- pts.Add(new PointF(x0, b));
- pts.Add(new PointF(l, y3));
- pts.Add(new PointF(l, y0));
-
- // Create path using a simple set of lines that cut the corner
- GraphicsPath path = new GraphicsPath();
-
- // Add a line between each set of points
- for (int i = 1; i < pts.Count; i++)
- {
- path.AddLine(pts[i - 1], pts[i]);
- }
-
- // Add a line to join the last to the first
- path.AddLine(pts[pts.Count - 1], pts[0]);
-
- return path;
- }
-
- private static GraphicsPath CreateBorderPath(Rectangle rect, float cut)
- {
- // Drawing lines requires we draw inside the area we want
- rect.Width--;
- rect.Height--;
-
- // Create path using a simple set of lines that cut the corner
- GraphicsPath path = new GraphicsPath();
- path.AddLine(rect.Left + cut, rect.Top, rect.Right - cut, rect.Top);
- path.AddLine(rect.Right - cut, rect.Top, rect.Right, rect.Top + cut);
- path.AddLine(rect.Right, rect.Top + cut, rect.Right, rect.Bottom - cut);
- path.AddLine(rect.Right, rect.Bottom - cut, rect.Right - cut, rect.Bottom);
- path.AddLine(rect.Right - cut, rect.Bottom, rect.Left + cut, rect.Bottom);
- path.AddLine(rect.Left + cut, rect.Bottom, rect.Left, rect.Bottom - cut);
- path.AddLine(rect.Left, rect.Bottom - cut, rect.Left, rect.Top + cut);
- path.AddLine(rect.Left, rect.Top + cut, rect.Left + cut, rect.Top);
- return path;
- }
-
- private GraphicsPath CreateInsideBorderPath(Rectangle rect, float cut)
- {
- // Adjust rectangle to be 1 pixel inside the original area
- rect.Inflate(-1, -1);
-
- // Now create a path based on this inner rectangle
- return CreateBorderPath(rect, cut);
- }
-
- private GraphicsPath CreateInsideBorderPath(Rectangle rect,
- Rectangle exclude,
- float cut)
- {
- // Adjust rectangle to be 1 pixel inside the original area
- rect.Inflate(-1, -1);
-
- // Now create a path based on this inner rectangle
- return CreateBorderPath(rect, exclude, cut);
- }
-
- private GraphicsPath CreateClipBorderPath(Rectangle rect, float cut)
- {
- // Clipping happens inside the rect, so make 1 wider and taller
- rect.Width++;
- rect.Height++;
-
- // Now create a path based on this inner rectangle
- return CreateBorderPath(rect, cut);
- }
-
- private GraphicsPath CreateClipBorderPath(Rectangle rect,
- Rectangle exclude,
- float cut)
- {
- // Clipping happens inside the rect, so make 1 wider and taller
- rect.Width++;
- rect.Height++;
-
- // Now create a path based on this inner rectangle
- return CreateBorderPath(rect, exclude, cut);
- }
-
- private GraphicsPath CreateArrowPath(ToolStripItem item,
- Rectangle rect,
- ArrowDirection direction)
- {
- int x, y;
-
- // Find the correct starting position, which depends on direction
- if ((direction == ArrowDirection.Left) ||
- (direction == ArrowDirection.Right))
- {
- x = rect.Right - ((rect.Width - 4) / 2);
- y = rect.Y + (rect.Height / 2);
- }
- else
- {
- x = rect.X + (rect.Width / 2);
- y = rect.Bottom - ((rect.Height - 3) / 2);
-
- // The drop down button is position 1 pixel incorrectly when in RTL
- if ((item is ToolStripDropDownButton) &&
- (item.RightToLeft == RightToLeft.Yes))
- {
- x++;
- }
- }
-
- // Create triangle using a series of lines
- GraphicsPath path = new GraphicsPath();
-
- switch (direction)
- {
- case ArrowDirection.Right:
- path.AddLine(x, y, x - 4, y - 4);
- path.AddLine(x - 4, y - 4, x - 4, y + 4);
- path.AddLine(x - 4, y + 4, x, y);
- break;
- case ArrowDirection.Left:
- path.AddLine(x - 4, y, x, y - 4);
- path.AddLine(x, y - 4, x, y + 4);
- path.AddLine(x, y + 4, x - 4, y);
- break;
- case ArrowDirection.Down:
- path.AddLine(x + 3f, y - 3f, x - 2f, y - 3f);
- path.AddLine(x - 2f, y - 3f, x, y);
- path.AddLine(x, y, x + 3f, y - 3f);
- break;
- case ArrowDirection.Up:
- path.AddLine(x + 3f, y, x - 3f, y);
- path.AddLine(x - 3f, y, x, y - 4f);
- path.AddLine(x, y - 4f, x + 3f, y);
- break;
- }
-
- return path;
- }
-
- private GraphicsPath CreateTickPath(Rectangle rect)
- {
- // Get the center point of the rect
- int x = rect.X + (rect.Width / 2);
- int y = rect.Y + (rect.Height / 2);
-
- GraphicsPath path = new GraphicsPath();
- path.AddLine(x - 4, y, x - 2, y + 4);
- path.AddLine(x - 2, y + 4, x + 3, y - 5);
- return path;
- }
-
- private GraphicsPath CreateIndeterminatePath(Rectangle rect)
- {
- // Get the center point of the rect
- int x = rect.X + (rect.Width / 2);
- int y = rect.Y + (rect.Height / 2);
-
- GraphicsPath path = new GraphicsPath();
- path.AddLine(x - 3, y, x, y - 3);
- path.AddLine(x, y - 3, x + 3, y);
- path.AddLine(x + 3, y, x, y + 3);
- path.AddLine(x, y + 3, x - 3, y);
- return path;
- }
- #endregion
- }
-}
\ No newline at end of file
diff --git a/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/Core/KryptonOffice2010Renderer.cs b/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/Core/KryptonOffice2010Renderer.cs
deleted file mode 100644
index f29bd6f0..00000000
--- a/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/Core/KryptonOffice2010Renderer.cs
+++ /dev/null
@@ -1,1670 +0,0 @@
-using ComponentFactory.Krypton.Toolkit;
-using System;
-using System.Collections.Generic;
-using System.Drawing;
-using System.Drawing.Drawing2D;
-using System.Drawing.Imaging;
-using System.Drawing.Text;
-using System.Windows.Forms;
-
-namespace ExtendedControls.Base.Renderers.Core
-{
- internal class KryptonOffice2010Renderer : KryptonProfessionalRenderer
- {
- #region GradientItemColors
- private abstract class GradientItemColors
- {
- #region Public Fields
- public Color Border1;
- public Color Border2;
- public Color Back1;
- public Color Back2;
- #endregion
-
- #region Identity
- public GradientItemColors()
- {
- }
-
- public GradientItemColors(Color border1, Color border2,
- Color back1, Color back2)
- {
- Border1 = border1;
- Border2 = border2;
- Back1 = back1;
- Back2 = back2;
- }
- #endregion
-
- #region Public
- public virtual void DrawItem(Graphics g, Rectangle rect)
- {
- // Cannot paint a zero sized area
- if ((rect.Width > 0) && (rect.Height > 0))
- {
- // Draw the background of the entire item
- DrawBack(g, rect);
-
- // Draw the border of the entire item
- DrawBorder(g, rect);
- }
- }
-
- public virtual void DrawBorder(Graphics g, Rectangle rect)
- {
- // Drawing with anti aliasing to create smoother appearance
- using (AntiAlias aa = new AntiAlias(g))
- {
- Rectangle backRectI = rect;
- backRectI.Inflate(1, 1);
-
- // Finally draw the border around the menu item
- using (LinearGradientBrush borderBrush = new LinearGradientBrush(backRectI, Border1, Border2, 90f))
- {
- // Convert the brush to a pen for DrawPath call
- using (Pen borderPen = new Pen(borderBrush))
- {
- // Create border path around the entire item
- using (GraphicsPath borderPath = CreateBorderPath(rect, CUT_ITEM_MENU))
- {
- g.DrawPath(borderPen, borderPath);
- }
- }
- }
- }
- }
-
- public abstract void DrawBack(Graphics g, Rectangle rect);
- #endregion
- }
-
- private class GradientItemColorsSplit : GradientItemColors
- {
- ///
- /// Initialize a new instance of the GradientItemColorsSplit class.
- ///
- /// Base border color.
- /// Beginning background color.
- /// Ending background color.
- public GradientItemColorsSplit(Color border,
- Color begin,
- Color end)
- {
- // Calculate all colors from the provided parameters
- Border1 = border;
- Border2 = CommonHelper.WhitenColor(border, 0.979f, 0.943f, 1.20f);
- }
-
- public override void DrawBack(Graphics g, Rectangle rect)
- {
- }
- }
-
- private class GradientItemColorsTracking : GradientItemColors
- {
- public Color Back1B;
- public Color Back2B;
-
- ///
- /// Initialize a new instance of the GradientItemColorsTracking class.
- ///
- /// Base border color.
- /// Beginning background color.
- /// Ending background color.
- public GradientItemColorsTracking(Color border,
- Color begin,
- Color end)
- {
- // Calculate all colors from the provided parameters
- Border1 = border;
- Border2 = CommonHelper.WhitenColor(border, 0.979f, 0.943f, 1.20f);
- Back1 = begin;
- Back1B = CommonHelper.WhitenColor(begin, 1.0f, 0.975f, 0.930f);
- Back2 = end;
- Back2B = CommonHelper.WhitenColor(end, 1.0f, 0.953f, 0.758f);
- }
-
- public override void DrawBack(Graphics g, Rectangle rect)
- {
- Rectangle inset = new Rectangle(rect.X + 1, rect.Y + 1, rect.Width - 2, rect.Height - 2);
- Rectangle insetB = new Rectangle(rect.X + 2, rect.Y + 2, rect.Width - 3, rect.Height - 3);
- Rectangle insetC = new Rectangle(rect.X + 2, rect.Y + 2, rect.Width - 4, rect.Height - 4);
-
- using (LinearGradientBrush insideBrush1 = new LinearGradientBrush(rect, Back1B, Back1, 90f),
- insideBrush2 = new LinearGradientBrush(insetB, Back2B, Back2, 90f))
- {
- insideBrush1.SetSigmaBellShape(0.5f);
- insideBrush2.SetSigmaBellShape(0.5f);
-
- g.FillRectangle(insideBrush1, inset);
- using (GraphicsPath borderPath = CreateBorderPath(insetC, CUT_INNER_ITEM_MENU),
- clipPath = CreateBorderPath(insetB, CUT_INNER_ITEM_MENU))
- {
- using (Pen insidePen = new Pen(insideBrush2))
- {
- g.DrawPath(insidePen, borderPath);
- }
-
- g.FillPath(insideBrush2, borderPath);
-
- using (Clipping clipping = new Clipping(g, clipPath))
- {
- using (GraphicsPath ellipsePath = new GraphicsPath())
- {
- RectangleF ellipseRect = new RectangleF(-(rect.Width / 2), rect.Bottom - 9, rect.Width * 2, 18);
- PointF ellipseCenter = new PointF(ellipseRect.Left + (ellipseRect.Width / 2), ellipseRect.Top + (ellipseRect.Height / 2));
- ellipsePath.AddEllipse(ellipseRect);
-
- using (PathGradientBrush insideLighten = new PathGradientBrush(ellipsePath))
- {
- insideLighten.CenterPoint = ellipseCenter;
- insideLighten.CenterColor = Color.White;
- insideLighten.SurroundColors = new Color[] { Color.Transparent };
- g.FillPath(insideLighten, ellipsePath);
- }
- }
- }
- }
- }
- }
- }
-
- private class GradientItemColorsDisabled : GradientItemColorsTracking
- {
- ///
- /// Initialize a new instance of the GradientItemColorsDisabled class.
- ///
- /// Base border color.
- /// Beginning background color.
- /// Ending background color.
- public GradientItemColorsDisabled(Color border,
- Color begin,
- Color end)
- : base(border, begin, end)
- {
- // Convert all colors to back and white
- Border1 = CommonHelper.ColorToBlackAndWhite(Border1);
- Border2 = CommonHelper.ColorToBlackAndWhite(Border2);
- Back1 = CommonHelper.ColorToBlackAndWhite(Back1);
- Back1B = CommonHelper.ColorToBlackAndWhite(Back1B);
- Back2 = CommonHelper.ColorToBlackAndWhite(Back2);
- Back2B = CommonHelper.ColorToBlackAndWhite(Back2B);
- }
- }
-
- private class GradientItemColorsPressed : GradientItemColors
- {
- ///
- /// Initialize a new instance of the GradientItemColorsPressed class.
- ///
- /// Base border color.
- /// Beginning background color.
- /// Ending background color.
- public GradientItemColorsPressed(Color border,
- Color begin,
- Color end)
- {
- // Calculate all colors from the provided parameters
- Border1 = CommonHelper.WhitenColor(border, 1.21f, 1.68f, 2.02f);
- Border2 = CommonHelper.WhitenColor(border, 1.21f, 1.25f, 1.22f);
- Back1 = begin;
- }
-
- public override void DrawBack(Graphics g, Rectangle rect)
- {
- Rectangle rect2 = new Rectangle(rect.X + 1, rect.Y + 1, rect.Width - 2, rect.Height - 1);
- Rectangle rect3 = new Rectangle(rect.X + 2, rect.Y + 2, rect.Width - 4, rect.Height - 3);
-
- using (AntiAlias aa = new AntiAlias(g))
- {
- using (GraphicsPath path1 = CreateBorderPath(rect, CUT_ITEM_MENU),
- path2 = CreateBorderPath(rect2, CUT_ITEM_MENU),
- path3 = CreateBorderPath(rect3, CUT_ITEM_MENU))
- {
- using (SolidBrush brush1 = new SolidBrush(CommonHelper.MergeColors(Border1, 0.4f, Back1, 0.6f)),
- brush2 = new SolidBrush(CommonHelper.MergeColors(Border1, 0.2f, Back1, 0.8f)),
- brush3 = new SolidBrush(Back1))
- {
- g.FillPath(brush1, path1);
- g.FillPath(brush2, path2);
- g.FillPath(brush3, path3);
- }
- }
- }
- }
- }
-
- private class GradientItemColorsChecked : GradientItemColors
- {
- ///
- /// Initialize a new instance of the GradientItemColorsChecked class.
- ///
- /// Base border color.
- /// Beginning background color.
- /// Ending background color.
- public GradientItemColorsChecked(Color border,
- Color begin,
- Color end)
- {
- // Calculate all colors from the provided parameters
- Border1 = CommonHelper.WhitenColor(border, 1.21f, 1.44f, 1.81f);
- Border2 = CommonHelper.WhitenColor(border, 1.21f, 1.21f, 1.12f);
- Back1 = begin;
- Back2 = CommonHelper.WhitenColor(begin, 1.0f, 0.943f, .914f);
- }
-
- public override void DrawBack(Graphics g, Rectangle rect)
- {
- Rectangle inset = new Rectangle(rect.X + 1, rect.Y + 1, rect.Width - 2, rect.Height - 2);
- Rectangle insetB = new Rectangle(rect.X + 2, rect.Y + 2, rect.Width - 3, rect.Height - 3);
-
- using (LinearGradientBrush insideBrush = new LinearGradientBrush(rect, Back2, Back1, 90f))
- {
- insideBrush.SetSigmaBellShape(0.5f);
- g.FillRectangle(insideBrush, inset);
-
- using (GraphicsPath borderPath = CreateBorderPath(inset, CUT_INNER_ITEM_MENU))
- {
- using (GraphicsPath ellipsePath = new GraphicsPath())
- {
- RectangleF ellipseRect = new RectangleF(rect.Left, rect.Bottom - 8, rect.Width, 8);
- PointF ellipseCenter = new PointF(ellipseRect.Left + (ellipseRect.Width / 2), ellipseRect.Top + (ellipseRect.Height / 2));
- ellipsePath.AddEllipse(ellipseRect);
-
- using (PathGradientBrush insideLighten = new PathGradientBrush(ellipsePath))
- {
- insideLighten.CenterPoint = ellipseCenter;
- insideLighten.CenterColor = Color.FromArgb(96, Color.White);
- insideLighten.SurroundColors = new Color[] { Color.Transparent };
- g.FillPath(insideLighten, ellipsePath);
- }
- }
- }
- }
- }
- }
-
- private class GradientItemColorsCheckedTracking : GradientItemColorsTracking
- {
- ///
- /// Initialize a new instance of the GradientItemColorsCheckedTracking class.
- ///
- /// Base border color.
- /// Beginning background color.
- /// Ending background color.
- public GradientItemColorsCheckedTracking(Color border,
- Color begin,
- Color end)
- : base(border, begin, end)
- {
- // Calculate all colors from the provided parameters
- Border1 = CommonHelper.WhitenColor(border, 1.21f, 1.44f, 1.81f);
- Border2 = CommonHelper.WhitenColor(border, 1.21f, 1.21f, 1.12f);
- Back1 = CommonHelper.WhitenColor(begin, 1.0f, 0.953f, 0.822f);
- Back1B = CommonHelper.WhitenColor(begin, 1.0f, 0.923f, 0.669f);
- Back2 = CommonHelper.WhitenColor(end, 1.0f, 0.964f, 1.06f);
- Back2B = CommonHelper.WhitenColor(end, 1.0f, 0.911f, 0.685f);
- }
- }
- #endregion
-
- #region Static Fields
-
- private const int GRIP_OFFSET = 1;
- private const int GRIP_SQUARE = 2;
- private const int GRIP_SIZE = 3;
- private const int GRIP_MOVE = 4;
- private const int GRIP_LINES = 3;
- private const int MARGIN_INSET = 2;
- private const int CHECK_INSET = 1;
- private const int SEPARATOR_INSET = 31;
- private const float CONTEXT_CHECK_TICK_THICKNESS = 1.6f;
- private const float CUT_CONTEXT_MENU = 0f;
- private const float CUT_ITEM_MENU = 1.7f;
- private const float CUT_INNER_ITEM_MENU = 1.0f;
- private const float CUT_HEADER_MENU = 1.0f;
- private static readonly Blend _stripBlend;
- private static readonly Blend _separatorLightBlend;
- private static readonly Blend _separatorDarkBlend;
- private static readonly Color _disabled = Color.FromArgb(167, 167, 167);
- private static readonly GradientItemColors _disabledItem = new GradientItemColorsDisabled(Color.FromArgb(236, 199, 87), Color.FromArgb(251, 242, 215), Color.FromArgb(247, 224, 137));
- #endregion
-
- #region Instance Fields
- private GradientItemColorsSplit _gradientSplit;
- private GradientItemColorsTracking _gradientTracking;
- private GradientItemColorsPressed _gradientPressed;
- private GradientItemColorsChecked _gradientChecked;
- private GradientItemColorsCheckedTracking _gradientCheckedTracking;
- #endregion
-
- #region Identity
- static KryptonOffice2010Renderer()
- {
- _stripBlend = new Blend
- {
- Positions = new float[] { 0.0f, 0.33f, 0.66f, 1.0f },
- Factors = new float[] { 0.0f, 0.5f, 0.8f, 1.0f }
- };
-
- _separatorDarkBlend = new Blend
- {
- Positions = new float[] { 0.0f, 0.5f, 1.0f },
- Factors = new float[] { 0.2f, 1f, 0.2f }
- };
-
- _separatorLightBlend = new Blend
- {
- Positions = new float[] { 0.0f, 0.5f, 1.0f },
- Factors = new float[] { 0.1f, 0.6f, 0.1f }
- };
- }
-
- ///
- /// Initialise a new instance of the KryptonOffice2010Renderer class.
- ///
- /// Source for text colors.
- public KryptonOffice2010Renderer(KryptonColorTable kct)
- : base(kct)
- {
- }
- #endregion
-
- #region OnRenderArrow
- ///
- /// Raises the RenderArrow event.
- ///
- /// An ToolStripArrowRenderEventArgs containing the event data.
- protected override void OnRenderArrow(ToolStripArrowRenderEventArgs e)
- {
- // Cannot paint a zero sized area
- if ((e.ArrowRectangle.Width > 0) &&
- (e.ArrowRectangle.Height > 0))
- {
- // Create a path that is used to fill the arrow
- using (GraphicsPath arrowPath = CreateArrowPath(e.Item,
- e.ArrowRectangle,
- e.Direction))
- {
- // Get the rectangle that encloses the arrow and expand slightly
- // so that the gradient is always within the expanding bounds
- RectangleF boundsF = arrowPath.GetBounds();
- boundsF.Inflate(1f, 1f);
-
- // Set correct color of the arrow
- Color color1;
- Color color2;
- if (!e.Item.Enabled)
- {
- color1 = _disabled;
- color2 = _disabled;
- }
- else
- {
- if (e.Item.Pressed || e.Item.Selected || (e.Item is ToolStripMenuItem))
- {
- color1 = KCT.MenuItemText;
- }
- else
- {
- color1 = KCT.ToolStripText;
- }
-
- color2 = CommonHelper.WhitenColor(color1, 0.7f, 0.7f, 0.7f);
- }
-
- float angle = 0;
-
- // Use gradient angle to match the arrow direction
- switch (e.Direction)
- {
- case ArrowDirection.Right:
- angle = 0;
- break;
- case ArrowDirection.Left:
- angle = 180f;
- break;
- case ArrowDirection.Down:
- angle = 90f;
- break;
- case ArrowDirection.Up:
- angle = 270f;
- break;
- }
-
- // Draw the actual arrow using a gradient
- using (LinearGradientBrush arrowBrush = new LinearGradientBrush(boundsF, color1, color2, angle))
- {
- e.Graphics.FillPath(arrowBrush, arrowPath);
- }
- }
- }
- }
- #endregion
-
- #region OnRenderButtonBackground
- ///
- /// Raises the RenderButtonBackground event.
- ///
- /// An ToolStripItemRenderEventArgs containing the event data.
- protected override void OnRenderButtonBackground(ToolStripItemRenderEventArgs e)
- {
- // Cast to correct type
- ToolStripButton button = (ToolStripButton)e.Item;
-
- if (button.Selected || button.Pressed || button.Checked)
- {
- RenderToolButtonBackground(e.Graphics, button, e.ToolStrip);
- }
- }
- #endregion
-
- #region OnRenderDropDownButtonBackground
- ///
- /// Raises the RenderDropDownButtonBackground event.
- ///
- /// An ToolStripItemRenderEventArgs containing the event data.
- protected override void OnRenderDropDownButtonBackground(ToolStripItemRenderEventArgs e)
- {
- if (e.Item.Selected || e.Item.Pressed)
- {
- RenderToolDropButtonBackground(e.Graphics, e.Item, e.ToolStrip);
- }
- }
- #endregion
-
- #region OnRenderItemCheck
- ///
- /// Raises the RenderItemCheck event.
- ///
- /// An ToolStripItemImageRenderEventArgs containing the event data.
- protected override void OnRenderItemCheck(ToolStripItemImageRenderEventArgs e)
- {
- // Staring size of the checkbox is the image rectangle
- Rectangle checkBox = e.ImageRectangle;
-
- // Make the border of the check box 1 pixel bigger on all sides, as a minimum
- checkBox.Inflate(1, 1);
-
- // Can we extend upwards?
- if (checkBox.Top > CHECK_INSET)
- {
- int diff = checkBox.Top - CHECK_INSET;
- checkBox.Y -= diff;
- checkBox.Height += diff;
- }
-
- // Can we extend downwards?
- if (checkBox.Height <= (e.Item.Bounds.Height - (CHECK_INSET * 2)))
- {
- int diff = e.Item.Bounds.Height - (CHECK_INSET * 2) - checkBox.Height;
- checkBox.Height += diff;
- }
-
- // Drawing with anti aliasing to create smoother appearance
- using (AntiAlias aa = new AntiAlias(e.Graphics))
- {
- // Create border path for the check box
- using (GraphicsPath borderPath = CreateBorderPath(checkBox, CUT_ITEM_MENU))
- {
- // Fill the background in a solid color
- using (SolidBrush fillBrush = new SolidBrush(KCT.CheckBackground))
- {
- e.Graphics.FillPath(fillBrush, borderPath);
- }
-
- // Draw the border around the check box
- using (Pen borderPen = new Pen(CommonHelper.WhitenColor(KCT.CheckBackground, 1.05f, 1.52f, 2.75f)))
- {
- e.Graphics.DrawPath(borderPen, borderPath);
- }
-
- // If there is not an image, then we can draw the tick, square etc...
- if (e.Item.Image == null)
- {
- CheckState checkState = CheckState.Unchecked;
-
- // Extract the check state from the item
- if (e.Item is ToolStripMenuItem item)
- {
- checkState = item.CheckState;
- }
-
- // Decide what graphic to draw
- switch (checkState)
- {
- case CheckState.Checked:
- // Create a path for the tick
- using (GraphicsPath tickPath = CreateTickPath(checkBox))
- {
- // Draw the tick with a thickish brush
- using (Pen tickPen = new Pen(CommonHelper.WhitenColor(KCT.CheckBackground, 3.86f, 3.02f, 1.07f), CONTEXT_CHECK_TICK_THICKNESS))
- {
- e.Graphics.DrawPath(tickPen, tickPath);
- }
- }
- break;
- case CheckState.Indeterminate:
- // Create a path for the indeterminate diamond
- using (GraphicsPath tickPath = CreateIndeterminatePath(checkBox))
- {
- // Draw the tick with a thickish brush
- using (SolidBrush tickBrush = new SolidBrush(CommonHelper.WhitenColor(KCT.CheckBackground, 3.86f, 3.02f, 1.07f)))
- {
- e.Graphics.FillPath(tickBrush, tickPath);
- }
- }
- break;
- }
- }
- }
- }
- }
- #endregion
-
- #region OnRenderItemText
- ///
- /// Raises the RenderItemText event.
- ///
- /// A ToolStripItemTextRenderEventArgs that contains the event data.
- protected override void OnRenderItemText(ToolStripItemTextRenderEventArgs e)
- {
- if ((e.ToolStrip is ToolStrip) ||
- (e.ToolStrip is ContextMenuStrip) ||
- (e.ToolStrip is ToolStripDropDownMenu))
- {
- e.TextColor = KCT.ToolStripText;
- if (!e.Item.Enabled)
- {
- e.TextColor = _disabled;
- }
- else
- {
- switch (e.ToolStrip)
- {
- case MenuStrip _ when !e.Item.Pressed && !e.Item.Selected:
- e.TextColor = KCT.MenuStripText;
- break;
- case MenuStrip _:
- e.TextColor = KCT.MenuItemText;
- break;
- case StatusStrip _ when !e.Item.Pressed && !e.Item.Selected:
- e.TextColor = KCT.StatusStripText;
- break;
- case StatusStrip _ when !e.Item.Pressed && e.Item.Selected:
- e.TextColor = KCT.MenuItemText;
- break;
- case ToolStrip _ when !e.Item.Pressed && e.Item.Selected:
- e.TextColor = KCT.MenuItemText;
- break;
- case ContextMenuStrip _ when !e.Item.Pressed && !e.Item.Selected:
- e.TextColor = KCT.MenuItemText;
- break;
- case ToolStripDropDownMenu _:
- e.TextColor = KCT.MenuItemText;
- break;
- default:
- if ((e.Item is ToolStripButton) && (((ToolStripButton)e.Item).Checked))
- {
- e.TextColor = KCT.MenuItemText;
- }
- break;
- }
- }
-
- // Status strips under XP cannot use clear type because it ends up being cut off at edges
- if ((e.ToolStrip is StatusStrip) && (Environment.OSVersion.Version.Major < 6))
- {
- base.OnRenderItemText(e);
- }
- else
- {
- using (GraphicsTextHint clearTypeGridFit = new GraphicsTextHint(e.Graphics, TextRenderingHint.ClearTypeGridFit))
- {
- base.OnRenderItemText(e);
- }
- }
- }
- else
- {
- base.OnRenderItemText(e);
- }
- }
- #endregion
-
- #region OnRenderItemImage
- ///
- /// Raises the RenderItemImage event.
- ///
- /// An ToolStripItemImageRenderEventArgs containing the event data.
- protected override void OnRenderItemImage(ToolStripItemImageRenderEventArgs e)
- {
- // We only override the image drawing for context menus
- if ((e.ToolStrip is ContextMenuStrip) ||
- (e.ToolStrip is ToolStripDropDownMenu))
- {
- if (e.Image != null)
- {
- if (e.Item.Enabled)
- {
- e.Graphics.DrawImage(e.Image, e.ImageRectangle);
- }
- else
- {
- using (ImageAttributes attribs = new ImageAttributes())
- {
- attribs.SetColorMatrix(CommonHelper.MatrixDisabled);
-
- // Draw using the disabled matrix to make it look disabled
- e.Graphics.DrawImage(e.Image, e.ImageRectangle,
- 0, 0, e.Image.Width, e.Image.Height,
- GraphicsUnit.Pixel, attribs);
- }
- }
- }
- }
- else
- {
- base.OnRenderItemImage(e);
- }
- }
- #endregion
-
- #region OnRenderMenuItemBackground
- ///
- /// Raises the RenderMenuItemBackground event.
- ///
- /// An ToolStripItemRenderEventArgs containing the event data.
- protected override void OnRenderMenuItemBackground(ToolStripItemRenderEventArgs e)
- {
- if ((e.ToolStrip is MenuStrip) ||
- (e.ToolStrip is ContextMenuStrip) ||
- (e.ToolStrip is ToolStripDropDownMenu))
- {
- if ((e.Item.Pressed) && (e.ToolStrip is MenuStrip))
- {
- // Draw the menu/tool strip as a header for a context menu item
- DrawContextMenuHeader(e.Graphics, e.Item);
- }
- else
- {
- // We only draw a background if the item is selected and enabled
- if (e.Item.Selected)
- {
- if (e.Item.Enabled)
- {
- // Ensure we have cached the objects we need
- UpdateCache();
-
- // Do we draw as a menu strip or context menu item?
- if (e.ToolStrip is MenuStrip)
- {
- DrawGradientToolItem(e.Graphics, e.Item, _gradientTracking);
- }
- else
- {
- DrawGradientContextMenuItem(e.Graphics, e.Item, _gradientTracking);
- }
- }
- else
- {
- // Get the mouse position in tool strip coordinates
- Point mousePos = e.ToolStrip.PointToClient(Control.MousePosition);
-
- // If the mouse is not in the item area, then draw disabled
- if (!e.Item.Bounds.Contains(mousePos))
- {
- // Do we draw as a menu strip or context menu item?
- if (e.ToolStrip is MenuStrip)
- {
- DrawGradientToolItem(e.Graphics, e.Item, _disabledItem);
- }
- else
- {
- DrawGradientContextMenuItem(e.Graphics, e.Item, _disabledItem);
- }
- }
- }
- }
- }
- }
- else
- {
- base.OnRenderMenuItemBackground(e);
- }
- }
- #endregion
-
- #region OnRenderSeparator
- ///
- /// Raises the RenderSeparator event.
- ///
- /// An ToolStripSeparatorRenderEventArgs containing the event data.
- protected override void OnRenderSeparator(ToolStripSeparatorRenderEventArgs e)
- {
- if ((e.ToolStrip is ContextMenuStrip) ||
- (e.ToolStrip is ToolStripDropDownMenu))
- {
- DrawContextMenuSeparator(e.Graphics, e.Vertical, e.Item.Bounds, SEPARATOR_INSET,
- (e.ToolStrip.RightToLeft == RightToLeft.Yes));
- }
- else
- {
- DrawToolStripSeparator(e.Graphics, e.Vertical, e.Item.Bounds,
- KCT.SeparatorLight, KCT.SeparatorDark, 0, false);
- }
- }
- #endregion
-
- #region OnRenderSplitButtonBackground
- ///
- /// Raises the RenderSplitButtonBackground event.
- ///
- /// An ToolStripItemRenderEventArgs containing the event data.
- protected override void OnRenderSplitButtonBackground(ToolStripItemRenderEventArgs e)
- {
- if (e.Item.Selected || e.Item.Pressed)
- {
- // Cast to correct type
- ToolStripSplitButton splitButton = (ToolStripSplitButton)e.Item;
-
- // Draw the border and background
- RenderToolSplitButtonBackground(e.Graphics, splitButton, e.ToolStrip);
-
- // Get the rectangle that needs to show the arrow
- Rectangle arrowBounds = splitButton.DropDownButtonBounds;
-
- // Draw the arrow on top of the background
- OnRenderArrow(new ToolStripArrowRenderEventArgs(e.Graphics,
- splitButton,
- arrowBounds,
- SystemColors.ControlText,
- ArrowDirection.Down));
- }
- else
- {
- base.OnRenderSplitButtonBackground(e);
- }
- }
- #endregion
-
- #region OnRenderStatusStripSizingGrip
- ///
- /// Raises the RenderStatusStripSizingGrip event.
- ///
- /// An ToolStripRenderEventArgs containing the event data.
- protected override void OnRenderStatusStripSizingGrip(ToolStripRenderEventArgs e)
- {
- using (SolidBrush darkBrush = new SolidBrush(KCT.GripDark),
- lightBrush = new SolidBrush(KCT.GripLight))
- {
- // Do we need to invert the drawing edge?
- bool rtl = (e.ToolStrip.RightToLeft == RightToLeft.Yes);
-
- // Find vertical position of the lowest grip line
- int y = e.AffectedBounds.Bottom - (GRIP_SIZE * 2);
-
- // Draw three lines of grips
- for (int i = GRIP_LINES; i >= 1; i--)
- {
- // Find the rightmost grip position on the line
- int x = (rtl ? e.AffectedBounds.Left + 1 :
- e.AffectedBounds.Right - (GRIP_SIZE * 2));
-
- // Draw grips from right to left on line
- for (int j = 0; j < i; j++)
- {
- // Just the single grip glyph
- DrawGripGlyph(e.Graphics, x, y, darkBrush, lightBrush);
-
- // Move left to next grip position
- x -= (rtl ? -GRIP_MOVE : GRIP_MOVE);
- }
-
- // Move upwards to next grip line
- y -= GRIP_MOVE;
- }
- }
- }
- #endregion
-
- #region OnRenderToolStripContentPanelBackground
- ///
- /// Raises the RenderToolStripContentPanelBackground event.
- ///
- /// An ToolStripContentPanelRenderEventArgs containing the event data.
- protected override void OnRenderToolStripContentPanelBackground(ToolStripContentPanelRenderEventArgs e)
- {
- // Must call base class, otherwise the subsequent drawing does not appear!
- base.OnRenderToolStripContentPanelBackground(e);
-
- // Cannot paint a zero sized area
- if ((e.ToolStripContentPanel.Width > 0) &&
- (e.ToolStripContentPanel.Height > 0))
- {
- using (LinearGradientBrush backBrush = new LinearGradientBrush(e.ToolStripContentPanel.ClientRectangle,
- KCT.ToolStripContentPanelGradientEnd,
- KCT.ToolStripContentPanelGradientBegin,
- 90f))
- {
- e.Graphics.FillRectangle(backBrush, e.ToolStripContentPanel.ClientRectangle);
- }
- }
- }
- #endregion
-
- #region OnRenderToolStripBackground
- ///
- /// Raises the RenderToolStripBackground event.
- ///
- /// An ToolStripRenderEventArgs containing the event data.
- protected override void OnRenderToolStripBackground(ToolStripRenderEventArgs e)
- {
- switch (e.ToolStrip)
- {
- case ContextMenuStrip _:
- case ToolStripDropDownMenu _:
- // Make sure the font is current
- if (e.ToolStrip.Font != KCT.MenuStripFont)
- {
- e.ToolStrip.Font = KCT.MenuStripFont;
- }
-
- // Create border and clipping paths
- using (GraphicsPath borderPath = CreateBorderPath(e.AffectedBounds, CUT_CONTEXT_MENU),
- clipPath = CreateClipBorderPath(e.AffectedBounds, CUT_CONTEXT_MENU))
- {
- // Clip all drawing to within the border path
- using (Clipping clipping = new Clipping(e.Graphics, clipPath))
- {
- // Create the background brush
- using (SolidBrush backBrush = new SolidBrush(KCT.ToolStripDropDownBackground))
- {
- e.Graphics.FillPath(backBrush, borderPath);
- }
- }
- }
- break;
- case StatusStrip _:
- {
- // Make sure the font is current
- if (e.ToolStrip.Font != KCT.StatusStripFont)
- {
- e.ToolStrip.Font = KCT.StatusStripFont;
- }
-
- // We do not paint the top two pixel lines, as they are drawn by the status strip border render method
- RectangleF backRect = new RectangleF(0, 1.5f, e.ToolStrip.Width, e.ToolStrip.Height - 2);
-
- // Cannot paint a zero sized area
- if ((backRect.Width > 0) && (backRect.Height > 0))
- {
- using (LinearGradientBrush backBrush = new LinearGradientBrush(backRect,
- KCT.StatusStripGradientBegin,
- KCT.StatusStripGradientEnd,
- 90f))
- {
- backBrush.Blend = _stripBlend;
- e.Graphics.FillRectangle(backBrush, backRect);
- }
- }
- break;
- }
- case MenuStrip _:
- if (e.ToolStrip.Font != KCT.MenuStripFont)
- {
- e.ToolStrip.Font = KCT.MenuStripFont;
- }
-
- base.OnRenderToolStripBackground(e);
- break;
- default:
- {
- if (e.ToolStrip.Font != KCT.ToolStripFont)
- {
- e.ToolStrip.Font = KCT.ToolStripFont;
- }
-
- // Cannot paint a zero sized area
- RectangleF backRect = new RectangleF(0, 0, e.ToolStrip.Width, e.ToolStrip.Height);
- if ((backRect.Width > 0) && (backRect.Height > 0))
- {
- if (e.ToolStrip.Orientation == Orientation.Horizontal)
- {
- using (LinearGradientBrush backBrush = new LinearGradientBrush(backRect,
- KCT.ToolStripGradientBegin,
- KCT.ToolStripGradientEnd,
- 90f))
- {
- backBrush.Blend = _stripBlend;
- e.Graphics.FillRectangle(backBrush, backRect);
- }
-
- using (Pen darkBorder = new Pen(KCT.ToolStripBorder),
- lightBorder = new Pen(KCT.ToolStripGradientBegin))
- {
- e.Graphics.DrawLine(lightBorder, 0, 2, 0, e.ToolStrip.Height - 2);
- e.Graphics.DrawLine(lightBorder, e.ToolStrip.Width - 2, 0, e.ToolStrip.Width - 2, e.ToolStrip.Height - 2);
- e.Graphics.DrawLine(darkBorder, e.ToolStrip.Width - 1, 0, e.ToolStrip.Width - 1, e.ToolStrip.Height - 1);
- }
- }
- else
- {
- using (LinearGradientBrush backBrush = new LinearGradientBrush(backRect,
- KCT.ToolStripGradientBegin,
- KCT.ToolStripGradientEnd,
- 0f))
- {
- backBrush.Blend = _stripBlend;
- e.Graphics.FillRectangle(backBrush, backRect);
- }
-
- using (Pen darkBorder = new Pen(KCT.ToolStripBorder),
- lightBorder = new Pen(KCT.ToolStripGradientBegin))
- {
- e.Graphics.DrawLine(lightBorder, 1, 0, e.ToolStrip.Width - 2, 0);
- e.Graphics.DrawLine(lightBorder, 1, e.ToolStrip.Height - 2, e.ToolStrip.Width - 2, e.ToolStrip.Height - 2);
- e.Graphics.DrawLine(darkBorder, e.ToolStrip.Width - 1, 0, e.ToolStrip.Width - 1, e.ToolStrip.Height - 1);
- }
- }
- }
- break;
- }
- }
- }
- #endregion
-
- #region OnRenderToolStripBorder
- ///
- /// Raises the RenderToolStripBorder event.
- ///
- /// An ToolStripRenderEventArgs containing the event data.
- protected override void OnRenderToolStripBorder(ToolStripRenderEventArgs e)
- {
- switch (e.ToolStrip)
- {
- case ContextMenuStrip _:
- case ToolStripDropDownMenu _:
- // If there is a connected area to be drawn
- if (!e.ConnectedArea.IsEmpty)
- {
- using (SolidBrush excludeBrush = new SolidBrush(KCT.ToolStripDropDownBackground))
- {
- e.Graphics.FillRectangle(excludeBrush, e.ConnectedArea);
- }
- }
-
- // Create border and clipping paths
- using (GraphicsPath borderPath = CreateBorderPath(e.AffectedBounds, e.ConnectedArea, CUT_CONTEXT_MENU),
- insidePath = CreateInsideBorderPath(e.AffectedBounds, e.ConnectedArea, CUT_CONTEXT_MENU),
- clipPath = CreateClipBorderPath(e.AffectedBounds, e.ConnectedArea, CUT_CONTEXT_MENU))
- {
- // Create the different pen colors we need
- using (Pen borderPen = new Pen(KCT.MenuBorder),
- insidePen = new Pen(KCT.ToolStripDropDownBackground))
- {
- // Clip all drawing to within the border path
- using (Clipping clipping = new Clipping(e.Graphics, clipPath))
- {
- // Drawing with anti aliasing to create smoother appearance
- using (AntiAlias aa = new AntiAlias(e.Graphics))
- {
- // Draw the inside area first
- e.Graphics.DrawPath(insidePen, insidePath);
-
- // Draw the border area second, so any overlapping gives it priority
- e.Graphics.DrawPath(borderPen, borderPath);
- }
-
- // Draw the pixel at the bottom right of the context menu
- e.Graphics.DrawLine(borderPen, e.AffectedBounds.Right, e.AffectedBounds.Bottom,
- e.AffectedBounds.Right - 1, e.AffectedBounds.Bottom - 1);
- }
- }
- }
- break;
- case StatusStrip _:
- // Draw two lines at top of the status strip
- using (Pen darkBorder = new Pen(KCT.ToolStripBorder),
- lightBorder = new Pen(KCT.SeparatorLight))
- {
- e.Graphics.DrawLine(darkBorder, 0, 0, e.ToolStrip.Width - 1, 0);
- e.Graphics.DrawLine(lightBorder, 0, 1, e.ToolStrip.Width - 1, 1);
- }
- break;
- default:
- base.OnRenderToolStripBorder(e);
- break;
- }
- }
- #endregion
-
- #region OnRenderImageMargin
- ///
- /// Raises the RenderImageMargin event.
- ///
- /// An ToolStripRenderEventArgs containing the event data.
- protected override void OnRenderImageMargin(ToolStripRenderEventArgs e)
- {
- if ((e.ToolStrip is ContextMenuStrip) ||
- (e.ToolStrip is ToolStripDropDownMenu))
- {
- // Start with the total margin area
- Rectangle marginRect = e.AffectedBounds;
-
- // Do we need to draw with separator on the opposite edge?
- bool rtl = (e.ToolStrip.RightToLeft == RightToLeft.Yes);
-
- marginRect.Y += MARGIN_INSET;
- marginRect.Height -= MARGIN_INSET * 2;
-
- // Reduce so it is inside the border
- if (!rtl)
- {
- marginRect.X += MARGIN_INSET;
- }
- else
- {
- marginRect.X += MARGIN_INSET / 2;
- }
-
- using (Pen marginPen = new Pen(Color.FromArgb(80, KCT.MenuBorder)))
- {
- if (!rtl)
- {
- e.Graphics.DrawLine(marginPen, marginRect.Right, marginRect.Top, marginRect.Right, marginRect.Bottom);
- }
- else
- {
- e.Graphics.DrawLine(marginPen, marginRect.Left - 1, marginRect.Top, marginRect.Left - 1, marginRect.Bottom);
- }
- }
- }
- else
- {
- base.OnRenderImageMargin(e);
- }
- }
- #endregion
-
- #region Implementation
- private void UpdateCache()
- {
- // Only need to create the cache objects first time around
- if (_gradientSplit == null)
- {
- _gradientSplit = new GradientItemColorsSplit(KCT.ButtonSelectedBorder,
- KCT.ButtonSelectedGradientBegin,
- KCT.ButtonSelectedGradientEnd);
-
- _gradientTracking = new GradientItemColorsTracking(KCT.ButtonSelectedBorder,
- KCT.ButtonSelectedGradientBegin,
- KCT.ButtonSelectedGradientEnd);
-
- _gradientPressed = new GradientItemColorsPressed(KCT.ButtonPressedBorder,
- KCT.ButtonPressedGradientBegin,
- KCT.ButtonPressedGradientEnd);
-
- _gradientChecked = new GradientItemColorsChecked(KCT.ButtonPressedBorder,
- KCT.ButtonCheckedGradientBegin,
- KCT.ButtonCheckedGradientEnd);
-
- _gradientCheckedTracking = new GradientItemColorsCheckedTracking(KCT.ButtonSelectedBorder,
- KCT.ButtonPressedGradientBegin,
- KCT.ButtonCheckedGradientEnd);
- }
- }
-
- private void RenderToolButtonBackground(Graphics g,
- ToolStripButton button,
- ToolStrip toolstrip)
- {
- // We only draw a background if the item is selected or being pressed
- if (button.Enabled)
- {
- // Ensure we have cached the objects we need
- UpdateCache();
-
- if (button.Checked)
- {
- if (button.Pressed)
- {
- DrawGradientToolItem(g, button, _gradientPressed);
- }
- else if (button.Selected)
- {
- DrawGradientToolItem(g, button, _gradientCheckedTracking);
- }
- else
- {
- DrawGradientToolItem(g, button, _gradientChecked);
- }
- }
- else
- {
- if (button.Pressed)
- {
- DrawGradientToolItem(g, button, _gradientPressed);
- }
- else if (button.Selected)
- {
- DrawGradientToolItem(g, button, _gradientTracking);
- }
- }
- }
- else
- {
- if (button.Selected)
- {
- // Get the mouse position in tool strip coordinates
- Point mousePos = toolstrip.PointToClient(Control.MousePosition);
-
- // If the mouse is not in the item area, then draw disabled
- if (!button.Bounds.Contains(mousePos))
- {
- DrawGradientToolItem(g, button, _disabledItem);
- }
- }
- }
- }
-
- private void RenderToolDropButtonBackground(Graphics g,
- ToolStripItem item,
- ToolStrip toolstrip)
- {
- // We only draw a background if the item is selected or being pressed
- if (item.Selected || item.Pressed)
- {
- if (item.Enabled)
- {
- if (item.Pressed)
- {
- DrawContextMenuHeader(g, item);
- }
- else
- {
- // Ensure we have cached the objects we need
- UpdateCache();
-
- DrawGradientToolItem(g, item, _gradientTracking);
- }
- }
- else
- {
- // Get the mouse position in tool strip coordinates
- Point mousePos = toolstrip.PointToClient(Control.MousePosition);
-
- // If the mouse is not in the item area, then draw disabled
- if (!item.Bounds.Contains(mousePos))
- {
- DrawGradientToolItem(g, item, _disabledItem);
- }
- }
- }
- }
-
- private void DrawGradientToolSplitItem(Graphics g,
- ToolStripSplitButton splitButton,
- GradientItemColors colorsButton,
- GradientItemColors colorsDrop,
- GradientItemColors colorsSplit)
- {
- // Create entire area and just the drop button area rectangles
- Rectangle backRect = new Rectangle(Point.Empty, splitButton.Bounds.Size);
- Rectangle backRectDrop = splitButton.DropDownButtonBounds;
-
- // Cannot paint zero sized areas
- if ((backRect.Width > 0) && (backRectDrop.Width > 0) &&
- (backRect.Height > 0) && (backRectDrop.Height > 0))
- {
- // Area that is the normal button starts as everything
- Rectangle backRectButton = backRect;
-
- // The X offset to draw the split line
- int splitOffset;
-
- // Is the drop button on the right hand side of entire area?
- if (backRectDrop.X > 0)
- {
- backRectButton.Width = backRectDrop.Left;
- backRectDrop.X -= 1;
- backRectDrop.Width++;
- splitOffset = backRectDrop.X;
- }
- else
- {
- backRectButton.Width -= backRectDrop.Width - 2;
- backRectButton.X = backRectDrop.Right - 1;
- backRectDrop.Width++;
- splitOffset = backRectDrop.Right - 1;
- }
-
- // Create border path around the item
- using (GraphicsPath borderPath = CreateBorderPath(backRect, CUT_ITEM_MENU))
- {
- // Draw the normal button area background
- colorsButton.DrawBack(g, backRectButton);
-
- // Draw the drop button area background
- colorsDrop.DrawBack(g, backRectDrop);
-
- // Draw the split line between the areas
- using (LinearGradientBrush splitBrush = new LinearGradientBrush(new Rectangle(backRect.X + splitOffset, backRect.Top, 1, backRect.Height + 1),
- colorsSplit.Border1, colorsSplit.Border2, 90f))
- {
- // Convert the brush to a pen for DrawPath call
- using (Pen splitPen = new Pen(splitBrush))
- {
- g.DrawLine(splitPen, backRect.X + splitOffset, backRect.Top + 1, backRect.X + splitOffset, backRect.Bottom - 1);
- }
- }
-
- // Draw the border of the entire item
- colorsButton.DrawBorder(g, backRect);
- }
- }
- }
-
- private void DrawContextMenuHeader(Graphics g, ToolStripItem item)
- {
- // Get the rectangle that is the items area
- Rectangle itemRect = new Rectangle(Point.Empty, item.Bounds.Size);
-
- // Create border and clipping paths
- using (GraphicsPath borderPath = CreateBorderPath(itemRect, CUT_HEADER_MENU),
- insidePath = CreateInsideBorderPath(itemRect, CUT_HEADER_MENU),
- clipPath = CreateClipBorderPath(itemRect, CUT_HEADER_MENU))
- {
- // Clip all drawing to within the border path
- using (Clipping clipping = new Clipping(g, clipPath))
- {
- // Draw the entire background area first
- using (SolidBrush backBrush = new SolidBrush(KCT.ToolStripDropDownBackground))
- {
- g.FillPath(backBrush, borderPath);
- }
-
- // Draw the border
- using (Pen borderPen = new Pen(KCT.MenuBorder))
- {
- g.DrawPath(borderPen, borderPath);
- }
- }
- }
- }
-
- private void DrawGradientToolItem(Graphics g,
- ToolStripItem item,
- GradientItemColors colors)
- {
- // Perform drawing into the entire background of the item
- colors.DrawItem(g, new Rectangle(Point.Empty, item.Bounds.Size));
- }
-
- private void RenderToolSplitButtonBackground(Graphics g,
- ToolStripSplitButton splitButton,
- ToolStrip toolstrip)
- {
- // We only draw a background if the item is selected or being pressed
- if (splitButton.Selected || splitButton.Pressed)
- {
- if (splitButton.Enabled)
- {
- // Ensure we have cached the objects we need
- UpdateCache();
-
- if (!splitButton.Pressed && splitButton.ButtonPressed)
- {
- DrawGradientToolSplitItem(g, splitButton, _gradientPressed, _gradientTracking, _gradientSplit);
- }
- else if (splitButton.Pressed && !splitButton.ButtonPressed)
- {
- DrawContextMenuHeader(g, splitButton);
- }
- else
- {
- DrawGradientToolSplitItem(g, splitButton, _gradientTracking, _gradientTracking, _gradientSplit);
- }
- }
- else
- {
- // Get the mouse position in tool strip coordinates
- Point mousePos = toolstrip.PointToClient(Control.MousePosition);
-
- // If the mouse is not in the item area, then draw disabled
- if (!splitButton.Bounds.Contains(mousePos))
- {
- DrawGradientToolItem(g, splitButton, _disabledItem);
- }
- }
- }
-
- }
-
- private void DrawGradientContextMenuItem(Graphics g,
- ToolStripItem item,
- GradientItemColors colors)
- {
- // Do we need to draw with separator on the opposite edge?
- Rectangle backRect = new Rectangle(2, 0, item.Bounds.Width - 3, item.Bounds.Height);
-
- // Perform actual drawing into the background
- colors.DrawItem(g, backRect);
- }
-
- private void DrawGripGlyph(Graphics g,
- int x,
- int y,
- Brush darkBrush,
- Brush lightBrush)
- {
- g.FillRectangle(lightBrush, x + GRIP_OFFSET, y + GRIP_OFFSET, GRIP_SQUARE, GRIP_SQUARE);
- g.FillRectangle(darkBrush, x, y, GRIP_SQUARE, GRIP_SQUARE);
- }
-
- private void DrawContextMenuSeparator(Graphics g,
- bool vertical,
- Rectangle rect,
- int horizontalInset,
- bool rtl)
- {
- if (vertical)
- {
- int l = rect.Width / 2;
- int t = rect.Y;
- int b = rect.Bottom;
-
- using (Pen marginPen = new Pen(Color.FromArgb(80, KCT.MenuBorder)))
- {
- marginPen.DashPattern = new float[] { 2, 2 };
- g.DrawLine(marginPen, l, t, l, b);
- }
- }
- else
- {
- int y = rect.Height / 2;
- int l = rect.X + (rtl ? 0 : horizontalInset);
- int r = rect.Right - (rtl ? horizontalInset : 0);
-
- using (Pen marginPen = new Pen(Color.FromArgb(80, KCT.MenuBorder)))
- {
- marginPen.DashPattern = new float[] { 2, 2 };
- g.DrawLine(marginPen, l, y, r, y);
- }
- }
- }
-
- private void DrawToolStripSeparator(Graphics g,
- bool vertical,
- Rectangle rect,
- Color lightColor,
- Color darkColor,
- int horizontalInset,
- bool rtl)
- {
- RectangleF boundsF = new RectangleF(rect.X, rect.Y, rect.Width, rect.Height);
-
- if (vertical)
- {
- int l = rect.Width / 2;
- int t = rect.Y;
-
- // Draw vertical lines centered
- using (LinearGradientBrush lightBrush = new LinearGradientBrush(boundsF, Color.Transparent, lightColor, 90),
- darkBrush = new LinearGradientBrush(boundsF, Color.Transparent, darkColor, 90))
- {
- lightBrush.Blend = _separatorLightBlend;
- darkBrush.Blend = _separatorDarkBlend;
- g.FillRectangle(lightBrush, l - 1, t, 3, rect.Height);
- g.FillRectangle(darkBrush, l, t, 1, rect.Height);
- }
- }
- else
- {
- int l = rect.X;
- int t = rect.Height / 2;
-
- // Draw horizontal lines centered
- using (LinearGradientBrush lightBrush = new LinearGradientBrush(boundsF, Color.Transparent, lightColor, 0f),
- darkBrush = new LinearGradientBrush(boundsF, Color.Transparent, darkColor, 0f))
- {
- lightBrush.Blend = _separatorLightBlend;
- darkBrush.Blend = _separatorDarkBlend;
- g.FillRectangle(lightBrush, l, t - 1, rect.Width, 3);
- g.FillRectangle(darkBrush, l, t, rect.Width, 1);
- }
- }
- }
-
- private static GraphicsPath CreateBorderPath(Rectangle rect,
- Rectangle exclude,
- float cut)
- {
- // If nothing to exclude, then use quicker method
- if (exclude.IsEmpty)
- {
- return CreateBorderPath(rect, cut);
- }
-
- // Drawing lines requires we draw inside the area we want
- rect.Width--;
- rect.Height--;
-
- // Create an array of points to draw lines between
- List pts = new List();
-
- float l = rect.X;
- float t = rect.Y;
- float r = rect.Right;
- float b = rect.Bottom;
- float x0 = rect.X + cut;
- float x3 = rect.Right - cut;
- float y0 = rect.Y + cut;
- float y3 = rect.Bottom - cut;
- float cutBack = (cut == 0f ? 1 : cut);
-
- // Does the exclude intercept the top line
- if ((rect.Y >= exclude.Top) && (rect.Y <= exclude.Bottom))
- {
- float x1 = exclude.X - 1 - cut;
- float x2 = exclude.Right + cut;
-
- if (x0 <= x1)
- {
- pts.Add(new PointF(x0, t));
- pts.Add(new PointF(x1, t));
- pts.Add(new PointF(x1 + cut, t - cutBack));
- }
- else
- {
- x1 = exclude.X - 1;
- pts.Add(new PointF(x1, t));
- pts.Add(new PointF(x1, t - cutBack));
- }
-
- if (x3 > x2)
- {
- pts.Add(new PointF(x2 - cut, t - cutBack));
- pts.Add(new PointF(x2, t));
- pts.Add(new PointF(x3, t));
- }
- else
- {
- x2 = exclude.Right;
- pts.Add(new PointF(x2, t - cutBack));
- pts.Add(new PointF(x2, t));
- }
- }
- else
- {
- pts.Add(new PointF(x0, t));
- pts.Add(new PointF(x3, t));
- }
-
- pts.Add(new PointF(r, y0));
- pts.Add(new PointF(r, y3));
- pts.Add(new PointF(x3, b));
- pts.Add(new PointF(x0, b));
- pts.Add(new PointF(l, y3));
- pts.Add(new PointF(l, y0));
-
- // Create path using a simple set of lines that cut the corner
- GraphicsPath path = new GraphicsPath();
-
- // Add a line between each set of points
- for (int i = 1; i < pts.Count; i++)
- {
- path.AddLine(pts[i - 1], pts[i]);
- }
-
- // Add a line to join the last to the first
- path.AddLine(pts[pts.Count - 1], pts[0]);
-
- return path;
- }
-
- private static GraphicsPath CreateBorderPath(Rectangle rect, float cut)
- {
- // Drawing lines requires we draw inside the area we want
- rect.Width--;
- rect.Height--;
-
- // Create path using a simple set of lines that cut the corner
- GraphicsPath path = new GraphicsPath();
- path.AddLine(rect.Left + cut, rect.Top, rect.Right - cut, rect.Top);
- path.AddLine(rect.Right - cut, rect.Top, rect.Right, rect.Top + cut);
- path.AddLine(rect.Right, rect.Top + cut, rect.Right, rect.Bottom - cut);
- path.AddLine(rect.Right, rect.Bottom - cut, rect.Right - cut, rect.Bottom);
- path.AddLine(rect.Right - cut, rect.Bottom, rect.Left + cut, rect.Bottom);
- path.AddLine(rect.Left + cut, rect.Bottom, rect.Left, rect.Bottom - cut);
- path.AddLine(rect.Left, rect.Bottom - cut, rect.Left, rect.Top + cut);
- path.AddLine(rect.Left, rect.Top + cut, rect.Left + cut, rect.Top);
- return path;
- }
-
- private GraphicsPath CreateInsideBorderPath(Rectangle rect, float cut)
- {
- // Adjust rectangle to be 1 pixel inside the original area
- rect.Inflate(-1, -1);
-
- // Now create a path based on this inner rectangle
- return CreateBorderPath(rect, cut);
- }
-
- private GraphicsPath CreateInsideBorderPath(Rectangle rect,
- Rectangle exclude,
- float cut)
- {
- // Adjust rectangle to be 1 pixel inside the original area
- rect.Inflate(-1, -1);
-
- // Now create a path based on this inner rectangle
- return CreateBorderPath(rect, exclude, cut);
- }
-
- private GraphicsPath CreateClipBorderPath(Rectangle rect, float cut)
- {
- // Clipping happens inside the rect, so make 1 wider and taller
- rect.Width++;
- rect.Height++;
-
- // Now create a path based on this inner rectangle
- return CreateBorderPath(rect, cut);
- }
-
- private GraphicsPath CreateClipBorderPath(Rectangle rect,
- Rectangle exclude,
- float cut)
- {
- // Clipping happens inside the rect, so make 1 wider and taller
- rect.Width++;
- rect.Height++;
-
- // Now create a path based on this inner rectangle
- return CreateBorderPath(rect, exclude, cut);
- }
-
- private GraphicsPath CreateArrowPath(ToolStripItem item,
- Rectangle rect,
- ArrowDirection direction)
- {
- int x, y;
-
- // Find the correct starting position, which depends on direction
- if ((direction == ArrowDirection.Left) ||
- (direction == ArrowDirection.Right))
- {
- x = rect.Right - ((rect.Width - 4) / 2);
- y = rect.Y + (rect.Height / 2);
- }
- else
- {
- x = rect.X + (rect.Width / 2);
- y = rect.Bottom - ((rect.Height - 3) / 2);
-
- // The drop down button is position 1 pixel incorrectly when in RTL
- if ((item is ToolStripDropDownButton) &&
- (item.RightToLeft == RightToLeft.Yes))
- {
- x++;
- }
- }
-
- // Create triangle using a series of lines
- GraphicsPath path = new GraphicsPath();
-
- switch (direction)
- {
- case ArrowDirection.Right:
- path.AddLine(x, y, x - 4, y - 4);
- path.AddLine(x - 4, y - 4, x - 4, y + 4);
- path.AddLine(x - 4, y + 4, x, y);
- break;
- case ArrowDirection.Left:
- path.AddLine(x - 4, y, x, y - 4);
- path.AddLine(x, y - 4, x, y + 4);
- path.AddLine(x, y + 4, x - 4, y);
- break;
- case ArrowDirection.Down:
- path.AddLine(x + 3f, y - 3f, x - 2f, y - 3f);
- path.AddLine(x - 2f, y - 3f, x, y);
- path.AddLine(x, y, x + 3f, y - 3f);
- break;
- case ArrowDirection.Up:
- path.AddLine(x + 3f, y, x - 3f, y);
- path.AddLine(x - 3f, y, x, y - 4f);
- path.AddLine(x, y - 4f, x + 3f, y);
- break;
- }
-
- return path;
- }
-
- private GraphicsPath CreateTickPath(Rectangle rect)
- {
- // Get the center point of the rect
- int x = rect.X + (rect.Width / 2);
- int y = rect.Y + (rect.Height / 2);
-
- GraphicsPath path = new GraphicsPath();
- path.AddLine(x - 4, y, x - 2, y + 4);
- path.AddLine(x - 2, y + 4, x + 3, y - 5);
- return path;
- }
-
- private GraphicsPath CreateIndeterminatePath(Rectangle rect)
- {
- // Get the center point of the rect
- int x = rect.X + (rect.Width / 2);
- int y = rect.Y + (rect.Height / 2);
-
- GraphicsPath path = new GraphicsPath();
- path.AddLine(x - 3, y, x, y - 3);
- path.AddLine(x, y - 3, x + 3, y);
- path.AddLine(x + 3, y, x, y + 3);
- path.AddLine(x, y + 3, x - 3, y);
- return path;
- }
- #endregion
- }
-}
\ No newline at end of file
diff --git a/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/Core/KryptonOffice2013Renderer.cs b/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/Core/KryptonOffice2013Renderer.cs
deleted file mode 100644
index 7ba82da7..00000000
--- a/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/Core/KryptonOffice2013Renderer.cs
+++ /dev/null
@@ -1,1680 +0,0 @@
-using ComponentFactory.Krypton.Toolkit;
-using System;
-using System.Collections.Generic;
-using System.Drawing;
-using System.Drawing.Drawing2D;
-using System.Drawing.Imaging;
-using System.Drawing.Text;
-using System.Windows.Forms;
-
-namespace ExtendedControls.Base.Renderers.Core
-{
- internal class KryptonOffice2013Renderer : KryptonProfessionalRenderer
- {
- #region GradientItemColors
- private abstract class GradientItemColors
- {
- #region Public Fields
- public Color Border1;
- public Color Border2;
- public Color Back1;
- public Color Back2;
- #endregion
-
- #region Identity
- public GradientItemColors()
- {
- }
-
- public GradientItemColors(Color border1, Color border2,
- Color back1, Color back2)
- {
- Border1 = border1;
- Border2 = border2;
- Back1 = back1;
- Back2 = back2;
- }
- #endregion
-
- #region Public
- public virtual void DrawItem(Graphics g, Rectangle rect)
- {
- // Cannot paint a zero sized area
- if ((rect.Width > 0) && (rect.Height > 0))
- {
- // Draw the background of the entire item
- DrawBack(g, rect);
-
- // Draw the border of the entire item
- DrawBorder(g, rect);
- }
- }
-
- public virtual void DrawBorder(Graphics g, Rectangle rect)
- {
- // Drawing with anti aliasing to create smoother appearance
- using (AntiAlias aa = new AntiAlias(g))
- {
- Rectangle backRectI = rect;
- backRectI.Inflate(1, 1);
-
- // Finally draw the border around the menu item
- using (LinearGradientBrush borderBrush = new LinearGradientBrush(backRectI, Border1, Border2, 90f))
- {
- // Convert the brush to a pen for DrawPath call
- using (Pen borderPen = new Pen(borderBrush))
- {
- // Create border path around the entire item
- using (GraphicsPath borderPath = CreateBorderPath(rect, _cutItemMenu))
- {
- g.DrawPath(borderPen, borderPath);
- }
- }
- }
- }
- }
-
- public abstract void DrawBack(Graphics g, Rectangle rect);
- #endregion
- }
-
- private class GradientItemColorsSplit : GradientItemColors
- {
- ///
- /// Initialize a new instance of the GradientItemColorsSplit class.
- ///
- /// Base border color.
- /// Beginning background color.
- /// Ending background color.
- public GradientItemColorsSplit(Color border,
- Color begin,
- Color end)
- {
- // Calculate all colors from the provided parameters
- Border1 = border;
- Border2 = CommonHelper.WhitenColor(border, 0.979f, 0.943f, 1.20f);
- }
-
- public override void DrawBack(Graphics g, Rectangle rect)
- {
- }
- }
-
- private class GradientItemColorsTracking : GradientItemColors
- {
- public Color Back1B;
- public Color Back2B;
-
- ///
- /// Initialize a new instance of the GradientItemColorsTracking class.
- ///
- /// Base border color.
- /// Beginning background color.
- /// Ending background color.
- public GradientItemColorsTracking(Color border,
- Color begin,
- Color end)
- {
- // Calculate all colors from the provided parameters
- Border1 = border;
- Border2 = CommonHelper.WhitenColor(border, 0.979f, 0.943f, 1.20f);
- Back1 = begin;
- Back1B = CommonHelper.WhitenColor(begin, 1.0f, 0.975f, 0.930f);
- Back2 = end;
- Back2B = CommonHelper.WhitenColor(end, 1.0f, 0.953f, 0.758f);
- }
-
- public override void DrawBack(Graphics g, Rectangle rect)
- {
- Rectangle inset = new Rectangle(rect.X + 1, rect.Y + 1, rect.Width - 2, rect.Height - 2);
- Rectangle insetB = new Rectangle(rect.X + 2, rect.Y + 2, rect.Width - 3, rect.Height - 3);
- Rectangle insetC = new Rectangle(rect.X + 2, rect.Y + 2, rect.Width - 4, rect.Height - 4);
-
- using (LinearGradientBrush insideBrush1 = new LinearGradientBrush(rect, Back1B, Back1, 90f),
- insideBrush2 = new LinearGradientBrush(insetB, Back2B, Back2, 90f))
- {
- insideBrush1.SetSigmaBellShape(0.5f);
- insideBrush2.SetSigmaBellShape(0.5f);
-
- g.FillRectangle(insideBrush1, inset);
- using (GraphicsPath borderPath = CreateBorderPath(insetC, _cutInnerItemMenu),
- clipPath = CreateBorderPath(insetB, _cutInnerItemMenu))
- {
- using (Pen insidePen = new Pen(insideBrush2))
- {
- g.DrawPath(insidePen, borderPath);
- }
-
- g.FillPath(insideBrush2, borderPath);
-
- using (Clipping clipping = new Clipping(g, clipPath))
- {
- using (GraphicsPath ellipsePath = new GraphicsPath())
- {
- RectangleF ellipseRect = new RectangleF(-(rect.Width / 2), rect.Bottom - 9, rect.Width * 2, 18);
- PointF ellipseCenter = new PointF(ellipseRect.Left + (ellipseRect.Width / 2), ellipseRect.Top + (ellipseRect.Height / 2));
- ellipsePath.AddEllipse(ellipseRect);
-
- using (PathGradientBrush insideLighten = new PathGradientBrush(ellipsePath))
- {
- insideLighten.CenterPoint = ellipseCenter;
- insideLighten.CenterColor = Color.White;
- insideLighten.SurroundColors = new Color[] { Color.Transparent };
- g.FillPath(insideLighten, ellipsePath);
- }
- }
- }
- }
- }
- }
- }
-
- private class GradientItemColorsDisabled : GradientItemColorsTracking
- {
- ///
- /// Initialize a new instance of the GradientItemColorsDisabled class.
- ///
- /// Base border color.
- /// Beginning background color.
- /// Ending background color.
- public GradientItemColorsDisabled(Color border,
- Color begin,
- Color end)
- : base(border, begin, end)
- {
- // Convert all colors to back and white
- Border1 = CommonHelper.ColorToBlackAndWhite(Border1);
- Border2 = CommonHelper.ColorToBlackAndWhite(Border2);
- Back1 = CommonHelper.ColorToBlackAndWhite(Back1);
- Back1B = CommonHelper.ColorToBlackAndWhite(Back1B);
- Back2 = CommonHelper.ColorToBlackAndWhite(Back2);
- Back2B = CommonHelper.ColorToBlackAndWhite(Back2B);
- }
- }
-
- private class GradientItemColorsPressed : GradientItemColors
- {
- ///
- /// Initialize a new instance of the GradientItemColorsPressed class.
- ///
- /// Base border color.
- /// Beginning background color.
- /// Ending background color.
- public GradientItemColorsPressed(Color border,
- Color begin,
- Color end)
- {
- // Calculate all colors from the provided parameters
- Border1 = CommonHelper.WhitenColor(border, 1.21f, 1.68f, 2.02f);
- Border2 = CommonHelper.WhitenColor(border, 1.21f, 1.25f, 1.22f);
- Back1 = begin;
- }
-
- public override void DrawBack(Graphics g, Rectangle rect)
- {
- Rectangle rect2 = new Rectangle(rect.X + 1, rect.Y + 1, rect.Width - 2, rect.Height - 1);
- Rectangle rect3 = new Rectangle(rect.X + 2, rect.Y + 2, rect.Width - 4, rect.Height - 3);
-
- using (AntiAlias aa = new AntiAlias(g))
- {
- using (GraphicsPath path1 = CreateBorderPath(rect, _cutItemMenu),
- path2 = CreateBorderPath(rect2, _cutItemMenu),
- path3 = CreateBorderPath(rect3, _cutItemMenu))
- {
- using (SolidBrush brush1 = new SolidBrush(CommonHelper.MergeColors(Border1, 0.4f, Back1, 0.6f)),
- brush2 = new SolidBrush(CommonHelper.MergeColors(Border1, 0.2f, Back1, 0.8f)),
- brush3 = new SolidBrush(Back1))
- {
- g.FillPath(brush1, path1);
- g.FillPath(brush2, path2);
- g.FillPath(brush3, path3);
- }
- }
- }
- }
- }
-
- private class GradientItemColorsChecked : GradientItemColors
- {
- ///
- /// Initialize a new instance of the GradientItemColorsChecked class.
- ///
- /// Base border color.
- /// Beginning background color.
- /// Ending background color.
- public GradientItemColorsChecked(Color border,
- Color begin,
- Color end)
- {
- // Calculate all colors from the provided parameters
- Border1 = CommonHelper.WhitenColor(border, 1.21f, 1.44f, 1.81f);
- Border2 = CommonHelper.WhitenColor(border, 1.21f, 1.21f, 1.12f);
- Back1 = begin;
- Back2 = CommonHelper.WhitenColor(begin, 1.0f, 0.943f, .914f);
- }
-
- public override void DrawBack(Graphics g, Rectangle rect)
- {
- Rectangle inset = new Rectangle(rect.X + 1, rect.Y + 1, rect.Width - 2, rect.Height - 2);
- Rectangle insetB = new Rectangle(rect.X + 2, rect.Y + 2, rect.Width - 3, rect.Height - 3);
-
- using (LinearGradientBrush insideBrush = new LinearGradientBrush(rect, Back2, Back1, 90f))
- {
- insideBrush.SetSigmaBellShape(0.5f);
- g.FillRectangle(insideBrush, inset);
-
- using (GraphicsPath borderPath = CreateBorderPath(inset, _cutInnerItemMenu))
- {
- using (GraphicsPath ellipsePath = new GraphicsPath())
- {
- RectangleF ellipseRect = new RectangleF(rect.Left, rect.Bottom - 8, rect.Width, 8);
- PointF ellipseCenter = new PointF(ellipseRect.Left + (ellipseRect.Width / 2), ellipseRect.Top + (ellipseRect.Height / 2));
- ellipsePath.AddEllipse(ellipseRect);
-
- using (PathGradientBrush insideLighten = new PathGradientBrush(ellipsePath))
- {
- insideLighten.CenterPoint = ellipseCenter;
- insideLighten.CenterColor = Color.FromArgb(96, Color.White);
- insideLighten.SurroundColors = new Color[] { Color.Transparent };
- g.FillPath(insideLighten, ellipsePath);
- }
- }
- }
- }
- }
- }
-
- private class GradientItemColorsCheckedTracking : GradientItemColorsTracking
- {
- ///
- /// Initialize a new instance of the GradientItemColorsCheckedTracking class.
- ///
- /// Base border color.
- /// Beginning background color.
- /// Ending background color.
- public GradientItemColorsCheckedTracking(Color border,
- Color begin,
- Color end)
- : base(border, begin, end)
- {
- // Calculate all colors from the provided parameters
- Border1 = CommonHelper.WhitenColor(border, 1.21f, 1.44f, 1.81f);
- Border2 = CommonHelper.WhitenColor(border, 1.21f, 1.21f, 1.12f);
- Back1 = CommonHelper.WhitenColor(begin, 1.0f, 0.953f, 0.822f);
- Back1B = CommonHelper.WhitenColor(begin, 1.0f, 0.923f, 0.669f);
- Back2 = CommonHelper.WhitenColor(end, 1.0f, 0.964f, 1.06f);
- Back2B = CommonHelper.WhitenColor(end, 1.0f, 0.911f, 0.685f);
- }
- }
- #endregion
-
- #region Static Fields
- //private static readonly int _gripOffset = 1;
- private static readonly int _gripSquare = 2;
- private static readonly int _gripSize = 3;
- private static readonly int _gripMove = 4;
- private static readonly int _gripLines = 3;
- private static readonly int _marginInset = 2;
- private static readonly int _checkInset = 1;
- private static readonly int _separatorInset = 31;
- private static readonly float _contextCheckTickThickness = 1.6f;
- private static readonly float _cutContextMenu = 0f;
- private static readonly float _cutItemMenu = 1.7f;
- private static readonly float _cutInnerItemMenu = 1.0f;
- private static readonly float _cutHeaderMenu = 1.0f;
- private static readonly Blend _stripBlend;
- private static readonly Blend _separatorLightBlend;
- private static readonly Blend _separatorDarkBlend;
- private static readonly Color _disabled = Color.FromArgb(167, 167, 167);
- private static GradientItemColors _disabledItem = new GradientItemColorsDisabled(Color.FromArgb(236, 199, 87), Color.FromArgb(251, 242, 215), Color.FromArgb(247, 224, 137));
- #endregion
-
- #region Instance Fields
- private GradientItemColorsSplit _gradientSplit;
- private GradientItemColorsTracking _gradientTracking;
- private GradientItemColorsPressed _gradientPressed;
- private GradientItemColorsChecked _gradientChecked;
- private GradientItemColorsCheckedTracking _gradientCheckedTracking;
- #endregion
-
- #region Identity
- static KryptonOffice2013Renderer()
- {
- _stripBlend = new Blend
- {
- Positions = new float[] { 0.0f, 0.33f, 0.66f, 1.0f },
- Factors = new float[] { 0.0f, 0.5f, 0.8f, 1.0f }
- };
-
- _separatorDarkBlend = new Blend
- {
- Positions = new float[] { 0.0f, 0.5f, 1.0f },
- Factors = new float[] { 0.2f, 1f, 0.2f }
- };
-
- _separatorLightBlend = new Blend
- {
- Positions = new float[] { 0.0f, 0.5f, 1.0f },
- Factors = new float[] { 0.1f, 0.6f, 0.1f }
- };
- }
-
- ///
- /// Initialise a new instance of the KryptonOffice2010Renderer class.
- ///
- /// Source for text colors.
- public KryptonOffice2013Renderer(KryptonColorTable kct)
- : base(kct)
- {
- }
- #endregion
-
- #region OnRenderArrow
- ///
- /// Raises the RenderArrow event.
- ///
- /// An ToolStripArrowRenderEventArgs containing the event data.
- protected override void OnRenderArrow(ToolStripArrowRenderEventArgs e)
- {
- // Cannot paint a zero sized area
- if ((e.ArrowRectangle.Width > 0) &&
- (e.ArrowRectangle.Height > 0))
- {
- // Create a path that is used to fill the arrow
- using (GraphicsPath arrowPath = CreateArrowPath(e.Item,
- e.ArrowRectangle,
- e.Direction))
- {
- // Get the rectangle that encloses the arrow and expand slightly
- // so that the gradient is always within the expanding bounds
- RectangleF boundsF = arrowPath.GetBounds();
- boundsF.Inflate(1f, 1f);
-
- // Set correct color of the arrow
- Color color1;
- Color color2;
- if (!e.Item.Enabled)
- {
- color1 = _disabled;
- color2 = _disabled;
- }
- else
- {
- if (e.Item.Pressed || e.Item.Selected || (e.Item is ToolStripMenuItem))
- {
- color1 = KCT.MenuItemText;
- }
- else
- {
- color1 = KCT.ToolStripText;
- }
-
- color2 = CommonHelper.WhitenColor(color1, 0.7f, 0.7f, 0.7f);
- }
-
- float angle = 0;
-
- // Use gradient angle to match the arrow direction
- switch (e.Direction)
- {
- case ArrowDirection.Right:
- angle = 0;
- break;
- case ArrowDirection.Left:
- angle = 180f;
- break;
- case ArrowDirection.Down:
- angle = 90f;
- break;
- case ArrowDirection.Up:
- angle = 270f;
- break;
- }
-
- // Draw the actual arrow using a gradient
- using (LinearGradientBrush arrowBrush = new LinearGradientBrush(boundsF, color1, color2, angle))
- {
- e.Graphics.FillPath(arrowBrush, arrowPath);
- }
- }
- }
- }
- #endregion
-
- #region OnRenderButtonBackground
- ///
- /// Raises the RenderButtonBackground event.
- ///
- /// An ToolStripItemRenderEventArgs containing the event data.
- protected override void OnRenderButtonBackground(ToolStripItemRenderEventArgs e)
- {
- // Cast to correct type
- ToolStripButton button = (ToolStripButton)e.Item;
-
- if (button.Selected || button.Pressed || button.Checked)
- {
- RenderToolButtonBackground(e.Graphics, button, e.ToolStrip);
- }
- }
- #endregion
-
- #region OnRenderDropDownButtonBackground
- ///
- /// Raises the RenderDropDownButtonBackground event.
- ///
- /// An ToolStripItemRenderEventArgs containing the event data.
- protected override void OnRenderDropDownButtonBackground(ToolStripItemRenderEventArgs e)
- {
- if (e.Item.Selected || e.Item.Pressed)
- {
- RenderToolDropButtonBackground(e.Graphics, e.Item, e.ToolStrip);
- }
- }
- #endregion
-
- #region OnRenderItemCheck
- ///
- /// Raises the RenderItemCheck event.
- ///
- /// An ToolStripItemImageRenderEventArgs containing the event data.
- protected override void OnRenderItemCheck(ToolStripItemImageRenderEventArgs e)
- {
- // Staring size of the checkbox is the image rectangle
- Rectangle checkBox = e.ImageRectangle;
-
- // Make the border of the check box 1 pixel bigger on all sides, as a minimum
- checkBox.Inflate(1, 1);
-
- // Can we extend upwards?
- if (checkBox.Top > _checkInset)
- {
- int diff = checkBox.Top - _checkInset;
- checkBox.Y -= diff;
- checkBox.Height += diff;
- }
-
- // Can we extend downwards?
- if (checkBox.Height <= (e.Item.Bounds.Height - (_checkInset * 2)))
- {
- int diff = e.Item.Bounds.Height - (_checkInset * 2) - checkBox.Height;
- checkBox.Height += diff;
- }
-
- // Drawing with anti aliasing to create smoother appearance
- using (AntiAlias aa = new AntiAlias(e.Graphics))
- {
- // Create border path for the check box
- using (GraphicsPath borderPath = CreateBorderPath(checkBox, _cutItemMenu))
- {
- // Fill the background in a solid color
- using (SolidBrush fillBrush = new SolidBrush(KCT.CheckBackground))
- {
- e.Graphics.FillPath(fillBrush, borderPath);
- }
-
- // Draw the border around the check box
- using (Pen borderPen = new Pen(CommonHelper.WhitenColor(KCT.CheckBackground, 1.05f, 1.52f, 2.75f)))
- {
- e.Graphics.DrawPath(borderPen, borderPath);
- }
-
- // If there is not an image, then we can draw the tick, square etc...
- if (e.Item.Image == null)
- {
- CheckState checkState = CheckState.Unchecked;
-
- // Extract the check state from the item
- if (e.Item is ToolStripMenuItem)
- {
- ToolStripMenuItem item = (ToolStripMenuItem)e.Item;
- checkState = item.CheckState;
- }
-
- // Decide what graphic to draw
- switch (checkState)
- {
- case CheckState.Checked:
- // Create a path for the tick
- using (GraphicsPath tickPath = CreateTickPath(checkBox))
- {
- // Draw the tick with a thickish brush
- using (Pen tickPen = new Pen(CommonHelper.WhitenColor(KCT.CheckBackground, 3.86f, 3.02f, 1.07f), _contextCheckTickThickness))
- {
- e.Graphics.DrawPath(tickPen, tickPath);
- }
- }
- break;
- case CheckState.Indeterminate:
- // Create a path for the indeterminate diamond
- using (GraphicsPath tickPath = CreateIndeterminatePath(checkBox))
- {
- // Draw the tick with a thickish brush
- using (SolidBrush tickBrush = new SolidBrush(CommonHelper.WhitenColor(KCT.CheckBackground, 3.86f, 3.02f, 1.07f)))
- {
- e.Graphics.FillPath(tickBrush, tickPath);
- }
- }
- break;
- }
- }
- }
- }
- }
- #endregion
-
- #region OnRenderItemText
- ///
- /// Raises the RenderItemText event.
- ///
- /// A ToolStripItemTextRenderEventArgs that contains the event data.
- protected override void OnRenderItemText(ToolStripItemTextRenderEventArgs e)
- {
- if ((e.ToolStrip is ToolStrip) ||
- (e.ToolStrip is ContextMenuStrip) ||
- (e.ToolStrip is ToolStripDropDownMenu))
- {
- if (!e.Item.Enabled)
- {
- e.TextColor = _disabled;
- }
- else
- {
- if ((e.ToolStrip is MenuStrip) && !e.Item.Pressed && !e.Item.Selected)
- {
- e.TextColor = KCT.MenuStripText;
- }
- else if (e.ToolStrip is MenuStrip)
- {
- e.TextColor = KCT.MenuItemText;
- }
- else if ((e.ToolStrip is StatusStrip) && !e.Item.Pressed && !e.Item.Selected)
- {
- e.TextColor = KCT.StatusStripText;
- }
- else if ((e.ToolStrip is StatusStrip) && !e.Item.Pressed && e.Item.Selected)
- {
- e.TextColor = KCT.MenuItemText;
- }
- else if ((e.ToolStrip is ToolStrip) && !e.Item.Pressed && e.Item.Selected)
- {
- e.TextColor = KCT.MenuItemText;
- }
- else if ((e.ToolStrip is ContextMenuStrip) && !e.Item.Pressed && !e.Item.Selected)
- {
- e.TextColor = KCT.MenuItemText;
- }
- else if (e.ToolStrip is ToolStripDropDownMenu)
- {
- e.TextColor = KCT.MenuItemText;
- }
- else if ((e.Item is ToolStripButton) && (((ToolStripButton)e.Item).Checked))
- {
- e.TextColor = KCT.MenuItemText;
- }
- else
- {
- e.TextColor = KCT.ToolStripText;
- }
- }
-
- // Status strips under XP cannot use clear type because it ends up being cut off at edges
- if ((e.ToolStrip is StatusStrip) && (Environment.OSVersion.Version.Major < 6))
- {
- base.OnRenderItemText(e);
- }
- else
- {
- using (GraphicsTextHint clearTypeGridFit = new GraphicsTextHint(e.Graphics, TextRenderingHint.ClearTypeGridFit))
- {
- base.OnRenderItemText(e);
- }
- }
- }
- else
- {
- base.OnRenderItemText(e);
- }
- }
- #endregion
-
- #region OnRenderItemImage
- ///
- /// Raises the RenderItemImage event.
- ///
- /// An ToolStripItemImageRenderEventArgs containing the event data.
- protected override void OnRenderItemImage(ToolStripItemImageRenderEventArgs e)
- {
- // We only override the image drawing for context menus
- if ((e.ToolStrip is ContextMenuStrip) ||
- (e.ToolStrip is ToolStripDropDownMenu))
- {
- if (e.Image != null)
- {
- if (e.Item.Enabled)
- {
- e.Graphics.DrawImage(e.Image, e.ImageRectangle);
- }
- else
- {
- using (ImageAttributes attribs = new ImageAttributes())
- {
- attribs.SetColorMatrix(CommonHelper.MatrixDisabled);
-
- // Draw using the disabled matrix to make it look disabled
- e.Graphics.DrawImage(e.Image, e.ImageRectangle,
- 0, 0, e.Image.Width, e.Image.Height,
- GraphicsUnit.Pixel, attribs);
- }
- }
- }
- }
- else
- {
- base.OnRenderItemImage(e);
- }
- }
- #endregion
-
- #region OnRenderMenuItemBackground
- ///
- /// Raises the RenderMenuItemBackground event.
- ///
- /// An ToolStripItemRenderEventArgs containing the event data.
- protected override void OnRenderMenuItemBackground(ToolStripItemRenderEventArgs e)
- {
- if ((e.ToolStrip is MenuStrip) ||
- (e.ToolStrip is ContextMenuStrip) ||
- (e.ToolStrip is ToolStripDropDownMenu))
- {
- if ((e.Item.Pressed) && (e.ToolStrip is MenuStrip))
- {
- // Draw the menu/tool strip as a header for a context menu item
- DrawContextMenuHeader(e.Graphics, e.Item);
- }
- else
- {
- // We only draw a background if the item is selected and enabled
- if (e.Item.Selected)
- {
- if (e.Item.Enabled)
- {
- // Ensure we have cached the objects we need
- UpdateCache();
-
- // Do we draw as a menu strip or context menu item?
- if (e.ToolStrip is MenuStrip)
- {
- DrawGradientToolItem(e.Graphics, e.Item, _gradientTracking);
- }
- else
- {
- DrawGradientContextMenuItem(e.Graphics, e.Item, _gradientTracking);
- }
- }
- else
- {
- // Get the mouse position in tool strip coordinates
- Point mousePos = e.ToolStrip.PointToClient(Control.MousePosition);
-
- // If the mouse is not in the item area, then draw disabled
- if (!e.Item.Bounds.Contains(mousePos))
- {
- // Do we draw as a menu strip or context menu item?
- if (e.ToolStrip is MenuStrip)
- {
- DrawGradientToolItem(e.Graphics, e.Item, _disabledItem);
- }
- else
- {
- DrawGradientContextMenuItem(e.Graphics, e.Item, _disabledItem);
- }
- }
- }
- }
- }
- }
- else
- {
- base.OnRenderMenuItemBackground(e);
- }
- }
- #endregion
-
- #region OnRenderSeparator
- ///
- /// Raises the RenderSeparator event.
- ///
- /// An ToolStripSeparatorRenderEventArgs containing the event data.
- protected override void OnRenderSeparator(ToolStripSeparatorRenderEventArgs e)
- {
- if ((e.ToolStrip is ContextMenuStrip) ||
- (e.ToolStrip is ToolStripDropDownMenu))
- {
- DrawContextMenuSeparator(e.Graphics, e.Vertical, e.Item.Bounds, _separatorInset,
- (e.ToolStrip.RightToLeft == RightToLeft.Yes));
- }
- else
- {
- DrawToolStripSeparator(e.Graphics, e.Vertical, e.Item.Bounds,
- KCT.SeparatorLight, KCT.SeparatorDark, 0, false);
- }
- }
- #endregion
-
- #region OnRenderSplitButtonBackground
- ///
- /// Raises the RenderSplitButtonBackground event.
- ///
- /// An ToolStripItemRenderEventArgs containing the event data.
- protected override void OnRenderSplitButtonBackground(ToolStripItemRenderEventArgs e)
- {
- if (e.Item.Selected || e.Item.Pressed)
- {
- // Cast to correct type
- ToolStripSplitButton splitButton = (ToolStripSplitButton)e.Item;
-
- // Draw the border and background
- RenderToolSplitButtonBackground(e.Graphics, splitButton, e.ToolStrip);
-
- // Get the rectangle that needs to show the arrow
- Rectangle arrowBounds = splitButton.DropDownButtonBounds;
-
- // Draw the arrow on top of the background
- OnRenderArrow(new ToolStripArrowRenderEventArgs(e.Graphics,
- splitButton,
- arrowBounds,
- SystemColors.ControlText,
- ArrowDirection.Down));
- }
- else
- {
- base.OnRenderSplitButtonBackground(e);
- }
- }
- #endregion
-
- #region OnRenderStatusStripSizingGrip
- ///
- /// Raises the RenderStatusStripSizingGrip event.
- ///
- /// An ToolStripRenderEventArgs containing the event data.
- protected override void OnRenderStatusStripSizingGrip(ToolStripRenderEventArgs e)
- {
- using (SolidBrush darkBrush = new SolidBrush(KCT.GripDark),
- lightBrush = new SolidBrush(KCT.GripLight))
- {
- // Do we need to invert the drawing edge?
- bool rtl = (e.ToolStrip.RightToLeft == RightToLeft.Yes);
-
- // Find vertical position of the lowest grip line
- int y = e.AffectedBounds.Bottom - _gripSize * 2;
-
- // Draw three lines of grips
- for (int i = _gripLines; i >= 1; i--)
- {
- // Find the rightmost grip position on the line
- int x = (rtl ? e.AffectedBounds.Left + 1 :
- e.AffectedBounds.Right - _gripSize * 2);
-
- // Draw grips from right to left on line
- for (int j = 0; j < i; j++)
- {
- // Just the single grip glyph
- DrawGripGlyph(e.Graphics, x, y, darkBrush, lightBrush);
-
- // Move left to next grip position
- x -= (rtl ? -_gripMove : _gripMove);
- }
-
- // Move upwards to next grip line
- y -= _gripMove;
- }
- }
- }
- #endregion
-
- #region OnRenderToolStripContentPanelBackground
- ///
- /// Raises the RenderToolStripContentPanelBackground event.
- ///
- /// An ToolStripContentPanelRenderEventArgs containing the event data.
- protected override void OnRenderToolStripContentPanelBackground(ToolStripContentPanelRenderEventArgs e)
- {
- // Must call base class, otherwise the subsequent drawing does not appear!
- base.OnRenderToolStripContentPanelBackground(e);
-
- // Cannot paint a zero sized area
- if ((e.ToolStripContentPanel.Width > 0) &&
- (e.ToolStripContentPanel.Height > 0))
- {
- using (LinearGradientBrush backBrush = new LinearGradientBrush(e.ToolStripContentPanel.ClientRectangle,
- KCT.ToolStripContentPanelGradientEnd,
- KCT.ToolStripContentPanelGradientBegin,
- 90f))
- {
- e.Graphics.FillRectangle(backBrush, e.ToolStripContentPanel.ClientRectangle);
- }
- }
- }
- #endregion
-
- #region OnRenderToolStripBackground
- ///
- /// Raises the RenderToolStripBackground event.
- ///
- /// An ToolStripRenderEventArgs containing the event data.
- protected override void OnRenderToolStripBackground(ToolStripRenderEventArgs e)
- {
- if ((e.ToolStrip is ContextMenuStrip) ||
- (e.ToolStrip is ToolStripDropDownMenu))
- {
- // Make sure the font is current
- if (e.ToolStrip.Font != KCT.MenuStripFont)
- {
- e.ToolStrip.Font = KCT.MenuStripFont;
- }
-
- // Create border and clipping paths
- using (GraphicsPath borderPath = CreateBorderPath(e.AffectedBounds, _cutContextMenu),
- clipPath = CreateClipBorderPath(e.AffectedBounds, _cutContextMenu))
- {
- // Clip all drawing to within the border path
- using (Clipping clipping = new Clipping(e.Graphics, clipPath))
- {
- // Create the background brush
- using (SolidBrush backBrush = new SolidBrush(KCT.ToolStripDropDownBackground))
- {
- e.Graphics.FillPath(backBrush, borderPath);
- }
- }
- }
- }
- else if (e.ToolStrip is StatusStrip)
- {
- // Make sure the font is current
- if (e.ToolStrip.Font != KCT.StatusStripFont)
- {
- e.ToolStrip.Font = KCT.StatusStripFont;
- }
-
- // We do not paint the top two pixel lines, as they are drawn by the status strip border render method
- RectangleF backRect = new RectangleF(0, 1.5f, e.ToolStrip.Width, e.ToolStrip.Height - 2);
-
- // Cannot paint a zero sized area
- if ((backRect.Width > 0) && (backRect.Height > 0))
- {
- //using (LinearGradientBrush backBrush = new LinearGradientBrush(backRect,
- // KCT.StatusStripGradientBegin,
- // KCT.StatusStripGradientEnd,
- // 90f))
- //{
- // backBrush.Blend = _stripBlend;
- // e.Graphics.FillRectangle(backBrush, backRect);
- //}
- using (SolidBrush backBrush = new SolidBrush(KCT.StatusStripGradientEnd))
- {
- e.Graphics.FillRectangle(backBrush, backRect);
- }
- }
- }
- else
- {
- // Make sure the font is current
- if (e.ToolStrip is MenuStrip)
- {
- if (e.ToolStrip.Font != KCT.MenuStripFont)
- {
- e.ToolStrip.Font = KCT.MenuStripFont;
- }
-
- base.OnRenderToolStripBackground(e);
- }
- else
- {
- if (e.ToolStrip.Font != KCT.ToolStripFont)
- {
- e.ToolStrip.Font = KCT.ToolStripFont;
- }
-
- // Cannot paint a zero sized area
- RectangleF backRect = new RectangleF(0, 0, e.ToolStrip.Width, e.ToolStrip.Height);
- if ((backRect.Width > 0) && (backRect.Height > 0))
- {
- if (e.ToolStrip.Orientation == Orientation.Horizontal)
- {
- using (LinearGradientBrush backBrush = new LinearGradientBrush(backRect,
- KCT.ToolStripGradientBegin,
- KCT.ToolStripGradientEnd,
- 90f))
- {
- backBrush.Blend = _stripBlend;
- e.Graphics.FillRectangle(backBrush, backRect);
- }
-
- using (Pen darkBorder = new Pen(KCT.ToolStripBorder),
- lightBorder = new Pen(KCT.ToolStripGradientBegin))
- {
- e.Graphics.DrawLine(lightBorder, 0, 2, 0, e.ToolStrip.Height - 2);
- e.Graphics.DrawLine(lightBorder, e.ToolStrip.Width - 2, 0, e.ToolStrip.Width - 2, e.ToolStrip.Height - 2);
- e.Graphics.DrawLine(darkBorder, e.ToolStrip.Width - 1, 0, e.ToolStrip.Width - 1, e.ToolStrip.Height - 1);
- }
- }
- else
- {
- using (LinearGradientBrush backBrush = new LinearGradientBrush(backRect,
- KCT.ToolStripGradientBegin,
- KCT.ToolStripGradientEnd,
- 0f))
- {
- backBrush.Blend = _stripBlend;
- e.Graphics.FillRectangle(backBrush, backRect);
- }
-
- using (Pen darkBorder = new Pen(KCT.ToolStripBorder),
- lightBorder = new Pen(KCT.ToolStripGradientBegin))
- {
- e.Graphics.DrawLine(lightBorder, 1, 0, e.ToolStrip.Width - 2, 0);
- e.Graphics.DrawLine(lightBorder, 1, e.ToolStrip.Height - 2, e.ToolStrip.Width - 2, e.ToolStrip.Height - 2);
- e.Graphics.DrawLine(darkBorder, e.ToolStrip.Width - 1, 0, e.ToolStrip.Width - 1, e.ToolStrip.Height - 1);
- }
- }
- }
- }
- }
- }
- #endregion
-
- #region OnRenderToolStripBorder
- ///
- /// Raises the RenderToolStripBorder event.
- ///
- /// An ToolStripRenderEventArgs containing the event data.
- protected override void OnRenderToolStripBorder(ToolStripRenderEventArgs e)
- {
- if ((e.ToolStrip is ContextMenuStrip) ||
- (e.ToolStrip is ToolStripDropDownMenu))
- {
- // If there is a connected area to be drawn
- if (!e.ConnectedArea.IsEmpty)
- {
- using (SolidBrush excludeBrush = new SolidBrush(KCT.ToolStripDropDownBackground))
- {
- e.Graphics.FillRectangle(excludeBrush, e.ConnectedArea);
- }
- }
-
- // Create border and clipping paths
- using (GraphicsPath borderPath = CreateBorderPath(e.AffectedBounds, e.ConnectedArea, _cutContextMenu),
- insidePath = CreateInsideBorderPath(e.AffectedBounds, e.ConnectedArea, _cutContextMenu),
- clipPath = CreateClipBorderPath(e.AffectedBounds, e.ConnectedArea, _cutContextMenu))
- {
- // Create the different pen colors we need
- using (Pen borderPen = new Pen(KCT.MenuBorder),
- insidePen = new Pen(KCT.ToolStripDropDownBackground))
- {
- // Clip all drawing to within the border path
- using (Clipping clipping = new Clipping(e.Graphics, clipPath))
- {
- // Drawing with anti aliasing to create smoother appearance
- using (AntiAlias aa = new AntiAlias(e.Graphics))
- {
- // Draw the inside area first
- e.Graphics.DrawPath(insidePen, insidePath);
-
- // Draw the border area second, so any overlapping gives it priority
- e.Graphics.DrawPath(borderPen, borderPath);
- }
-
- // Draw the pixel at the bottom right of the context menu
- e.Graphics.DrawLine(borderPen, e.AffectedBounds.Right, e.AffectedBounds.Bottom,
- e.AffectedBounds.Right - 1, e.AffectedBounds.Bottom - 1);
- }
- }
- }
- }
- else if (e.ToolStrip is StatusStrip)
- {
- // Draw two lines at top of the status strip
- using (Pen darkBorder = new Pen(KCT.ToolStripBorder),
- lightBorder = new Pen(KCT.SeparatorLight))
- {
- e.Graphics.DrawLine(darkBorder, 0, 0, e.ToolStrip.Width - 1, 0);
- e.Graphics.DrawLine(lightBorder, 0, 1, e.ToolStrip.Width - 1, 1);
- }
- }
- else
- {
- base.OnRenderToolStripBorder(e);
- }
- }
- #endregion
-
- #region OnRenderImageMargin
- ///
- /// Raises the RenderImageMargin event.
- ///
- /// An ToolStripRenderEventArgs containing the event data.
- protected override void OnRenderImageMargin(ToolStripRenderEventArgs e)
- {
- if ((e.ToolStrip is ContextMenuStrip) ||
- (e.ToolStrip is ToolStripDropDownMenu))
- {
- // Start with the total margin area
- Rectangle marginRect = e.AffectedBounds;
-
- // Do we need to draw with separator on the opposite edge?
- bool rtl = (e.ToolStrip.RightToLeft == RightToLeft.Yes);
-
- marginRect.Y += _marginInset;
- marginRect.Height -= _marginInset * 2;
-
- // Reduce so it is inside the border
- if (!rtl)
- {
- marginRect.X += _marginInset;
- }
- else
- {
- marginRect.X += _marginInset / 2;
- }
-
- using (Pen marginPen = new Pen(Color.FromArgb(80, KCT.MenuBorder)))
- {
- if (!rtl)
- {
- e.Graphics.DrawLine(marginPen, marginRect.Right, marginRect.Top, marginRect.Right, marginRect.Bottom);
- }
- else
- {
- e.Graphics.DrawLine(marginPen, marginRect.Left - 1, marginRect.Top, marginRect.Left - 1, marginRect.Bottom);
- }
- }
- }
- else
- {
- base.OnRenderImageMargin(e);
- }
- }
- #endregion
-
- #region Implementation
- private void UpdateCache()
- {
- // Only need to create the cache objects first time around
- if (_gradientSplit == null)
- {
- _gradientSplit = new GradientItemColorsSplit(KCT.ButtonSelectedBorder,
- KCT.ButtonSelectedGradientBegin,
- KCT.ButtonSelectedGradientEnd);
-
- _gradientTracking = new GradientItemColorsTracking(KCT.ButtonSelectedBorder,
- KCT.ButtonSelectedGradientBegin,
- KCT.ButtonSelectedGradientEnd);
-
- _gradientPressed = new GradientItemColorsPressed(KCT.ButtonPressedBorder,
- KCT.ButtonPressedGradientBegin,
- KCT.ButtonPressedGradientEnd);
-
- _gradientChecked = new GradientItemColorsChecked(KCT.ButtonPressedBorder,
- KCT.ButtonCheckedGradientBegin,
- KCT.ButtonCheckedGradientEnd);
-
- _gradientCheckedTracking = new GradientItemColorsCheckedTracking(KCT.ButtonSelectedBorder,
- KCT.ButtonPressedGradientBegin,
- KCT.ButtonCheckedGradientEnd);
- }
- }
-
- private void RenderToolButtonBackground(Graphics g,
- ToolStripButton button,
- ToolStrip toolstrip)
- {
- // We only draw a background if the item is selected or being pressed
- if (button.Enabled)
- {
- // Ensure we have cached the objects we need
- UpdateCache();
-
- if (button.Checked)
- {
- if (button.Pressed)
- {
- DrawGradientToolItem(g, button, _gradientPressed);
- }
- else if (button.Selected)
- {
- DrawGradientToolItem(g, button, _gradientCheckedTracking);
- }
- else
- {
- DrawGradientToolItem(g, button, _gradientChecked);
- }
- }
- else
- {
- if (button.Pressed)
- {
- DrawGradientToolItem(g, button, _gradientPressed);
- }
- else if (button.Selected)
- {
- DrawGradientToolItem(g, button, _gradientTracking);
- }
- }
- }
- else
- {
- if (button.Selected)
- {
- // Get the mouse position in tool strip coordinates
- Point mousePos = toolstrip.PointToClient(Control.MousePosition);
-
- // If the mouse is not in the item area, then draw disabled
- if (!button.Bounds.Contains(mousePos))
- {
- DrawGradientToolItem(g, button, _disabledItem);
- }
- }
- }
- }
-
- private void RenderToolDropButtonBackground(Graphics g,
- ToolStripItem item,
- ToolStrip toolstrip)
- {
- // We only draw a background if the item is selected or being pressed
- if (item.Selected || item.Pressed)
- {
- if (item.Enabled)
- {
- if (item.Pressed)
- {
- DrawContextMenuHeader(g, item);
- }
- else
- {
- // Ensure we have cached the objects we need
- UpdateCache();
-
- DrawGradientToolItem(g, item, _gradientTracking);
- }
- }
- else
- {
- // Get the mouse position in tool strip coordinates
- Point mousePos = toolstrip.PointToClient(Control.MousePosition);
-
- // If the mouse is not in the item area, then draw disabled
- if (!item.Bounds.Contains(mousePos))
- {
- DrawGradientToolItem(g, item, _disabledItem);
- }
- }
- }
- }
-
- private void DrawGradientToolSplitItem(Graphics g,
- ToolStripSplitButton splitButton,
- GradientItemColors colorsButton,
- GradientItemColors colorsDrop,
- GradientItemColors colorsSplit)
- {
- // Create entire area and just the drop button area rectangles
- Rectangle backRect = new Rectangle(Point.Empty, splitButton.Bounds.Size);
- Rectangle backRectDrop = splitButton.DropDownButtonBounds;
-
- // Cannot paint zero sized areas
- if ((backRect.Width > 0) && (backRectDrop.Width > 0) &&
- (backRect.Height > 0) && (backRectDrop.Height > 0))
- {
- // Area that is the normal button starts as everything
- Rectangle backRectButton = backRect;
-
- // The X offset to draw the split line
- int splitOffset;
-
- // Is the drop button on the right hand side of entire area?
- if (backRectDrop.X > 0)
- {
- backRectButton.Width = backRectDrop.Left;
- backRectDrop.X -= 1;
- backRectDrop.Width++;
- splitOffset = backRectDrop.X;
- }
- else
- {
- backRectButton.Width -= backRectDrop.Width - 2;
- backRectButton.X = backRectDrop.Right - 1;
- backRectDrop.Width++;
- splitOffset = backRectDrop.Right - 1;
- }
-
- // Create border path around the item
- using (GraphicsPath borderPath = CreateBorderPath(backRect, _cutItemMenu))
- {
- // Draw the normal button area background
- colorsButton.DrawBack(g, backRectButton);
-
- // Draw the drop button area background
- colorsDrop.DrawBack(g, backRectDrop);
-
- // Draw the split line between the areas
- using (LinearGradientBrush splitBrush = new LinearGradientBrush(new Rectangle(backRect.X + splitOffset, backRect.Top, 1, backRect.Height + 1),
- colorsSplit.Border1, colorsSplit.Border2, 90f))
- {
- // Convert the brush to a pen for DrawPath call
- using (Pen splitPen = new Pen(splitBrush))
- {
- g.DrawLine(splitPen, backRect.X + splitOffset, backRect.Top + 1, backRect.X + splitOffset, backRect.Bottom - 1);
- }
- }
-
- // Draw the border of the entire item
- colorsButton.DrawBorder(g, backRect);
- }
- }
- }
-
- private void DrawContextMenuHeader(Graphics g, ToolStripItem item)
- {
- // Get the rectangle that is the items area
- Rectangle itemRect = new Rectangle(Point.Empty, item.Bounds.Size);
-
- // Create border and clipping paths
- using (GraphicsPath borderPath = CreateBorderPath(itemRect, _cutHeaderMenu),
- insidePath = CreateInsideBorderPath(itemRect, _cutHeaderMenu),
- clipPath = CreateClipBorderPath(itemRect, _cutHeaderMenu))
- {
- // Clip all drawing to within the border path
- using (Clipping clipping = new Clipping(g, clipPath))
- {
- // Draw the entire background area first
- using (SolidBrush backBrush = new SolidBrush(KCT.ToolStripDropDownBackground))
- {
- g.FillPath(backBrush, borderPath);
- }
-
- // Draw the border
- using (Pen borderPen = new Pen(KCT.MenuBorder))
- {
- g.DrawPath(borderPen, borderPath);
- }
- }
- }
- }
-
- private void DrawGradientToolItem(Graphics g,
- ToolStripItem item,
- GradientItemColors colors)
- {
- // Perform drawing into the entire background of the item
- colors.DrawItem(g, new Rectangle(Point.Empty, item.Bounds.Size));
- }
-
- private void RenderToolSplitButtonBackground(Graphics g,
- ToolStripSplitButton splitButton,
- ToolStrip toolstrip)
- {
- // We only draw a background if the item is selected or being pressed
- if (splitButton.Selected || splitButton.Pressed)
- {
- if (splitButton.Enabled)
- {
- // Ensure we have cached the objects we need
- UpdateCache();
-
- if (!splitButton.Pressed && splitButton.ButtonPressed)
- {
- DrawGradientToolSplitItem(g, splitButton, _gradientPressed, _gradientTracking, _gradientSplit);
- }
- else if (splitButton.Pressed && !splitButton.ButtonPressed)
- {
- DrawContextMenuHeader(g, splitButton);
- }
- else
- {
- DrawGradientToolSplitItem(g, splitButton, _gradientTracking, _gradientTracking, _gradientSplit);
- }
- }
- else
- {
- // Get the mouse position in tool strip coordinates
- Point mousePos = toolstrip.PointToClient(Control.MousePosition);
-
- // If the mouse is not in the item area, then draw disabled
- if (!splitButton.Bounds.Contains(mousePos))
- {
- DrawGradientToolItem(g, splitButton, _disabledItem);
- }
- }
- }
-
- }
-
- private void DrawGradientContextMenuItem(Graphics g,
- ToolStripItem item,
- GradientItemColors colors)
- {
- // Do we need to draw with separator on the opposite edge?
- Rectangle backRect = new Rectangle(2, 0, item.Bounds.Width - 3, item.Bounds.Height);
-
- // Perform actual drawing into the background
- colors.DrawItem(g, backRect);
- }
-
- private void DrawGripGlyph(Graphics g,
- int x,
- int y,
- Brush darkBrush,
- Brush lightBrush)
- {
- //g.FillRectangle(lightBrush, x + _gripOffset, y + _gripOffset, _gripSquare, _gripSquare);
- g.FillRectangle(darkBrush, x, y, _gripSquare, _gripSquare);
- }
-
- private void DrawContextMenuSeparator(Graphics g,
- bool vertical,
- Rectangle rect,
- int horizontalInset,
- bool rtl)
- {
- if (vertical)
- {
- int l = rect.Width / 2;
- int t = rect.Y;
- int b = rect.Bottom;
-
- using (Pen marginPen = new Pen(Color.FromArgb(80, KCT.MenuBorder)))
- {
- marginPen.DashPattern = new float[] { 2, 2 };
- g.DrawLine(marginPen, l, t, l, b);
- }
- }
- else
- {
- int y = rect.Height / 2;
- int l = rect.X + (rtl ? 0 : horizontalInset);
- int r = rect.Right - (rtl ? horizontalInset : 0);
-
- using (Pen marginPen = new Pen(Color.FromArgb(80, KCT.MenuBorder)))
- {
- marginPen.DashPattern = new float[] { 2, 2 };
- g.DrawLine(marginPen, l, y, r, y);
- }
- }
- }
-
- private void DrawToolStripSeparator(Graphics g,
- bool vertical,
- Rectangle rect,
- Color lightColor,
- Color darkColor,
- int horizontalInset,
- bool rtl)
- {
- RectangleF boundsF = new RectangleF(rect.X, rect.Y, rect.Width, rect.Height);
-
- if (vertical)
- {
- int l = rect.Width / 2;
- int t = rect.Y;
-
- // Draw vertical lines centered
- using (LinearGradientBrush lightBrush = new LinearGradientBrush(boundsF, Color.Transparent, lightColor, 90),
- darkBrush = new LinearGradientBrush(boundsF, Color.Transparent, darkColor, 90))
- {
- lightBrush.Blend = _separatorLightBlend;
- darkBrush.Blend = _separatorDarkBlend;
- g.FillRectangle(lightBrush, l - 1, t, 3, rect.Height);
- g.FillRectangle(darkBrush, l, t, 1, rect.Height);
- }
- }
- else
- {
- int l = rect.X;
- int t = rect.Height / 2;
-
- // Draw horizontal lines centered
- using (LinearGradientBrush lightBrush = new LinearGradientBrush(boundsF, Color.Transparent, lightColor, 0f),
- darkBrush = new LinearGradientBrush(boundsF, Color.Transparent, darkColor, 0f))
- {
- lightBrush.Blend = _separatorLightBlend;
- darkBrush.Blend = _separatorDarkBlend;
- g.FillRectangle(lightBrush, l, t - 1, rect.Width, 3);
- g.FillRectangle(darkBrush, l, t, rect.Width, 1);
- }
- }
- }
-
- private static GraphicsPath CreateBorderPath(Rectangle rect,
- Rectangle exclude,
- float cut)
- {
- // If nothing to exclude, then use quicker method
- if (exclude.IsEmpty)
- {
- return CreateBorderPath(rect, cut);
- }
-
- // Drawing lines requires we draw inside the area we want
- rect.Width--;
- rect.Height--;
-
- // Create an array of points to draw lines between
- List pts = new List();
-
- float l = rect.X;
- float t = rect.Y;
- float r = rect.Right;
- float b = rect.Bottom;
- float x0 = rect.X + cut;
- float x3 = rect.Right - cut;
- float y0 = rect.Y + cut;
- float y3 = rect.Bottom - cut;
- float cutBack = (cut == 0f ? 1 : cut);
-
- // Does the exclude intercept the top line
- if ((rect.Y >= exclude.Top) && (rect.Y <= exclude.Bottom))
- {
- float x1 = exclude.X - 1 - cut;
- float x2 = exclude.Right + cut;
-
- if (x0 <= x1)
- {
- pts.Add(new PointF(x0, t));
- pts.Add(new PointF(x1, t));
- pts.Add(new PointF(x1 + cut, t - cutBack));
- }
- else
- {
- x1 = exclude.X - 1;
- pts.Add(new PointF(x1, t));
- pts.Add(new PointF(x1, t - cutBack));
- }
-
- if (x3 > x2)
- {
- pts.Add(new PointF(x2 - cut, t - cutBack));
- pts.Add(new PointF(x2, t));
- pts.Add(new PointF(x3, t));
- }
- else
- {
- x2 = exclude.Right;
- pts.Add(new PointF(x2, t - cutBack));
- pts.Add(new PointF(x2, t));
- }
- }
- else
- {
- pts.Add(new PointF(x0, t));
- pts.Add(new PointF(x3, t));
- }
-
- pts.Add(new PointF(r, y0));
- pts.Add(new PointF(r, y3));
- pts.Add(new PointF(x3, b));
- pts.Add(new PointF(x0, b));
- pts.Add(new PointF(l, y3));
- pts.Add(new PointF(l, y0));
-
- // Create path using a simple set of lines that cut the corner
- GraphicsPath path = new GraphicsPath();
-
- // Add a line between each set of points
- for (int i = 1; i < pts.Count; i++)
- {
- path.AddLine(pts[i - 1], pts[i]);
- }
-
- // Add a line to join the last to the first
- path.AddLine(pts[pts.Count - 1], pts[0]);
-
- return path;
- }
-
- private static GraphicsPath CreateBorderPath(Rectangle rect, float cut)
- {
- // Drawing lines requires we draw inside the area we want
- rect.Width--;
- rect.Height--;
-
- // Create path using a simple set of lines that cut the corner
- GraphicsPath path = new GraphicsPath();
- path.AddLine(rect.Left + cut, rect.Top, rect.Right - cut, rect.Top);
- path.AddLine(rect.Right - cut, rect.Top, rect.Right, rect.Top + cut);
- path.AddLine(rect.Right, rect.Top + cut, rect.Right, rect.Bottom - cut);
- path.AddLine(rect.Right, rect.Bottom - cut, rect.Right - cut, rect.Bottom);
- path.AddLine(rect.Right - cut, rect.Bottom, rect.Left + cut, rect.Bottom);
- path.AddLine(rect.Left + cut, rect.Bottom, rect.Left, rect.Bottom - cut);
- path.AddLine(rect.Left, rect.Bottom - cut, rect.Left, rect.Top + cut);
- path.AddLine(rect.Left, rect.Top + cut, rect.Left + cut, rect.Top);
- return path;
- }
-
- private GraphicsPath CreateInsideBorderPath(Rectangle rect, float cut)
- {
- // Adjust rectangle to be 1 pixel inside the original area
- rect.Inflate(-1, -1);
-
- // Now create a path based on this inner rectangle
- return CreateBorderPath(rect, cut);
- }
-
- private GraphicsPath CreateInsideBorderPath(Rectangle rect,
- Rectangle exclude,
- float cut)
- {
- // Adjust rectangle to be 1 pixel inside the original area
- rect.Inflate(-1, -1);
-
- // Now create a path based on this inner rectangle
- return CreateBorderPath(rect, exclude, cut);
- }
-
- private GraphicsPath CreateClipBorderPath(Rectangle rect, float cut)
- {
- // Clipping happens inside the rect, so make 1 wider and taller
- rect.Width++;
- rect.Height++;
-
- // Now create a path based on this inner rectangle
- return CreateBorderPath(rect, cut);
- }
-
- private GraphicsPath CreateClipBorderPath(Rectangle rect,
- Rectangle exclude,
- float cut)
- {
- // Clipping happens inside the rect, so make 1 wider and taller
- rect.Width++;
- rect.Height++;
-
- // Now create a path based on this inner rectangle
- return CreateBorderPath(rect, exclude, cut);
- }
-
- private GraphicsPath CreateArrowPath(ToolStripItem item,
- Rectangle rect,
- ArrowDirection direction)
- {
- int x, y;
-
- // Find the correct starting position, which depends on direction
- if ((direction == ArrowDirection.Left) ||
- (direction == ArrowDirection.Right))
- {
- x = rect.Right - (rect.Width - 4) / 2;
- y = rect.Y + rect.Height / 2;
- }
- else
- {
- x = rect.X + rect.Width / 2;
- y = rect.Bottom - (rect.Height - 3) / 2;
-
- // The drop down button is position 1 pixel incorrectly when in RTL
- if ((item is ToolStripDropDownButton) &&
- (item.RightToLeft == RightToLeft.Yes))
- {
- x++;
- }
- }
-
- // Create triangle using a series of lines
- GraphicsPath path = new GraphicsPath();
-
- switch (direction)
- {
- case ArrowDirection.Right:
- path.AddLine(x, y, x - 4, y - 4);
- path.AddLine(x - 4, y - 4, x - 4, y + 4);
- path.AddLine(x - 4, y + 4, x, y);
- break;
- case ArrowDirection.Left:
- path.AddLine(x - 4, y, x, y - 4);
- path.AddLine(x, y - 4, x, y + 4);
- path.AddLine(x, y + 4, x - 4, y);
- break;
- case ArrowDirection.Down:
- path.AddLine(x + 3f, y - 3f, x - 2f, y - 3f);
- path.AddLine(x - 2f, y - 3f, x, y);
- path.AddLine(x, y, x + 3f, y - 3f);
- break;
- case ArrowDirection.Up:
- path.AddLine(x + 3f, y, x - 3f, y);
- path.AddLine(x - 3f, y, x, y - 4f);
- path.AddLine(x, y - 4f, x + 3f, y);
- break;
- }
-
- return path;
- }
-
- private GraphicsPath CreateTickPath(Rectangle rect)
- {
- // Get the center point of the rect
- int x = rect.X + rect.Width / 2;
- int y = rect.Y + rect.Height / 2;
-
- GraphicsPath path = new GraphicsPath();
- path.AddLine(x - 4, y, x - 2, y + 4);
- path.AddLine(x - 2, y + 4, x + 3, y - 5);
- return path;
- }
-
- private GraphicsPath CreateIndeterminatePath(Rectangle rect)
- {
- // Get the center point of the rect
- int x = rect.X + rect.Width / 2;
- int y = rect.Y + rect.Height / 2;
-
- GraphicsPath path = new GraphicsPath();
- path.AddLine(x - 3, y, x, y - 3);
- path.AddLine(x, y - 3, x + 3, y);
- path.AddLine(x + 3, y, x, y + 3);
- path.AddLine(x, y + 3, x - 3, y);
- return path;
- }
- #endregion
- }
-}
\ No newline at end of file
diff --git a/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/Core/KryptonProfessionalRenderer.cs b/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/Core/KryptonProfessionalRenderer.cs
deleted file mode 100644
index e3a258cd..00000000
--- a/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/Core/KryptonProfessionalRenderer.cs
+++ /dev/null
@@ -1,141 +0,0 @@
-using ComponentFactory.Krypton.Toolkit;
-using System;
-using System.Diagnostics;
-using System.Drawing;
-using System.Drawing.Imaging;
-using System.Reflection;
-using System.Windows.Forms;
-
-namespace ExtendedControls.Base.Renderers.Core
-{
- internal class KryptonProfessionalRenderer : ToolStripProfessionalRenderer
- {
- #region Instance Fields
-
- #endregion
-
- #region Identity
- ///
- /// Initialise a new instance of the KryptonProfessionalRenderer class.
- ///
- /// Source for text colors.
- public KryptonProfessionalRenderer(KryptonColorTable kct)
- : base(kct)
- {
- Debug.Assert(kct != null);
- KCT = kct;
- }
- #endregion
-
- #region KCT
- ///
- /// Gets access to the KryptonColorTable instance.
- ///
- public KryptonColorTable KCT { get; }
-
- #endregion
-
- #region OnRenderItemImage
- ///
- /// Raises the RenderItemImage event.
- ///
- /// An ToolStripItemImageRenderEventArgs containing the event data.
- protected override void OnRenderItemImage(ToolStripItemImageRenderEventArgs e)
- {
- // Is this a min/restore/close pendant button
- if (e.Item.GetType().ToString() == "System.Windows.Forms.MdiControlStrip+ControlBoxMenuItem")
- {
- // Get access to the owning form of the mdi control strip
- if (e.ToolStrip.Parent.TopLevelControl is Form f)
- {
- // Get the mdi control strip instance
- PropertyInfo piMCS = typeof(Form).GetProperty("MdiControlStrip", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.GetField);
- if (piMCS != null)
- {
- object mcs = piMCS.GetValue(f, null);
- if (mcs != null)
- {
- // Get the min/restore/close internal menu items
- Type mcsType = mcs.GetType();
- FieldInfo fiM = mcsType.GetField("minimize", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.GetField);
- FieldInfo fiR = mcsType.GetField("restore", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.GetField);
- FieldInfo fiC = mcsType.GetField("close", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.GetField);
- if ((fiM != null) && (fiR != null) && (fiC != null))
- {
- ToolStripMenuItem m = fiM.GetValue(mcs) as ToolStripMenuItem;
- ToolStripMenuItem r = fiR.GetValue(mcs) as ToolStripMenuItem;
- ToolStripMenuItem c = fiC.GetValue(mcs) as ToolStripMenuItem;
- if ((m != null) && (r != null) && (c != null))
- {
- // Compare the event provided image with the internal cached ones to discover the type of pendant button we are drawing
- PaletteButtonSpecStyle specStyle = PaletteButtonSpecStyle.Generic;
- if (m.Image == e.Image)
- {
- specStyle = PaletteButtonSpecStyle.PendantMin;
- }
- else if (r.Image == e.Image)
- {
- specStyle = PaletteButtonSpecStyle.PendantRestore;
- }
- else if (c.Image == e.Image)
- {
- specStyle = PaletteButtonSpecStyle.PendantClose;
- }
-
- // A match, means we have a known pendant button
- if (specStyle != PaletteButtonSpecStyle.Generic)
- {
- // Grab the palette pendant details needed for drawing
- Image paletteImage = KCT.Palette.GetButtonSpecImage(specStyle, PaletteState.Normal);
- Color transparentColor = KCT.Palette.GetButtonSpecImageTransparentColor(specStyle);
-
- // Finally we actually have an image to draw!
- if (paletteImage != null)
- {
- using (ImageAttributes attribs = new ImageAttributes())
- {
- // Setup mapping to make required color transparent
- ColorMap remap = new ColorMap
- {
- OldColor = transparentColor,
- NewColor = Color.Transparent
- };
- attribs.SetRemapTable(new ColorMap[] { remap });
-
- // Phew, actually draw the darn thing
- e.Graphics.DrawImage(paletteImage, e.ImageRectangle,
- 0, 0, e.Image.Width, e.Image.Height,
- GraphicsUnit.Pixel, attribs);
-
- // Do not let base class draw system defined image
- return;
- }
- }
- }
- }
- }
- }
- }
- }
- }
-
- base.OnRenderItemImage(e);
- }
- #endregion
-
- #region OnRenderToolStripBorder
- ///
- /// Raises the RenderToolStripBorder event.
- ///
- /// An ToolStripRenderEventArgs containing the event data.
- protected override void OnRenderToolStripBorder(ToolStripRenderEventArgs e)
- {
- // D0 not draw the annoying status strip single line that is not needed
- if (!(e.ToolStrip is StatusStrip))
- {
- base.OnRenderToolStripBorder(e);
- }
- }
- #endregion
- }
-}
\ No newline at end of file
diff --git a/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/Core/KryptonSparkleRenderer.cs b/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/Core/KryptonSparkleRenderer.cs
deleted file mode 100644
index c5c9c986..00000000
--- a/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/Core/KryptonSparkleRenderer.cs
+++ /dev/null
@@ -1,1498 +0,0 @@
-using ComponentFactory.Krypton.Toolkit;
-using System;
-using System.Collections.Generic;
-using System.Drawing;
-using System.Drawing.Drawing2D;
-using System.Drawing.Imaging;
-using System.Drawing.Text;
-using System.Windows.Forms;
-
-namespace ExtendedControls.Base.Renderers.Core
-{
- internal class KryptonSparkleRenderer : KryptonProfessionalRenderer
- {
- #region LinearItemColors
- private class LinearItemColors
- {
- #region Public Fields
- public readonly Color Fill1;
- public readonly Color Fill2;
- public readonly Color Border;
- #endregion
-
- #region Identity
- public LinearItemColors()
- {
- }
-
- public LinearItemColors(Color fill1, Color fill2, Color border)
- {
- Fill1 = fill1;
- Fill2 = fill2;
- Border = border;
- }
- #endregion
- }
-
- private class GradientItemColors
- {
- #region Public Fields
- public readonly Color Border;
- public readonly Color Begin;
- public readonly Color End;
- #endregion
-
- #region Identity
- public GradientItemColors()
- {
- }
-
- public GradientItemColors(Color border,
- Color begin,
- Color end)
- {
- Border = border;
- Begin = begin;
- End = end;
- }
- #endregion
- }
- #endregion
-
- #region Static Fields
-
- private const int GRIP_OFFSET = 1;
- private const int GRIP_SQUARE = 2;
- private const int GRIP_SIZE = 3;
- private const int GRIP_MOVE = 4;
- private const int GRIP_LINES = 3;
- private const int MARGIN_INSET = 2;
- private const int CHECK_INSET = 1;
- private const int SEPARATOR_INSET = 24;
- private const float CUT_CONTEXT_MENU = 0f;
- private const float CUT_MENU_ITEM_BACK = 1.2f;
- private const float CUT_TOOL_ITEM_MENU = 1.0f;
- private static readonly Blend _statusStripBlend;
- private static readonly Color _disabled = Color.FromArgb(167, 167, 167);
- private static readonly LinearItemColors _disabledLinearItem = new LinearItemColors(Color.FromArgb(128, 220, 220, 220), Color.FromArgb(128, 190, 190, 190), Color.FromArgb(128, 172, 172, 172));
- private static readonly GradientItemColors _disabledGradientItem = new GradientItemColors(Color.FromArgb(212, 212, 212), Color.FromArgb(235, 235, 235), Color.FromArgb(235, 235, 235));
- private static readonly Image _contextMenuChecked = Properties.Resources.SparkleGrayChecked;
- private static readonly Image _contextMenuIndeterminate = Properties.Resources.SparkleGrayIndeterminate;
- #endregion
-
- #region Instance Fields
- private LinearItemColors _linearItem;
- private GradientItemColors _gradientItem;
- private GradientItemColors _gradientTracking;
- private GradientItemColors _gradientPressed;
- private GradientItemColors _gradientChecked;
- private GradientItemColors _gradientCheckedTracking;
- #endregion
-
- #region Identity
- static KryptonSparkleRenderer()
- {
- // One time creation of the blend for the status strip gradient brush
- _statusStripBlend = new Blend
- {
- Factors = new float[] { 0.0f, 0.0f, 0.0f, 1.0f },
- Positions = new float[] { 0.0f, 0.33f, 0.33f, 1.0f }
- };
- }
-
- ///
- /// Initialise a new instance of the KryptonSparkleRenderer class.
- ///
- /// Source for text colors.
- public KryptonSparkleRenderer(KryptonColorTable kct)
- : base(kct)
- {
- }
- #endregion
-
- #region OnRenderArrow
- ///
- /// Raises the RenderArrow event.
- ///
- /// An ToolStripArrowRenderEventArgs containing the event data.
- protected override void OnRenderArrow(ToolStripArrowRenderEventArgs e)
- {
- // Cannot paint a zero sized area
- if ((e.ArrowRectangle.Width > 0) &&
- (e.ArrowRectangle.Height > 0))
- {
- // Create a path that is used to fill the arrow
- using (GraphicsPath arrowPath = CreateArrowPath(e.Item,
- e.ArrowRectangle,
- e.Direction))
- {
- // Get the rectangle that encloses the arrow and expand slightly
- // so that the gradient is always within the expanding bounds
- RectangleF boundsF = arrowPath.GetBounds();
- boundsF.Inflate(1f, 1f);
-
- // Default to disabled
- Color color1 = _disabled;
- Color color2 = _disabled;
-
- // If not disabled then need to decide on actual colors
- if (e.Item.Enabled)
- {
- // If the arrow is on a context menu
- if ((e.Item.Owner is ContextMenuStrip) ||
- (e.Item.Owner is ToolStripDropDownMenu) ||
- (e.Item.OwnerItem is ToolStripOverflowButton))
- {
- if (((e.Item.Owner is ContextMenuStrip) || (e.Item.Owner is ToolStripDropDownMenu)) ||
- ((e.Item.OwnerItem is ToolStripOverflowButton) && ((e.Item is ToolStripSplitButton) || (e.Item is ToolStripDropDownButton)) && (!e.Item.Selected || e.Item.Pressed)))
- {
- color1 = KCT.MenuItemText;
- }
- else
- {
- color1 = KCT.ToolStripText;
- }
-
- color2 = color1;
- }
- else
- {
- if ((e.Item.Owner is ToolStrip) ||
- (e.Item.Owner is StatusStrip))
- {
- if (((e.Item is ToolStripSplitButton) || (e.Item is ToolStripDropDownButton)) && e.Item.Pressed)
- {
- color1 = KCT.MenuItemText;
- }
- else
- {
- color1 = KCT.ToolStripText;
- }
-
- color2 = color1;
- }
- }
- }
-
- float angle = 0;
-
- // Use gradient angle to match the arrow direction
- switch (e.Direction)
- {
- case ArrowDirection.Right:
- angle = 0;
- break;
- case ArrowDirection.Left:
- angle = 180f;
- break;
- case ArrowDirection.Down:
- angle = 90f;
- break;
- case ArrowDirection.Up:
- angle = 270f;
- break;
- }
-
- // Draw the actual arrow using a gradient
- using (LinearGradientBrush arrowBrush = new LinearGradientBrush(boundsF, color1, color2, angle))
- {
- e.Graphics.FillPath(arrowBrush, arrowPath);
- }
- }
- }
- }
- #endregion
-
- #region OnRenderButtonBackground
- ///
- /// Raises the RenderButtonBackground event.
- ///
- /// An ToolStripItemRenderEventArgs containing the event data.
- protected override void OnRenderButtonBackground(ToolStripItemRenderEventArgs e)
- {
- // Cast to correct type
- ToolStripButton button = (ToolStripButton)e.Item;
-
- if (button.Selected || button.Pressed || button.Checked)
- {
- RenderToolButtonBackground(e.Graphics, button, e.ToolStrip);
- }
- }
- #endregion
-
- #region OnRenderDropDownButtonBackground
- ///
- /// Raises the RenderDropDownButtonBackground event.
- ///
- /// An ToolStripItemRenderEventArgs containing the event data.
- protected override void OnRenderDropDownButtonBackground(ToolStripItemRenderEventArgs e)
- {
- if (e.Item.Selected || e.Item.Pressed)
- {
- RenderToolDropButtonBackground(e.Graphics, e.Item, e.ToolStrip);
- }
- }
- #endregion
-
- #region OnRenderItemCheck
- ///
- /// Raises the RenderItemCheck event.
- ///
- /// An ToolStripItemImageRenderEventArgs containing the event data.
- protected override void OnRenderItemCheck(ToolStripItemImageRenderEventArgs e)
- {
- // Staring size of the checkbox is the image rectangle
- Rectangle checkBox = e.ImageRectangle;
-
- // Make the border of the check box 1 pixel bigger on all sides, as a minimum
- checkBox.Inflate(1, 1);
-
- // Can we extend upwards?
- if (checkBox.Top > CHECK_INSET)
- {
- int diff = checkBox.Top - CHECK_INSET;
- checkBox.Y -= diff;
- checkBox.Height += diff;
- }
-
- // Can we extend downwards?
- if (checkBox.Height <= (e.Item.Bounds.Height - (CHECK_INSET * 2)))
- {
- int diff = e.Item.Bounds.Height - (CHECK_INSET * 2) - checkBox.Height;
- checkBox.Height += diff;
- }
-
- // Drawing with anti aliasing to create smoother appearance
- using (AntiAlias aa = new AntiAlias(e.Graphics))
- {
- // Create border path for the check box
- using (GraphicsPath borderPath = CreateBorderPath(checkBox, CUT_MENU_ITEM_BACK))
- {
- Color colorFill = KCT.CheckBackground;
- Color colorBorder = CommonHelper.BlackenColor(KCT.CheckBackground, 0.89f, 0.88f, 0.98f);
- if (!e.Item.Enabled)
- {
- colorFill = CommonHelper.ColorToBlackAndWhite(colorFill);
- colorBorder = CommonHelper.ColorToBlackAndWhite(colorBorder);
- }
-
- // Fill the background in a solid color
- using (SolidBrush fillBrush = new SolidBrush(colorFill))
- {
- e.Graphics.FillPath(fillBrush, borderPath);
- }
-
- // Draw the border around the check box
- using (Pen borderPen = new Pen(colorBorder))
- {
- e.Graphics.DrawPath(borderPen, borderPath);
- }
-
- // If there is not an image, then we can draw the tick, square etc...
- if (e.Item.Image == null)
- {
- CheckState checkState = CheckState.Unchecked;
-
- // Extract the check state from the item
- if (e.Item is ToolStripMenuItem item)
- {
- checkState = item.CheckState;
- }
-
- // Decide what graphic to draw
- Image drawImage = null;
- switch (checkState)
- {
- case CheckState.Checked:
- drawImage = _contextMenuChecked;
- break;
- case CheckState.Indeterminate:
- drawImage = _contextMenuIndeterminate;
- break;
- }
-
- if (drawImage != null)
- {
- // Draw the image centered in the available space
- int xOffset = e.ImageRectangle.Width - drawImage.Width;
- int yOffset = e.ImageRectangle.Height - drawImage.Height;
- Rectangle drawRect = new Rectangle(e.ImageRectangle.X + xOffset,
- e.ImageRectangle.Y + yOffset,
- drawImage.Width,
- drawImage.Height);
-
- // Do we need to draw disabled?
- if (e.Item.Enabled)
- {
- e.Graphics.DrawImage(drawImage, e.ImageRectangle);
- }
- else
- {
- using (ImageAttributes attribs = new ImageAttributes())
- {
- attribs.SetColorMatrix(CommonHelper.MatrixDisabled);
-
- // Draw using the disabled matrix to make it look disabled
- e.Graphics.DrawImage(drawImage, e.ImageRectangle,
- 0, 0, drawImage.Width, drawImage.Height,
- GraphicsUnit.Pixel, attribs);
- }
- }
- }
- }
- }
- }
- }
- #endregion
-
- #region OnRenderItemText
- ///
- /// Raises the RenderItemText event.
- ///
- /// A ToolStripItemTextRenderEventArgs that contains the event data.
- protected override void OnRenderItemText(ToolStripItemTextRenderEventArgs e)
- {
- if ((e.ToolStrip is ToolStrip) ||
- (e.ToolStrip is ContextMenuStrip) ||
- (e.ToolStrip is ToolStripDropDownMenu))
- {
- if (!e.Item.Enabled)
- {
- e.TextColor = _disabled;
- }
- else
- {
- switch (e.ToolStrip)
- {
- case MenuStrip _ when !e.Item.Pressed:
- e.TextColor = KCT.MenuStripText;
- break;
- case MenuStrip _ when (e.Item.Pressed || e.Item.Selected):
- e.TextColor = KCT.MenuItemText;
- break;
- case StatusStrip _ when !e.Item.Pressed && !e.Item.Selected:
- e.TextColor = KCT.StatusStripText;
- break;
- case ContextMenuStrip _:
- case ToolStripDropDownMenu _:
- e.TextColor = KCT.MenuItemText;
- break;
- default:
- {
- if (((e.ToolStrip is ToolStripDropDownMenu) || (e.ToolStrip is ToolStripOverflow)) && !e.Item.Selected)
- {
- e.TextColor = KCT.MenuItemText;
- }
- else if ((e.ToolStrip is ToolStrip) && ((e.Item is ToolStripSplitButton) || (e.Item is ToolStripDropDownButton)) &&
- e.Item.Pressed)
- {
- e.TextColor = KCT.MenuItemText;
- }
- else
- {
- e.TextColor = KCT.ToolStripText;
- }
- break;
- }
- }
- }
-
- // Status strips under XP cannot use clear type because it ends up being cut off at edges
- if ((e.ToolStrip is StatusStrip) && (Environment.OSVersion.Version.Major < 6))
- {
- base.OnRenderItemText(e);
- }
- else
- {
- using (GraphicsTextHint clearTypeGridFit = new GraphicsTextHint(e.Graphics, TextRenderingHint.ClearTypeGridFit))
- {
- base.OnRenderItemText(e);
- }
- }
- }
- else
- {
- base.OnRenderItemText(e);
- }
- }
- #endregion
-
- #region OnRenderItemImage
- ///
- /// Raises the RenderItemImage event.
- ///
- /// An ToolStripItemImageRenderEventArgs containing the event data.
- protected override void OnRenderItemImage(ToolStripItemImageRenderEventArgs e)
- {
- // We only override the image drawing for context menus
- if ((e.ToolStrip is ContextMenuStrip) ||
- (e.ToolStrip is ToolStripDropDownMenu))
- {
- if (e.Image != null)
- {
- if (e.Item.Enabled)
- {
- e.Graphics.DrawImage(e.Image, e.ImageRectangle);
- }
- else
- {
- using (ImageAttributes attribs = new ImageAttributes())
- {
- attribs.SetColorMatrix(CommonHelper.MatrixDisabled);
-
- // Draw using the disabled matrix to make it look disabled
- e.Graphics.DrawImage(e.Image, e.ImageRectangle,
- 0, 0, e.Image.Width, e.Image.Height,
- GraphicsUnit.Pixel, attribs);
- }
- }
- }
- }
- else
- {
- base.OnRenderItemImage(e);
- }
- }
- #endregion
-
- #region OnRenderMenuItemBackground
- ///
- /// Raises the RenderMenuItemBackground event.
- ///
- /// An ToolStripItemRenderEventArgs containing the event data.
- protected override void OnRenderMenuItemBackground(ToolStripItemRenderEventArgs e)
- {
- if ((e.ToolStrip is MenuStrip) ||
- (e.ToolStrip is ContextMenuStrip) ||
- (e.ToolStrip is ToolStripDropDownMenu))
- {
- if ((e.Item.Pressed) && (e.ToolStrip is MenuStrip))
- {
- // Draw the menu/tool strip as a header for a context menu item
- DrawContextMenuHeader(e.Graphics, e.Item);
- }
- else
- {
- // We only draw a background if the item is selected and enabled
- if (e.Item.Selected)
- {
- if (e.Item.Enabled)
- {
- UpdateCache();
-
- if (e.ToolStrip is MenuStrip)
- {
- DrawGradientToolItem(e.Graphics, e.Item, _gradientTracking);
- }
- else
- {
- DrawLinearContextMenuItem(e.Graphics, e.Item, _linearItem);
- }
- }
- else
- {
- // Get the mouse position in tool strip coordinates
- Point mousePos = e.ToolStrip.PointToClient(Control.MousePosition);
-
- // If the mouse is not in the item area, then draw disabled
- if (!e.Item.Bounds.Contains(mousePos))
- {
- DrawLinearContextMenuItem(e.Graphics, e.Item, _disabledLinearItem);
- }
- }
- }
- }
- }
- else
- {
- base.OnRenderMenuItemBackground(e);
- }
- }
- #endregion
-
- #region OnRenderSplitButtonBackground
- ///
- /// Raises the RenderSplitButtonBackground event.
- ///
- /// An ToolStripItemRenderEventArgs containing the event data.
- protected override void OnRenderSplitButtonBackground(ToolStripItemRenderEventArgs e)
- {
- if (e.Item.Selected || e.Item.Pressed)
- {
- // Cast to correct type
- ToolStripSplitButton splitButton = (ToolStripSplitButton)e.Item;
-
- // Draw the border and background
- RenderToolSplitButtonBackground(e.Graphics, splitButton, e.ToolStrip);
-
- // Get the rectangle that needs to show the arrow
- Rectangle arrowBounds = splitButton.DropDownButtonBounds;
-
- // Draw the arrow on top of the background
- OnRenderArrow(new ToolStripArrowRenderEventArgs(e.Graphics,
- splitButton,
- arrowBounds,
- SystemColors.ControlText,
- ArrowDirection.Down));
- }
- else
- {
- base.OnRenderSplitButtonBackground(e);
- }
- }
- #endregion
-
- #region OnRenderStatusStripSizingGrip
- ///
- /// Raises the RenderStatusStripSizingGrip event.
- ///
- /// An ToolStripRenderEventArgs containing the event data.
- protected override void OnRenderStatusStripSizingGrip(ToolStripRenderEventArgs e)
- {
- using (SolidBrush darkBrush = new SolidBrush(KCT.GripDark),
- lightBrush = new SolidBrush(KCT.GripLight))
- {
- // Do we need to invert the drawing edge?
- bool rtl = (e.ToolStrip.RightToLeft == RightToLeft.Yes);
-
- // Find vertical position of the lowest grip line
- int y = (e.AffectedBounds.Bottom - (GRIP_SIZE * 2)) + 1;
-
- // Draw three lines of grips
- for (int i = GRIP_LINES; i >= 1; i--)
- {
- // Find the rightmost grip position on the line
- int x = (rtl ? e.AffectedBounds.Left + 1 :
- (e.AffectedBounds.Right - (GRIP_SIZE * 2)) + 1);
-
- // Draw grips from right to left on line
- for (int j = 0; j < i; j++)
- {
- // Just the single grip glyph
- DrawGripGlyph(e.Graphics, x, y, darkBrush, lightBrush);
-
- // Move left to next grip position
- x -= (rtl ? -GRIP_MOVE : GRIP_MOVE);
- }
-
- // Move upwards to next grip line
- y -= GRIP_MOVE;
- }
- }
- }
- #endregion
-
- #region OnRenderToolStripContentPanelBackground
- ///
- /// Raises the RenderToolStripContentPanelBackground event.
- ///
- /// An ToolStripContentPanelRenderEventArgs containing the event data.
- protected override void OnRenderToolStripContentPanelBackground(ToolStripContentPanelRenderEventArgs e)
- {
- // Must call base class, otherwise the subsequent drawing does not appear!
- base.OnRenderToolStripContentPanelBackground(e);
-
- // Cannot paint a zero sized area
- if ((e.ToolStripContentPanel.Width > 0) &&
- (e.ToolStripContentPanel.Height > 0))
- {
- using (LinearGradientBrush backBrush = new LinearGradientBrush(e.ToolStripContentPanel.ClientRectangle,
- KCT.ToolStripContentPanelGradientEnd,
- KCT.ToolStripContentPanelGradientBegin,
- 90f))
- {
- e.Graphics.FillRectangle(backBrush, e.ToolStripContentPanel.ClientRectangle);
- }
- }
- }
- #endregion
-
- #region OnRenderSeparator
- ///
- /// Raises the RenderSeparator event.
- ///
- /// An ToolStripSeparatorRenderEventArgs containing the event data.
- protected override void OnRenderSeparator(ToolStripSeparatorRenderEventArgs e)
- {
- switch (e.ToolStrip)
- {
- case ContextMenuStrip _:
- case ToolStripDropDownMenu _:
- // Create the light and dark line pens
- using (Pen lightPen = new Pen(KCT.ImageMarginGradientEnd),
- darkPen = new Pen(KCT.ImageMarginGradientMiddle))
- {
- DrawSeparator(e.Graphics, e.Vertical, e.Item.Bounds,
- lightPen, darkPen, SEPARATOR_INSET,
- (e.ToolStrip.RightToLeft == RightToLeft.Yes));
- }
- break;
- case StatusStrip _:
- // Create the light and dark line pens
- using (Pen lightPen = new Pen(KCT.SeparatorLight),
- darkPen = new Pen(KCT.SeparatorDark))
- {
- DrawSeparator(e.Graphics, e.Vertical, e.Item.Bounds,
- lightPen, darkPen, 0, false);
- }
- break;
- default:
- base.OnRenderSeparator(e);
- break;
- }
- }
- #endregion
-
- #region OnRenderToolStripBackground
- ///
- /// Raises the RenderToolStripBackground event.
- ///
- /// An ToolStripRenderEventArgs containing the event data.
- protected override void OnRenderToolStripBackground(ToolStripRenderEventArgs e)
- {
- // Make sure the font is current
- if (e.ToolStrip.Font != KCT.MenuStripFont)
- {
- e.ToolStrip.Font = KCT.MenuStripFont;
- }
-
- switch (e.ToolStrip)
- {
- case ContextMenuStrip _:
- case ToolStripDropDownMenu _:
- // Create border and clipping paths
- using (GraphicsPath borderPath = CreateBorderPath(e.AffectedBounds, CUT_CONTEXT_MENU),
- clipPath = CreateClipBorderPath(e.AffectedBounds, CUT_CONTEXT_MENU))
- {
- // Clip all drawing to within the border path
- using (Clipping clipping = new Clipping(e.Graphics, clipPath))
- {
- // Create the background brush
- using (SolidBrush backBrush = new SolidBrush(KCT.ToolStripDropDownBackground))
- {
- e.Graphics.FillPath(backBrush, borderPath);
- }
- }
- }
- break;
- case StatusStrip _:
- // Create rectangle that covers the status strip area
- RectangleF backRect = new RectangleF(0, 0, e.ToolStrip.Width, e.ToolStrip.Height);
-
- Form owner = e.ToolStrip.FindForm();
-
- // Check if the status strip is inside a KryptonForm and using the Sparkle renderer, in
- // which case we want to extend the drawing down into the border area for an integrated look
- if (e.ToolStrip.Visible
- && (e.ToolStrip.Dock == DockStyle.Bottom)
- && (e.ToolStrip.RenderMode == ToolStripRenderMode.ManagerRenderMode)
- && (ToolStripManager.Renderer is KryptonSparkleRenderer)
- && owner is KryptonForm kryptonForm
- && (e.ToolStrip.Bottom == owner.ClientSize.Height)
- )
- {
- // Get the window borders
-
- // Finally check that the actual form is using custom chrome
- if (kryptonForm.ApplyCustomChrome)
- {
- // Extend down into the bottom border
- Padding borders = kryptonForm.RealWindowBorders;
- backRect.Height += borders.Bottom;
- backRect.Width += borders.Horizontal;
- backRect.X -= borders.Left;
- }
- }
-
- // Cannot paint a zero sized area
- if ((backRect.Width > 0) && (backRect.Height > 0))
- {
- // Draw entire background
- using (SolidBrush backBrush = new SolidBrush(KCT.MenuStripGradientBegin))
- {
- e.Graphics.FillRectangle(backBrush, backRect);
- }
-
- // Create path for the rounded bottom edges
- using (GraphicsPath innerPath = new GraphicsPath())
- {
- RectangleF innerRectF = new RectangleF(backRect.X + 2, backRect.Y, backRect.Width - 4, backRect.Height - 2);
-
- innerPath.AddLine(innerRectF.Right - 1, innerRectF.Top, innerRectF.Right - 1, innerRectF.Bottom - 7);
- innerPath.AddArc(innerRectF.Right - 7, innerRectF.Bottom - 7, 6, 6, 0f, 90f);
- innerPath.AddArc(innerRectF.Left, innerRectF.Bottom - 7, 6, 6, 90f, 90f);
- innerPath.AddLine(innerRectF.Left, innerRectF.Bottom - 7, innerRectF.Left, innerRectF.Top);
-
- // Make the last and first arc join up
- innerPath.CloseFigure();
-
- // Fill with a gradient brush
- using (LinearGradientBrush innerBrush = new LinearGradientBrush(new Rectangle((int)backRect.X - 1, (int)backRect.Y - 1,
- (int)backRect.Width + 2, (int)backRect.Height + 1),
- KCT.StatusStripGradientBegin,
- KCT.StatusStripGradientEnd,
- 90f))
- {
- innerBrush.Blend = _statusStripBlend;
-
- using (AntiAlias aa = new AntiAlias(e.Graphics))
- {
- e.Graphics.FillPath(innerBrush, innerPath);
- }
- }
- }
- }
- break;
- default:
- base.OnRenderToolStripBackground(e);
- break;
- }
- }
- #endregion
-
- #region OnRenderImageMargin
- ///
- /// Raises the RenderImageMargin event.
- ///
- /// An ToolStripRenderEventArgs containing the event data.
- protected override void OnRenderImageMargin(ToolStripRenderEventArgs e)
- {
- if ((e.ToolStrip is ContextMenuStrip) ||
- (e.ToolStrip is ToolStripDropDownMenu))
- {
- // Start with the total margin area
- Rectangle marginRect = e.AffectedBounds;
-
- // Do we need to draw with separator on the opposite edge?
- bool rtl = (e.ToolStrip.RightToLeft == RightToLeft.Yes);
-
- marginRect.Y += MARGIN_INSET;
- marginRect.Height -= MARGIN_INSET * 2;
-
- // Reduce so it is inside the border
- if (!rtl)
- {
- marginRect.X += MARGIN_INSET;
- }
- else
- {
- marginRect.X += MARGIN_INSET / 2;
- }
-
- // Draw the entire margine area in a solid color
- using (SolidBrush backBrush = new SolidBrush(KCT.ImageMarginGradientBegin))
- {
- e.Graphics.FillRectangle(backBrush, marginRect);
- }
-
- // Create the light and dark line pens
- using (Pen lightPen = new Pen(KCT.ImageMarginGradientEnd),
- darkPen = new Pen(KCT.ImageMarginGradientMiddle))
- {
- if (!rtl)
- {
- // Draw the light and dark lines on the right hand side
- e.Graphics.DrawLine(lightPen, marginRect.Right, marginRect.Top, marginRect.Right, marginRect.Bottom);
- e.Graphics.DrawLine(darkPen, marginRect.Right - 1, marginRect.Top, marginRect.Right - 1, marginRect.Bottom);
- }
- else
- {
- // Draw the light and dark lines on the left hand side
- e.Graphics.DrawLine(lightPen, marginRect.Left - 1, marginRect.Top, marginRect.Left - 1, marginRect.Bottom);
- e.Graphics.DrawLine(darkPen, marginRect.Left, marginRect.Top, marginRect.Left, marginRect.Bottom);
- }
- }
- }
- else
- {
- base.OnRenderImageMargin(e);
- }
- }
- #endregion
-
- #region OnRenderToolStripBorder
- ///
- /// Raises the RenderToolStripBorder event.
- ///
- /// An ToolStripRenderEventArgs containing the event data.
- protected override void OnRenderToolStripBorder(ToolStripRenderEventArgs e)
- {
- if ((e.ToolStrip is ContextMenuStrip) ||
- (e.ToolStrip is ToolStripDropDownMenu))
- {
- // If there is a connected area to be drawn
- if (!e.ConnectedArea.IsEmpty)
- {
- using (SolidBrush excludeBrush = new SolidBrush(KCT.ToolStripDropDownBackground))
- {
- e.Graphics.FillRectangle(excludeBrush, e.ConnectedArea);
- }
- }
-
- // Create border and clipping paths
- using (GraphicsPath borderPath = CreateBorderPath(e.AffectedBounds, e.ConnectedArea, CUT_CONTEXT_MENU),
- insidePath = CreateInsideBorderPath(e.AffectedBounds, e.ConnectedArea, CUT_CONTEXT_MENU),
- clipPath = CreateClipBorderPath(e.AffectedBounds, e.ConnectedArea, CUT_CONTEXT_MENU))
- {
- // Create the different pen colors we need
- using (Pen borderPen = new Pen(KCT.MenuBorder),
- insidePen = new Pen(KCT.ToolStripDropDownBackground))
- {
- // Clip all drawing to within the border path
- using (Clipping clipping = new Clipping(e.Graphics, clipPath))
- {
- // Drawing with anti aliasing to create smoother appearance
- using (AntiAlias aa = new AntiAlias(e.Graphics))
- {
- // Draw the inside area first
- e.Graphics.DrawPath(insidePen, insidePath);
-
- // Draw the border area second, so any overlapping gives it priority
- e.Graphics.DrawPath(borderPen, borderPath);
- }
-
- // Draw the pixel at the bottom right of the context menu
- e.Graphics.DrawLine(borderPen, e.AffectedBounds.Right, e.AffectedBounds.Bottom,
- e.AffectedBounds.Right - 1, e.AffectedBounds.Bottom - 1);
- }
- }
- }
- }
- else if (!(e.ToolStrip is StatusStrip))
- {
- base.OnRenderToolStripBorder(e);
- }
- }
- #endregion
-
- #region Implementation
- private void UpdateCache()
- {
- // Only need to create the cache objects first time around
- if (_gradientItem == null)
- {
- _linearItem = new LinearItemColors(KCT.ButtonSelectedGradientMiddle,
- CommonHelper.BlackenColor(KCT.ButtonSelectedGradientMiddle, 0.91f, 0.91f, 0.91f),
- CommonHelper.BlackenColor(KCT.ButtonSelectedGradientMiddle, 0.75f, 0.75f, 0.75f));
-
- _gradientItem = new GradientItemColors(KCT.CheckBackground,
- KCT.ButtonSelectedGradientBegin,
- KCT.ButtonSelectedGradientBegin);
-
- _gradientTracking = new GradientItemColors(KCT.ButtonSelectedBorder,
- KCT.ButtonSelectedGradientBegin,
- KCT.ButtonSelectedGradientEnd);
-
- _gradientPressed = new GradientItemColors(KCT.ButtonPressedBorder,
- KCT.ButtonPressedGradientBegin,
- KCT.ButtonPressedGradientEnd);
-
- _gradientChecked = new GradientItemColors(KCT.ButtonPressedBorder,
- KCT.ButtonCheckedGradientBegin,
- KCT.ButtonCheckedGradientEnd);
-
- _gradientCheckedTracking = new GradientItemColors(KCT.ButtonSelectedBorder,
- KCT.ButtonPressedGradientBegin,
- KCT.ButtonCheckedGradientEnd);
- }
- }
-
- private void RenderToolButtonBackground(Graphics g,
- ToolStripButton button,
- ToolStrip toolstrip)
- {
- // We only draw a background if the item is selected or being pressed
- if (button.Enabled)
- {
- // Ensure we have cached the objects we need
- UpdateCache();
-
- if (button.Checked)
- {
- if (button.Pressed)
- {
- DrawGradientToolItem(g, button, _gradientPressed);
- }
- else if (button.Selected)
- {
- DrawGradientToolItem(g, button, _gradientCheckedTracking);
- }
- else
- {
- DrawGradientToolItem(g, button, _gradientChecked);
- }
- }
- else
- {
- if (button.Pressed)
- {
- DrawGradientToolItem(g, button, _gradientPressed);
- }
- else if (button.Selected)
- {
- DrawGradientToolItem(g, button, _gradientTracking);
- }
- }
- }
- else
- {
- if (button.Selected)
- {
- // Get the mouse position in tool strip coordinates
- Point mousePos = toolstrip.PointToClient(Control.MousePosition);
-
- // If the mouse is not in the item area, then draw disabled
- if (!button.Bounds.Contains(mousePos))
- {
- DrawGradientToolItem(g, button, _disabledGradientItem);
- }
- }
- }
- }
-
- private void RenderToolDropButtonBackground(Graphics g,
- ToolStripItem item,
- ToolStrip toolstrip)
- {
- // We only draw a background if the item is selected or being pressed
- if (item.Selected || item.Pressed)
- {
- if (item.Enabled)
- {
- if (item.Pressed)
- {
- DrawContextMenuHeader(g, item);
- }
- else
- {
- // Ensure we have cached the objects we need
- UpdateCache();
-
- DrawGradientToolItem(g, item, _gradientTracking);
- }
- }
- else
- {
- // Get the mouse position in tool strip coordinates
- Point mousePos = toolstrip.PointToClient(Control.MousePosition);
-
- // If the mouse is not in the item area, then draw disabled
- if (!item.Bounds.Contains(mousePos))
- {
- DrawGradientToolItem(g, item, _disabledGradientItem);
- }
- }
- }
- }
-
- private void DrawGradientToolSplitItem(Graphics g,
- ToolStripSplitButton splitButton,
- GradientItemColors colorsButton,
- GradientItemColors colorsDrop,
- GradientItemColors colorsSplit)
- {
- // Create entire area and just the drop button area rectangles
- Rectangle backRect = new Rectangle(Point.Empty, splitButton.Bounds.Size);
- Rectangle backRectDrop = splitButton.DropDownButtonBounds;
-
- // Cannot paint zero sized areas
- if ((backRect.Width > 0) && (backRectDrop.Width > 0) &&
- (backRect.Height > 0) && (backRectDrop.Height > 0))
- {
- // Area that is the normal button starts as everything
- Rectangle backRectButton = backRect;
-
- // The X offset to draw the split line
- int splitOffset;
-
- // Is the drop button on the right hand side of entire area?
- if (backRectDrop.X > 0)
- {
- splitOffset = backRectDrop.X;
- }
- else
- {
- splitOffset = backRectDrop.Right - 1;
- }
-
- // Create border path around the item
- using (GraphicsPath borderPath = CreateBorderPath(backRect, CUT_MENU_ITEM_BACK))
- {
- // Draw the entire background area
- DrawGradientBack(g, backRect, colorsButton);
-
- // Draw the split line between the areas
- using (Pen splitPen = new Pen(colorsSplit.Border))
- {
- g.DrawLine(splitPen, backRect.X + splitOffset, backRect.Top + 1, backRect.X + splitOffset, backRect.Bottom - 1);
- }
-
- // Draw the border of the entire item
- DrawSolidBorder(g, backRect, colorsButton);
- }
- }
- }
-
- private void DrawContextMenuHeader(Graphics g, ToolStripItem item)
- {
- // Get the rectangle that is the items area
- Rectangle itemRect = new Rectangle(Point.Empty, item.Bounds.Size);
-
- // Create border and clipping paths
- using (GraphicsPath borderPath = CreateBorderPath(itemRect, CUT_TOOL_ITEM_MENU),
- insidePath = CreateInsideBorderPath(itemRect, CUT_TOOL_ITEM_MENU),
- clipPath = CreateClipBorderPath(itemRect, CUT_TOOL_ITEM_MENU))
- {
- // Clip all drawing to within the border path
- using (Clipping clipping = new Clipping(g, clipPath))
- {
- // Draw the entire background area first
- using (SolidBrush backBrush = new SolidBrush(KCT.ToolStripDropDownBackground))
- {
- g.FillPath(backBrush, borderPath);
- }
-
- // Draw the border
- using (Pen borderPen = new Pen(KCT.MenuBorder))
- {
- g.DrawPath(borderPen, borderPath);
- }
- }
- }
- }
-
- private void DrawGradientToolItem(Graphics g,
- ToolStripItem item,
- GradientItemColors colors)
- {
- // Perform drawing into the entire background of the item
- DrawGradientItem(g, new Rectangle(Point.Empty, item.Bounds.Size), colors);
- }
-
- private void RenderToolSplitButtonBackground(Graphics g,
- ToolStripSplitButton splitButton,
- ToolStrip toolstrip)
- {
- // We only draw a background if the item is selected or being pressed
- if (splitButton.Selected || splitButton.Pressed)
- {
- if (splitButton.Enabled)
- {
- // Ensure we have cached the objects we need
- UpdateCache();
-
- if (!splitButton.Pressed && splitButton.ButtonPressed)
- {
- DrawGradientToolSplitItem(g, splitButton, _gradientPressed, _gradientPressed, _gradientPressed);
- }
- else if (splitButton.Pressed && !splitButton.ButtonPressed)
- {
- DrawContextMenuHeader(g, splitButton);
- }
- else
- {
- DrawGradientToolSplitItem(g, splitButton, _gradientTracking, _gradientTracking, _gradientTracking);
- }
- }
- else
- {
- // Get the mouse position in tool strip coordinates
- Point mousePos = toolstrip.PointToClient(Control.MousePosition);
-
- // If the mouse is not in the item area, then draw disabled
- if (!splitButton.Bounds.Contains(mousePos))
- {
- DrawGradientToolItem(g, splitButton, _disabledGradientItem);
- }
- }
- }
-
- }
-
- private void DrawLinearContextMenuItem(Graphics g,
- ToolStripItem item,
- LinearItemColors colors)
- {
- // Do we need to draw with separator on the opposite edge?
- Rectangle backRect = new Rectangle(2, 0, item.Bounds.Width - 3, item.Bounds.Height);
-
- // Perform actual drawing into the background
- DrawLinearGradientItem(g, backRect, colors);
- }
-
- private static void DrawLinearGradientItem(Graphics g,
- Rectangle backRect,
- LinearItemColors colors)
- {
- // Cannot paint a zero sized area
- if ((backRect.Width > 0) && (backRect.Height > 0))
- {
- // Draw the background of the entire item
- DrawLinearGradientBack(g, backRect, colors);
-
- // Draw the border of the entire item
- DrawLinearGradientBorder(g, backRect, colors);
- }
- }
-
- private static void DrawLinearGradientBack(Graphics g,
- Rectangle backRect,
- LinearItemColors colors)
- {
- // Reduce rect draw drawing inside the border
- backRect.Inflate(-1, -1);
-
- using (LinearGradientBrush backBrush = new LinearGradientBrush(backRect, colors.Fill1, colors.Fill2, 90f))
- {
- g.FillRectangle(backBrush, backRect);
- }
- }
-
- private static void DrawLinearGradientBorder(Graphics g,
- Rectangle backRect,
- LinearItemColors colors)
- {
- // Drawing with anti aliasing to create smoother appearance
- using (AntiAlias aa = new AntiAlias(g))
- using (Pen borderPen = new Pen(colors.Border))
- using (GraphicsPath borderPath = CreateBorderPath(backRect, CUT_MENU_ITEM_BACK))
- {
- g.DrawPath(borderPen, borderPath);
- }
- }
-
- private void DrawGradientContextMenuItem(Graphics g,
- ToolStripItem item,
- GradientItemColors colors)
- {
- // Do we need to draw with separator on the opposite edge?
- Rectangle backRect = new Rectangle(2, 0, item.Bounds.Width - 3, item.Bounds.Height);
-
- // Perform actual drawing into the background
- DrawGradientItem(g, backRect, colors);
- }
-
- private static void DrawGradientItem(Graphics g,
- Rectangle backRect,
- GradientItemColors colors)
- {
- // Cannot paint a zero sized area
- if ((backRect.Width > 0) && (backRect.Height > 0))
- {
- // Draw the background of the entire item
- DrawGradientBack(g, backRect, colors);
-
- // Draw the border of the entire item
- DrawSolidBorder(g, backRect, colors);
- }
- }
-
- private static void DrawGradientBack(Graphics g,
- Rectangle backRect,
- GradientItemColors colors)
- {
- backRect.X++;
- backRect.Width -= 1;
-
- using (RenderContext context = new RenderContext(null, g, backRect, null))
- {
- using (GraphicsPath backPath = CreateBorderPath(backRect, CUT_MENU_ITEM_BACK))
- {
- backRect.Width -= 1;
- backRect.Height -= 1;
-
- RenderGlassHelpers.DrawBackGlassBottom(context, backRect,
- colors.Begin, colors.End,
- VisualOrientation.Top, backPath, null);
- }
- }
- }
-
- private static void DrawSolidBorder(Graphics g,
- Rectangle backRect,
- GradientItemColors colors)
- {
- // Drawing with anti aliasing to create smoother appearance
- using (AntiAlias aa = new AntiAlias(g))
- {
- Rectangle backRectI = backRect;
- backRectI.Inflate(1, 1);
-
- // Use solid color for the border
- using (Pen borderPen = new Pen(colors.Border))
- using (GraphicsPath borderPath = CreateBorderPath(backRect, CUT_MENU_ITEM_BACK))
- {
- g.DrawPath(borderPen, borderPath);
- }
- }
- }
-
- private void DrawGripGlyph(Graphics g,
- int x,
- int y,
- Brush darkBrush,
- Brush lightBrush)
- {
- g.FillRectangle(lightBrush, x + GRIP_OFFSET, y + GRIP_OFFSET, GRIP_SQUARE, GRIP_SQUARE);
- g.FillRectangle(darkBrush, x, y, GRIP_SQUARE, GRIP_SQUARE);
- }
-
- private void DrawSeparator(Graphics g,
- bool vertical,
- Rectangle rect,
- Pen lightPen,
- Pen darkPen,
- int horizontalInset,
- bool rtl)
- {
- if (vertical)
- {
- int l = rect.Width / 2;
- int t = rect.Y;
- int b = rect.Bottom;
-
- // Draw vertical lines centered
- g.DrawLine(darkPen, l, t, l, b);
- g.DrawLine(lightPen, l + 1, t, l + 1, b);
- }
- else
- {
- int y = rect.Height / 2;
- int l = rect.X + (rtl ? 0 : horizontalInset);
- int r = rect.Right - (rtl ? horizontalInset : 0);
-
- // Draw horizontal lines centered
- g.DrawLine(darkPen, l, y, r, y);
- g.DrawLine(lightPen, l, y + 1, r, y + 1);
- }
- }
-
- private static GraphicsPath CreateBorderPath(Rectangle rect,
- Rectangle exclude,
- float cut)
- {
- // If nothing to exclude, then use quicker method
- if (exclude.IsEmpty)
- {
- return CreateBorderPath(rect, cut);
- }
-
- // Drawing lines requires we draw inside the area we want
- rect.Width--;
- rect.Height--;
-
- // Create an array of points to draw lines between
- List pts = new List();
-
- float l = rect.X;
- float t = rect.Y;
- float r = rect.Right;
- float b = rect.Bottom;
- float x0 = rect.X + cut;
- float x3 = rect.Right - cut;
- float y0 = rect.Y + cut;
- float y3 = rect.Bottom - cut;
- float cutBack = (cut == 0f ? 1 : cut);
-
- // Does the exclude intercept the top line
- if ((rect.Y >= exclude.Top) && (rect.Y <= exclude.Bottom))
- {
- float x1 = exclude.X - 1 - cut;
- float x2 = exclude.Right + cut;
-
- if (x0 <= x1)
- {
- pts.Add(new PointF(x0, t));
- pts.Add(new PointF(x1, t));
- pts.Add(new PointF(x1 + cut, t - cutBack));
- }
- else
- {
- x1 = exclude.X - 1;
- pts.Add(new PointF(x1, t));
- pts.Add(new PointF(x1, t - cutBack));
- }
-
- if (x3 > x2)
- {
- pts.Add(new PointF(x2 - cut, t - cutBack));
- pts.Add(new PointF(x2, t));
- pts.Add(new PointF(x3, t));
- }
- else
- {
- x2 = exclude.Right;
- pts.Add(new PointF(x2, t - cutBack));
- pts.Add(new PointF(x2, t));
- }
- }
- else
- {
- pts.Add(new PointF(x0, t));
- pts.Add(new PointF(x3, t));
- }
-
- pts.Add(new PointF(r, y0));
- pts.Add(new PointF(r, y3));
- pts.Add(new PointF(x3, b));
- pts.Add(new PointF(x0, b));
- pts.Add(new PointF(l, y3));
- pts.Add(new PointF(l, y0));
-
- // Create path using a simple set of lines that cut the corner
- GraphicsPath path = new GraphicsPath();
-
- // Add a line between each set of points
- for (int i = 1; i < pts.Count; i++)
- {
- path.AddLine(pts[i - 1], pts[i]);
- }
-
- // Add a line to join the last to the first
- path.AddLine(pts[pts.Count - 1], pts[0]);
-
- return path;
- }
-
- private static GraphicsPath CreateBorderPath(Rectangle rect, float cut)
- {
- // Drawing lines requires we draw inside the area we want
- rect.Width--;
- rect.Height--;
-
- // Create path using a simple set of lines that cut the corner
- GraphicsPath path = new GraphicsPath();
- path.AddLine(rect.Left + cut, rect.Top, rect.Right - cut, rect.Top);
- path.AddLine(rect.Right - cut, rect.Top, rect.Right, rect.Top + cut);
- path.AddLine(rect.Right, rect.Top + cut, rect.Right, rect.Bottom - cut);
- path.AddLine(rect.Right, rect.Bottom - cut, rect.Right - cut, rect.Bottom);
- path.AddLine(rect.Right - cut, rect.Bottom, rect.Left + cut, rect.Bottom);
- path.AddLine(rect.Left + cut, rect.Bottom, rect.Left, rect.Bottom - cut);
- path.AddLine(rect.Left, rect.Bottom - cut, rect.Left, rect.Top + cut);
- path.AddLine(rect.Left, rect.Top + cut, rect.Left + cut, rect.Top);
- return path;
- }
-
- private static GraphicsPath CreateInsideBorderPath(Rectangle rect, float cut)
- {
- // Adjust rectangle to be 1 pixel inside the original area
- rect.Inflate(-1, -1);
-
- // Now create a path based on this inner rectangle
- return CreateBorderPath(rect, cut);
- }
-
- private static GraphicsPath CreateInsideBorderPath(Rectangle rect,
- Rectangle exclude,
- float cut)
- {
- // Adjust rectangle to be 1 pixel inside the original area
- rect.Inflate(-1, -1);
-
- // Now create a path based on this inner rectangle
- return CreateBorderPath(rect, exclude, cut);
- }
-
- private static GraphicsPath CreateClipBorderPath(Rectangle rect, float cut)
- {
- // Clipping happens inside the rect, so make 1 wider and taller
- rect.Width++;
- rect.Height++;
-
- // Now create a path based on this inner rectangle
- return CreateBorderPath(rect, cut);
- }
-
- private static GraphicsPath CreateClipBorderPath(Rectangle rect,
- Rectangle exclude,
- float cut)
- {
- // Clipping happens inside the rect, so make 1 wider and taller
- rect.Width++;
- rect.Height++;
-
- // Now create a path based on this inner rectangle
- return CreateBorderPath(rect, exclude, cut);
- }
-
- private static GraphicsPath CreateArrowPath(ToolStripItem item,
- Rectangle rect,
- ArrowDirection direction)
- {
- int x, y;
-
- // Find the correct starting position, which depends on direction
- if ((direction == ArrowDirection.Left) ||
- (direction == ArrowDirection.Right))
- {
- x = rect.Right - ((rect.Width - 4) / 2);
- y = rect.Y + (rect.Height / 2);
- }
- else
- {
- x = rect.X + (rect.Width / 2);
- y = rect.Bottom - ((rect.Height - 3) / 2);
-
- // The drop down button is position 1 pixel incorrectly when in RTL
- if ((item is ToolStripDropDownButton) &&
- (item.RightToLeft == RightToLeft.Yes))
- {
- x++;
- }
- }
-
- // Create triangle using a series of lines
- GraphicsPath path = new GraphicsPath();
-
- switch (direction)
- {
- case ArrowDirection.Right:
- path.AddLine(x, y, x - 4, y - 4);
- path.AddLine(x - 4, y - 4, x - 4, y + 4);
- path.AddLine(x - 4, y + 4, x, y);
- break;
- case ArrowDirection.Left:
- path.AddLine(x - 4, y, x, y - 4);
- path.AddLine(x, y - 4, x, y + 4);
- path.AddLine(x, y + 4, x - 4, y);
- break;
- case ArrowDirection.Down:
- path.AddLine(x + 3f, y - 3f, x - 2f, y - 3f);
- path.AddLine(x - 2f, y - 3f, x, y);
- path.AddLine(x, y, x + 3f, y - 3f);
- break;
- case ArrowDirection.Up:
- path.AddLine(x + 3f, y, x - 3f, y);
- path.AddLine(x - 3f, y, x, y - 4f);
- path.AddLine(x, y - 4f, x + 3f, y);
- break;
- }
-
- return path;
- }
-
- private static GraphicsPath CreateTickPath(Rectangle rect)
- {
- // Get the center point of the rect
- int x = rect.X + (rect.Width / 2);
- int y = rect.Y + (rect.Height / 2);
-
- GraphicsPath path = new GraphicsPath();
- path.AddLine(x - 5, y - 1, x - 2, y + 4);
- path.AddLine(x - 2, y + 4, x + 3, y - 5);
- return path;
- }
-
- private static GraphicsPath CreateIndeterminatePath(Rectangle rect)
- {
- // Get the center point of the rect
- float x = (float)rect.X + (((float)rect.Width - 6) / 2);
- float y = (float)rect.Y + (((float)rect.Height - 6) / 2);
-
- GraphicsPath path = new GraphicsPath();
- path.AddEllipse(x, y, 6f, 6f);
- return path;
- }
- #endregion
- }
-}
\ No newline at end of file
diff --git a/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/Core/KryptonStandardRenderer.cs b/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/Core/KryptonStandardRenderer.cs
deleted file mode 100644
index 226358b3..00000000
--- a/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/Core/KryptonStandardRenderer.cs
+++ /dev/null
@@ -1,83 +0,0 @@
-using ComponentFactory.Krypton.Toolkit;
-using System.Windows.Forms;
-
-namespace ExtendedControls.Base.Renderers.Core
-{
- internal class KryptonStandardRenderer : KryptonProfessionalRenderer
- {
- #region Identity
- ///
- /// Initialise a new instance of the KryptonStandardRenderer class.
- ///
- /// Source for text colors.
- public KryptonStandardRenderer(KryptonColorTable kct)
- : base(kct)
- {
- }
- #endregion
-
- #region OnRenderItemText
- ///
- /// Raises the RenderItemText event.
- ///
- /// A ToolStripItemTextRenderEventArgs that contains the event data.
- protected override void OnRenderItemText(ToolStripItemTextRenderEventArgs e)
- {
- switch (e.ToolStrip)
- {
- case MenuStrip _:
- e.TextColor = KCT.MenuStripText;
- break;
- case StatusStrip _:
- e.TextColor = KCT.StatusStripText;
- break;
- case ContextMenuStrip _:
- case ToolStripDropDown _:
- e.TextColor = KCT.MenuItemText;
- break;
- case ToolStrip _:
- e.TextColor = KCT.ToolStripText;
- break;
- }
-
- base.OnRenderItemText(e);
- }
- #endregion
-
- #region OnRenderToolStripBackground
- ///
- /// Raises the RenderToolStripBackground event.
- ///
- /// An ToolStripRenderEventArgs containing the event data.
- protected override void OnRenderToolStripBackground(ToolStripRenderEventArgs e)
- {
- // Make sure the font is current
- switch (e.ToolStrip)
- {
- case MenuStrip _:
- case ContextMenuStrip _:
- case ToolStripDropDown _:
- if (e.ToolStrip.Font != KCT.MenuStripFont)
- {
- e.ToolStrip.Font = KCT.MenuStripFont;
- }
- break;
- case StatusStrip _:
- if (e.ToolStrip.Font != KCT.StatusStripFont)
- {
- e.ToolStrip.Font = KCT.StatusStripFont;
- }
- break;
- case ToolStrip _:
- if (e.ToolStrip.Font != KCT.ToolStripFont)
- {
- e.ToolStrip.Font = KCT.ToolStripFont;
- }
- break;
- }
-
- base.OnRenderToolStripBackground(e);
- }
- #endregion
- }
-}
\ No newline at end of file
diff --git a/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/Core/RenderContext.cs b/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/Core/RenderContext.cs
deleted file mode 100644
index fad29664..00000000
--- a/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/Core/RenderContext.cs
+++ /dev/null
@@ -1,108 +0,0 @@
-namespace ExtendedControls.Base.Renderers.Core
-{
- ///
- /// Encapsulates context for view render operations.
- ///
- //public class RenderContext : ViewContext
- // {
- // #region Instance Fields
-
- // #endregion
-
- // #region Identity
- // ///
- // /// Initialize a new instance of the ViewContext class.
- // ///
- // /// Control associated with rendering.
- // /// Graphics instance for drawing.
- // /// Rectangle that needs rendering.
- // /// Rendering provider.
- // public RenderContext(Control control,
- // Graphics graphics,
- // Rectangle clipRect,
- // IRenderer renderer)
- // : this(null, control, control, graphics, clipRect, renderer)
- // {
- // }
-
- // ///
- // /// Initialize a new instance of the ViewContext class.
- // ///
- // /// Control associated with rendering.
- // /// Control used to align elements.
- // /// Graphics instance for drawing.
- // /// Rectangle that needs rendering.
- // /// Rendering provider.
- // public RenderContext(Control control,
- // Control alignControl,
- // Graphics graphics,
- // Rectangle clipRect,
- // IRenderer renderer)
- // : this(null, control, alignControl, graphics, clipRect, renderer)
- // {
- // }
-
- // ///
- // /// Initialize a new instance of the ViewContext class.
- // ///
- // /// Reference to the view manager.
- // /// Control associated with rendering.
- // /// Control used to align elements.
- // /// Graphics instance for drawing.
- // /// Rectangle that needs rendering.
- // /// Rendering provider.
- // public RenderContext(ViewManager manager,
- // Control control,
- // Control alignControl,
- // Graphics graphics,
- // Rectangle clipRect,
- // IRenderer renderer)
- // : base(manager, control, alignControl, graphics, renderer)
- // {
- // ClipRect = clipRect;
- // }
- // #endregion
-
- // #region Public
- // ///
- // /// Gets the rectangle that needs rendering.
- // ///
- // public Rectangle ClipRect { get; }
-
- // ///
- // /// Calculate a rectangle in control coodinates that is aligned for gradient drawing.
- // ///
- // /// How to align the gradient.
- // /// Rectangle of the local element.
- // ///
- // ///
- // public Rectangle GetAlignedRectangle(PaletteRectangleAlign align, Rectangle local)
- // {
- // switch (align)
- // {
- // case PaletteRectangleAlign.Local:
- // // Gradient should cover just the local view element itself
- // local.Inflate(2, 2);
- // return local;
- // case PaletteRectangleAlign.Control:
- // Rectangle clientRect = (AlignControl == Control)
- // ? Control.ClientRectangle
- // : Control.RectangleToClient(AlignControl.RectangleToScreen(AlignControl.ClientRectangle));
-
- // clientRect.Inflate(2, 2);
- // return clientRect;
- // case PaletteRectangleAlign.Form:
- // // Gradient should cover the owning control (most likely a Form)
- // Rectangle formRect = Control.RectangleToClient(TopControl.RectangleToScreen(AlignControl.ClientRectangle));
- // formRect.Inflate(2, 2);
- // return formRect;
- // case PaletteRectangleAlign.Inherit:
- // default:
- // // Should never call this routine with inherit value
- // Debug.Assert(false);
- // throw new ArgumentOutOfRangeException(nameof(align));
- // }
- // }
- // #endregion
- // }
-}
\ No newline at end of file
diff --git a/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/Core/RenderDefinitions.cs b/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/Core/RenderDefinitions.cs
deleted file mode 100644
index 4e79fce6..00000000
--- a/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/Core/RenderDefinitions.cs
+++ /dev/null
@@ -1,886 +0,0 @@
-using ComponentFactory.Krypton.Toolkit;
-using System;
-using System.Drawing;
-using System.Drawing.Drawing2D;
-using System.Windows.Forms;
-
-namespace ExtendedControls.Base.Renderers.Core
-{
- #region IRenderer
- ///
- /// Exposes access to specialized renderers.
- ///
- public interface IRenderer
- {
- ///
- /// Gets the standard border renderer.
- ///
- IRenderBorder RenderStandardBorder { get; }
-
- ///
- /// Gets the standard background renderer.
- ///
- IRenderBack RenderStandardBack { get; }
-
- ///
- /// Gets the standard content renderer.
- ///
- IRenderContent RenderStandardContent { get; }
-
- ///
- /// Gets the tab border renderer.
- ///
- IRenderTabBorder RenderTabBorder { get; }
-
- ///
- /// Gets the ribbon renderer.
- ///
- IRenderRibbon RenderRibbon { get; }
-
- ///
- /// Gets the glpyh renderer.
- ///
- IRenderGlyph RenderGlyph { get; }
-
- ///
- /// Evaluate if transparent painting is needed for background palette.
- ///
- /// Background palette to test.
- /// Element state associated with palette.
- /// True if transparent painting required.
- bool EvalTransparentPaint(IPaletteBack paletteBack,
- PaletteState state);
-
- ///
- /// Evaluate if transparent painting is needed for background or border palettes.
- ///
- /// Background palette to test.
- /// Background palette to test.
- /// Element state associated with palette.
- /// True if transparent painting required.
- bool EvalTransparentPaint(IPaletteBack paletteBack,
- IPaletteBorder paletteBorder,
- PaletteState state);
-
- ///
- /// Gets a renderer for drawing the toolstrips.
- ///
- /// Color palette to use when rendering toolstrip.
- ToolStripRenderer RenderToolStrip(IPalette colorPalette);
- }
- #endregion
-
- #region IRenderBorder
- ///
- /// Exposes methods for drawing borders.
- ///
- public interface IRenderBorder
- {
- ///
- /// Gets the raw padding used per edge of the border.
- ///
- /// Palette used for drawing.
- /// State associated with rendering.
- /// Visual orientation of the border.
- /// Padding structure detailing all four edges.
- Padding GetBorderRawPadding(IPaletteBorder palette,
- PaletteState state,
- VisualOrientation orientation);
-
- ///
- /// Gets the padding used to position display elements completely inside border drawing.
- ///
- /// Palette used for drawing.
- /// State associated with rendering.
- /// Visual orientation of the border.
- /// Padding structure detailing all four edges.
- Padding GetBorderDisplayPadding(IPaletteBorder palette,
- PaletteState state,
- VisualOrientation orientation);
-
- ///
- /// Generate a graphics path that is the outside edge of the border.
- ///
- /// Rendering context.
- /// Target rectangle.
- /// Palette used for drawing.
- /// Visual orientation of the border.
- /// State associated with rendering.
- /// GraphicsPath instance.
- GraphicsPath GetOutsideBorderPath(RenderContext context,
- Rectangle rect,
- IPaletteBorder palette,
- VisualOrientation orientation,
- PaletteState state);
-
- ///
- /// Generate a graphics path that is in the middle of the border.
- ///
- /// Rendering context.
- /// Target rectangle.
- /// Palette used for drawing.
- /// Visual orientation of the border.
- /// State associated with rendering.
- /// GraphicsPath instance.
- GraphicsPath GetBorderPath(RenderContext context,
- Rectangle rect,
- IPaletteBorder palette,
- VisualOrientation orientation,
- PaletteState state);
-
- ///
- /// Generate a graphics path that encloses the border and is used when rendering a background to ensure the background does not draw over the border area.
- ///
- /// Rendering context.
- /// Target rectangle.
- /// Palette used for drawing.
- /// Visual orientation of the border.
- /// State associated with rendering.
- /// GraphicsPath instance.
- GraphicsPath GetBackPath(RenderContext context,
- Rectangle rect,
- IPaletteBorder palette,
- VisualOrientation orientation,
- PaletteState state);
-
- ///
- /// Draw border on the inside edge of the specified rectangle.
- ///
- /// Rendering context.
- /// Target rectangle.
- /// Palette used for drawing.
- /// Visual orientation of the border.
- /// State associated with rendering.
- void DrawBorder(RenderContext context,
- Rectangle rect,
- IPaletteBorder palette,
- VisualOrientation orientation,
- PaletteState state);
- }
- #endregion
-
- #region IRenderBack
- ///
- /// Exposes methods for drawing backgrounds.
- ///
- public interface IRenderBack
- {
- ///
- /// Draw background to fill the specified path.
- ///
- /// Rendering context.
- /// Target rectangle that encloses path.
- /// Graphics path.
- /// Palette used for drawing.
- /// Visual orientation of the background.
- /// State associated with rendering.
- /// Cache used for drawing.
- IDisposable DrawBack(RenderContext context,
- Rectangle rect,
- GraphicsPath path,
- IPaletteBack palette,
- VisualOrientation orientation,
- PaletteState state,
- IDisposable memento);
- }
- #endregion
-
- #region IRenderContent
- ///
- /// Exposes methods for drawing content.
- ///
- public interface IRenderContent
- {
- ///
- /// Get the preferred size for drawing the content.
- ///
- /// Layout context.
- /// Content palette details.
- /// Content values.
- /// Visual orientation of the content.
- /// State associated with rendering.
- /// Drawing onto a composition element.
- /// If composition, should glowing be drawn.
- /// Preferred size.
- Size GetContentPreferredSize(ViewLayoutContext context,
- IPaletteContent palette,
- IContentValues values,
- VisualOrientation orientation,
- PaletteState state,
- bool composition,
- bool glowing);
-
- ///
- /// Perform layout calculations on the provided content.
- ///
- /// Layout context.
- /// Space available for laying out.
- /// Content palette details.
- /// Content values.
- /// Visual orientation of the content.
- /// State associated with rendering.
- /// Drawing onto a composition element.
- /// If composition, should glowing be drawn.
- /// Memento with cached information.
- IDisposable LayoutContent(ViewLayoutContext context,
- Rectangle availableRect,
- IPaletteContent palette,
- IContentValues values,
- VisualOrientation orientation,
- PaletteState state,
- bool composition,
- bool glowing);
-
- ///
- /// Perform draw of content using provided memento.
- ///
- /// Render context.
- /// Display area available for drawing.
- /// Content palette details.
- /// Cached values from layout call.
- /// Visual orientation of the content.
- /// State associated with rendering.
- /// Drawing onto a composition element.
- /// If composition, should glowing be drawn.
- /// Allow drawing of focus rectangle.
- void DrawContent(RenderContext context,
- Rectangle displayRect,
- IPaletteContent palette,
- IDisposable memento,
- VisualOrientation orientation,
- PaletteState state,
- bool composition,
- bool glowing,
- bool allowFocusRect);
-
- ///
- /// Request the calculated display of the image.
- ///
- /// Cached values from layout call.
- /// True if the image is being displayed; otherwise false.
- bool GetContentImageDisplayed(IDisposable memento);
-
- ///
- /// Request the calculated position of the content image.
- ///
- /// Cached values from layout call.
- /// Display rectangle for the image content.
- Rectangle GetContentImageRectangle(IDisposable memento);
-
- ///
- /// Request the calculated display of the short text.
- ///
- /// Cached values from layout call.
- /// True if the short text is being displayed; otherwise false.
- bool GetContentShortTextDisplayed(IDisposable memento);
-
- ///
- /// Request the calculated position of the content short text.
- ///
- /// Cached values from layout call.
- /// Display rectangle for the image content.
- Rectangle GetContentShortTextRectangle(IDisposable memento);
-
- ///
- /// Request the calculated display of the long text.
- ///
- /// Cached values from layout call.
- /// True if the long text is being displayed; otherwise false.
- bool GetContentLongTextDisplayed(IDisposable memento);
-
- ///
- /// Request the calculated position of the content long text.
- ///
- /// Cached values from layout call.
- /// Display rectangle for the image content.
- Rectangle GetContentLongTextRectangle(IDisposable memento);
- }
- #endregion
-
- #region IRenderTabBorder
- ///
- /// Exposes methods for drawing tab borders.
- ///
- public interface IRenderTabBorder
- {
- ///
- /// Gets if the tabs should be drawn from left to right for z-ordering.
- ///
- /// Style of tab border.
- /// True for left to right, otherwise draw right to left.
- bool GetTabBorderLeftDrawing(TabBorderStyle tabBorderStyle);
-
- ///
- /// Gets the spacing used to separate each tab border instance.
- ///
- /// Style of tab border.
- /// Number of pixels to space instances.
- int GetTabBorderSpacingGap(TabBorderStyle tabBorderStyle);
-
- ///
- /// Gets the padding used to position display elements completely inside border drawing.
- ///
- /// Layout context.
- /// Palette used for drawing.
- /// State associated with rendering.
- /// Visual orientation of the border.
- /// Style of tab border.
- /// Padding structure detailing all four edges.
- Padding GetTabBorderDisplayPadding(ViewLayoutContext context,
- IPaletteBorder palette,
- PaletteState state,
- VisualOrientation orientation,
- TabBorderStyle tabBorderStyle);
-
- ///
- /// Generate a graphics path that encloses the border itself.
- ///
- /// Rendering context.
- /// Target rectangle.
- /// Palette used for drawing.
- /// Visual orientation of the border.
- /// State associated with rendering.
- /// Style of tab border.
- /// GraphicsPath instance.
- GraphicsPath GetTabBorderPath(RenderContext context,
- Rectangle rect,
- IPaletteBorder palette,
- VisualOrientation orientation,
- PaletteState state,
- TabBorderStyle tabBorderStyle);
-
- ///
- /// Generate a graphics path that encloses the border and is used when rendering a background to ensure the background does not draw over the border area.
- ///
- /// Rendering context.
- /// Target rectangle.
- /// Palette used for drawing.
- /// Visual orientation of the border.
- /// State associated with rendering.
- /// Style of tab border.
- /// GraphicsPath instance.
- GraphicsPath GetTabBackPath(RenderContext context,
- Rectangle rect,
- IPaletteBorder palette,
- VisualOrientation orientation,
- PaletteState state,
- TabBorderStyle tabBorderStyle);
-
- ///
- /// Draw border on the inside edge of the specified rectangle.
- ///
- /// Rendering context.
- /// Target rectangle.
- /// Palette used for drawing.
- /// Visual orientation of the border.
- /// State associated with rendering.
- /// Style of tab border.
- void DrawTabBorder(RenderContext context,
- Rectangle rect,
- IPaletteBorder palette,
- VisualOrientation orientation,
- PaletteState state,
- TabBorderStyle tabBorderStyle);
- }
- #endregion
-
- #region IRenderRibbon
- ///
- /// Exposes methods for drawing ribbon elements.
- ///
- public interface IRenderRibbon
- {
- ///
- /// Draw the background of a ribbon element.
- ///
- /// Ribbon shape.
- /// Rendering context.
- /// Target rectangle.
- /// State associated with rendering.
- /// Palette used for sourcing settings.
- /// Orientation for drawing.
- /// Drawing onto a composition element.
- /// Cached values to use when drawing.
- IDisposable DrawRibbonBack(PaletteRibbonShape shape,
- RenderContext context,
- Rectangle rect,
- PaletteState state,
- IPaletteRibbonBack palette,
- VisualOrientation orientation,
- bool composition,
- IDisposable memento);
-
- ///
- /// Draw a context ribbon tab title.
- ///
- /// Ribbon shape.
- /// Rendering context.
- /// Target rectangle.
- /// Palette used for general ribbon settings.
- /// Palette used for background ribbon settings.
- /// Cached values to use when drawing.
- IDisposable DrawRibbonTabContextTitle(PaletteRibbonShape shape,
- RenderContext context,
- Rectangle rect,
- IPaletteRibbonGeneral paletteGeneral,
- IPaletteRibbonBack paletteBack,
- IDisposable memento);
- ///
- /// Draw the application button.
- ///
- /// Ribbon shape.
- /// Rendering context.
- /// Target rectangle.
- /// State associated with rendering.
- /// Palette used for sourcing settings.
- /// Cached values to use when drawing.
- IDisposable DrawRibbonApplicationButton(PaletteRibbonShape shape,
- RenderContext context,
- Rectangle rect,
- PaletteState state,
- IPaletteRibbonBack palette,
- IDisposable memento);
-
- ///
- /// Draw the application tab.
- ///
- /// Ribbon shape.
- /// Rendering context.
- /// Target rectangle.
- /// State associated with rendering.
- /// Base color1 used for drawing the ribbon tab.
- /// Base color2 used for drawing the ribbon tab.
- /// Cached values to use when drawing.
- IDisposable DrawRibbonApplicationTab(PaletteRibbonShape shape,
- RenderContext context,
- Rectangle rect,
- PaletteState state,
- Color baseColor1,
- Color baseColor2,
- IDisposable memento);
-
- ///
- /// Perform drawing of a ribbon cluster edge.
- ///
- /// Ribbon shape.
- /// Render context.
- /// Display area available for drawing.
- /// Palette used for recovering drawing details.
- /// State associated with rendering.
- void DrawRibbonClusterEdge(PaletteRibbonShape shape,
- RenderContext context,
- Rectangle displayRect,
- IPaletteBack paletteBack,
- PaletteState state);
- }
- #endregion
-
- #region IRenderGlyph
- ///
- /// Exposes methods for drawing glyph elements.
- ///
- public interface IRenderGlyph
- {
- ///
- /// Perform drawing of a separator glyph.
- ///
- /// Render context.
- /// Display area available for drawing.
- /// Background palette details.
- /// Border palette details.
- /// Visual orientation of the content.
- /// State associated with rendering.
- /// Can the separator be moved.
- void DrawSeparator(RenderContext context,
- Rectangle displayRect,
- IPaletteBack paletteBack,
- IPaletteBorder paletteBorder,
- Orientation orientation,
- PaletteState state,
- bool canMove);
-
- ///
- /// Calculate the requested display size for the check box.
- ///
- /// Render context.
- /// Palette for sourcing display values.
- /// Should check box be displayed as enabled.
- /// The checked state of the check box.
- /// Should check box be displayed as hot tracking.
- /// Should check box be displayed as pressed.
- Size GetCheckBoxPreferredSize(ViewLayoutContext context,
- IPalette palette,
- bool enabled,
- CheckState checkState,
- bool tracking,
- bool pressed);
-
- ///
- /// Perform drawing of a check box.
- ///
- /// Render context.
- /// Display area available for drawing.
- /// Palette for sourcing display values.
- /// Should check box be displayed as enabled.
- /// The checked state of the check box.
- /// Should check box be displayed as hot tracking.
- /// Should check box be displayed as pressed.
- void DrawCheckBox(RenderContext context,
- Rectangle displayRect,
- IPalette palette,
- bool enabled,
- CheckState checkState,
- bool tracking,
- bool pressed);
-
- ///
- /// Calculate the requested display size for the radio button.
- ///
- /// Render context.
- /// Palette for sourcing display values.
- /// Should check box be displayed as enabled.
- /// Checked state of the radio button.
- /// Should check box be displayed as hot tracking.
- /// Should check box be displayed as pressed.
- Size GetRadioButtonPreferredSize(ViewLayoutContext context,
- IPalette palette,
- bool enabled,
- bool checkState,
- bool tracking,
- bool pressed);
-
- ///
- /// Perform drawing of a radio button.
- ///
- /// Render context.
- /// Display area available for drawing.
- /// Palette for sourcing display values.
- /// Should radio button be displayed as enabled.
- /// Checked state of the radio button.
- /// Should radio button be displayed as hot tracking.
- /// Should radio button be displayed as pressed.
- void DrawRadioButton(RenderContext context,
- Rectangle displayRect,
- IPalette palette,
- bool enabled,
- bool checkState,
- bool tracking,
- bool pressed);
-
- ///
- /// Calculate the requested display size for the drop down button.
- ///
- /// Render context.
- /// Palette for sourcing display values.
- /// State for which image size is needed.
- /// How to orientate the image.
- Size GetDropDownButtonPreferredSize(ViewLayoutContext context,
- IPalette palette,
- PaletteState state,
- VisualOrientation orientation);
-
- ///
- /// Perform drawing of a drop down button.
- ///
- /// Render context.
- /// Display area available for drawing.
- /// Palette for sourcing display values.
- /// State for which image size is needed.
- /// How to orientate the image.
- void DrawDropDownButton(RenderContext context,
- Rectangle displayRect,
- IPalette palette,
- PaletteState state,
- VisualOrientation orientation);
-
- ///
- /// Draw a drop down button image appropriate for a input control.
- ///
- /// Render context.
- /// Available drawing rectangle space.
- /// Content palette for getting colors.
- /// State associated with rendering.
- void DrawInputControlDropDownGlyph(RenderContext context,
- Rectangle cellRect,
- IPaletteContent paletteContent,
- PaletteState state);
-
- ///
- /// Draw a numeric up button image appropriate for a input control.
- ///
- /// Render context.
- /// Available drawing rectangle space.
- /// Content palette for getting colors.
- /// State associated with rendering.
- void DrawInputControlNumericUpGlyph(RenderContext context,
- Rectangle cellRect,
- IPaletteContent paletteContent,
- PaletteState state);
-
- ///
- /// Draw a numeric down button image appropriate for a input control.
- ///
- /// Render context.
- /// Available drawing rectangle space.
- /// Content palette for getting colors.
- /// State associated with rendering.
- void DrawInputControlNumericDownGlyph(RenderContext context,
- Rectangle cellRect,
- IPaletteContent paletteContent,
- PaletteState state);
-
- ///
- /// Perform drawing of a ribbon dialog box launcher glyph.
- ///
- /// Ribbon shape.
- /// Render context.
- /// Display area available for drawing.
- /// General ribbon palette details.
- /// State associated with rendering.
- void DrawRibbonDialogBoxLauncher(PaletteRibbonShape shape,
- RenderContext context,
- Rectangle displayRect,
- IPaletteRibbonGeneral paletteGeneral,
- PaletteState state);
-
- ///
- /// Perform drawing of a ribbon drop arrow glyph.
- ///
- /// Ribbon shape.
- /// Render context.
- /// Display area available for drawing.
- /// General ribbon palette details.
- /// State associated with rendering.
- void DrawRibbonDropArrow(PaletteRibbonShape shape,
- RenderContext context,
- Rectangle displayRect,
- IPaletteRibbonGeneral paletteGeneral,
- PaletteState state);
-
- ///
- /// Perform drawing of a ribbon context arrow glyph.
- ///
- /// Ribbon shape.
- /// Render context.
- /// Display area available for drawing.
- /// General ribbon palette details.
- /// State associated with rendering.
- void DrawRibbonContextArrow(PaletteRibbonShape shape,
- RenderContext context,
- Rectangle displayRect,
- IPaletteRibbonGeneral paletteGeneral,
- PaletteState state);
-
- ///
- /// Perform drawing of a ribbon overflow image.
- ///
- /// Ribbon shape.
- /// Render context.
- /// Display area available for drawing.
- /// General ribbon palette details.
- /// State associated with rendering.
- void DrawRibbonOverflow(PaletteRibbonShape shape,
- RenderContext context,
- Rectangle displayRect,
- IPaletteRibbonGeneral paletteGeneral,
- PaletteState state);
-
- ///
- /// Perform drawing of a ribbon group separator.
- ///
- /// Ribbon shape.
- /// Render context.
- /// Display area available for drawing.
- /// General ribbon palette details.
- /// State associated with rendering.
- void DrawRibbonGroupSeparator(PaletteRibbonShape shape,
- RenderContext context,
- Rectangle displayRect,
- IPaletteRibbonGeneral paletteGeneral,
- PaletteState state);
-
- ///
- /// Draw a grid sorting direction glyph.
- ///
- /// Render context.
- /// Sorting order of the glyph.
- /// Available drawing rectangle space.
- /// Palette to use for sourcing values.
- /// State associated with rendering.
- /// Should be drawn from right to left.
- /// Remainder space left over for other drawing.
- Rectangle DrawGridSortGlyph(RenderContext context,
- SortOrder sortOrder,
- Rectangle cellRect,
- IPaletteContent paletteContent,
- PaletteState state,
- bool rtl);
-
- ///
- /// Draw a grid row glyph.
- ///
- /// Render context.
- /// Row glyph.
- /// Available drawing rectangle space.
- /// Palette to use for sourcing values.
- /// State associated with rendering.
- /// Should be drawn from right to left.
- /// Remainder space left over for other drawing.
- Rectangle DrawGridRowGlyph(RenderContext context,
- GridRowGlyph rowGlyph,
- Rectangle cellRect,
- IPaletteContent paletteContent,
- PaletteState state,
- bool rtl);
-
- ///
- /// Draw a grid error glyph.
- ///
- /// Render context.
- /// Available drawing rectangle space.
- /// State associated with rendering.
- /// Should be drawn from right to left.
- /// Remainder space left over for other drawing.
- Rectangle DrawGridErrorGlyph(RenderContext context,
- Rectangle cellRect,
- PaletteState state,
- bool rtl);
-
- ///
- /// Draw a solid area glyph suitable for a drag drop area.
- ///
- /// Render context.
- /// Drawing rectangle space.
- /// Palette source of drawing values.
- void DrawDragDropSolidGlyph(RenderContext context,
- Rectangle drawRect,
- IPaletteDragDrop dragDropPalette);
-
- ///
- /// Measure the drag and drop docking glyphs.
- ///
- /// Set of drag docking data.
- /// Palette source of drawing values.
- /// Feedback requested.
- void MeasureDragDropDockingGlyph(RenderDragDockingData dragData,
- IPaletteDragDrop dragDropPalette,
- PaletteDragFeedback feedback);
-
- ///
- /// Draw a solid area glyph suitable for a drag drop area.
- ///
- /// Render context.
- /// Set of drag docking data.
- /// Palette source of drawing values.
- /// Feedback requested.
- void DrawDragDropDockingGlyph(RenderContext context,
- RenderDragDockingData dragData,
- IPaletteDragDrop dragDropPalette,
- PaletteDragFeedback feedback);
-
- ///
- /// Draw the track bar ticks glyph.
- ///
- /// Render context.
- /// Element state.
- /// Source of palette colors.
- /// Drawing rectangle that should contain ticks.
- /// Orientation of the drawing area.
- /// Drawing on the topRight or the bottomLeft.
- /// Size of the position indicator.
- /// First value.
- /// Last value.
- /// How often ticks are drawn.
- void DrawTrackTicksGlyph(RenderContext context,
- PaletteState state,
- IPaletteElementColor elementPalette,
- Rectangle drawRect,
- Orientation orientation,
- bool topRight,
- Size positionSize,
- int minimum,
- int maximum,
- int frequency);
-
- ///
- /// Draw the track bar track glyph.
- ///
- /// Render context.
- /// Element state.
- /// Source of palette colors.
- /// Drawing rectangle that should contain the track.
- /// Drawing orientation.
- /// Drawing as a volume control or standard slider.
- void DrawTrackGlyph(RenderContext context,
- PaletteState state,
- IPaletteElementColor elementPalette,
- Rectangle drawRect,
- Orientation orientation,
- bool volumeControl);
-
- ///
- /// Draw the track bar position glyph.
- ///
- /// Render context.
- /// Element state.
- /// Source of palette colors.
- /// Drawing rectangle that should contain the track.
- /// Drawing orientation.
- /// Tick marks that surround the position.
- void DrawTrackPositionGlyph(RenderContext context,
- PaletteState state,
- IPaletteElementColor elementPalette,
- Rectangle drawRect,
- Orientation orientation,
- TickStyle tickStyle);
- }
- #endregion
-
- #region Enum RenderMode
- ///
- /// Specifies the renderer to use when painting.
- ///
- public enum RendererMode
- {
- ///
- /// Specifies the renderer be inherited from the base palette.
- ///
- Inherit,
-
- ///
- /// Specifies the RenderSparkle be used.
- ///
- Sparkle,
-
- ///
- /// Specifies the RenderOffice2007 be used.
- ///
- Office2007,
-
- ///
- /// Specifies the RenderOffice2010 be used.
- ///
- Office2010,
-
- ///
- /// Specifies the RenderOffice2013 be used.
- ///
- Office2013,
-
- ///
- /// Specifies the RenderProfessional be used.
- ///
- Professional,
-
- ///
- /// Specifies the RenderStandard be used.
- ///
- Standard,
-
- ///
- /// Specifies a custom renderer be used.
- ///
- Custom
- }
- #endregion
-}
\ No newline at end of file
diff --git a/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/Core/RenderDragDockingData.cs b/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/Core/RenderDragDockingData.cs
deleted file mode 100644
index 22217382..00000000
--- a/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/Core/RenderDragDockingData.cs
+++ /dev/null
@@ -1,247 +0,0 @@
-using ComponentFactory.Krypton.Toolkit;
-using System.Drawing;
-
-namespace ExtendedControls.Base.Renderers.Core
-{
- ///
- /// Aggregates information needed for rendering drag and drop indicators.
- ///
- public class RenderDragDockingData
- {
- #region Instance Fields
- private int _showTotal;
- private BoolFlags31 _flags;
- private readonly Rectangle[] _rects;
-
- #endregion
-
- #region Identity
- ///
- /// Initialize a new instance of the PaletteDragData class.
- ///
- /// Should the left docking indicator be shown.
- /// Should the right docking indicator be shown.
- /// Should the top docking indicator be shown.
- /// Should the bottom docking indicator be shown.
- /// Should the middle docking indicator be shown.
- public RenderDragDockingData(bool showLeft, bool showRight,
- bool showTop, bool showBottom,
- bool showMiddle)
- {
- _flags = new BoolFlags31();
-
- // Set initial settings (ShowBack is auto calculated from other flags)
- ShowLeft = showLeft;
- ShowRight = showRight;
- ShowTop = showTop;
- ShowBottom = showBottom;
- ShowMiddle = showMiddle;
-
- // Default valies
- DockWindowSize = Size.Empty;
- _rects = new Rectangle[5];
- for (int i = 0; i < _rects.Length; i++)
- {
- _rects[i] = Rectangle.Empty;
- }
- }
- #endregion
-
- #region Public
- ///
- /// Gets the visible state of the background.
- ///
- public bool ShowBack => (_showTotal > 1);
-
- ///
- /// Gets and sets the visible state of the left indicator.
- ///
- public bool ShowLeft
- {
- get => _flags.AreFlagsSet(0x0002);
- set => UpdateShowFlag(value, 0x0002);
- }
-
- ///
- /// Gets and sets the visible state of the right indicator.
- ///
- public bool ShowRight
- {
- get => _flags.AreFlagsSet(0x0004);
- set => UpdateShowFlag(value, 0x0004);
- }
-
- ///
- /// Gets and sets the visible state of the top indicator.
- ///
- public bool ShowTop
- {
- get => _flags.AreFlagsSet(0x0008);
- set => UpdateShowFlag(value, 0x0008);
- }
-
- ///
- /// Gets and sets the visible state of the bottom indicator.
- ///
- public bool ShowBottom
- {
- get => _flags.AreFlagsSet(0x0010);
- set => UpdateShowFlag(value, 0x0010);
- }
-
- ///
- /// Gets and sets the visible state of the middle indicator.
- ///
- public bool ShowMiddle
- {
- get => _flags.AreFlagsSet(0x0020);
- set => UpdateShowFlag(value, 0x0020);
- }
-
- ///
- /// Gets the set of flags associated with active
- ///
- public int ActiveFlags => _flags.Flags & 0x07C0;
-
- ///
- /// Gets and sets the active state of left indicator.
- ///
- public bool ActiveLeft
- {
- get => _flags.AreFlagsSet(0x0040);
- set => UpdateFlag(value, 0x0040);
- }
-
- ///
- /// Gets and sets the active state of right indicator.
- ///
- public bool ActiveRight
- {
- get => _flags.AreFlagsSet(0x0080);
- set => UpdateFlag(value, 0x0080);
- }
-
- ///
- /// Gets and sets the active state of top indicator.
- ///
- public bool ActiveTop
- {
- get => _flags.AreFlagsSet(0x0100);
- set => UpdateFlag(value, 0x0100);
- }
-
- ///
- /// Gets and sets the active state of bottom indicator.
- ///
- public bool ActiveBottom
- {
- get => _flags.AreFlagsSet(0x0200);
- set => UpdateFlag(value, 0x0200);
- }
-
- ///
- /// Gets and sets the active state of middle indicator.
- ///
- public bool ActiveMiddle
- {
- get => _flags.AreFlagsSet(0x0400);
- set => UpdateFlag(value, 0x0400);
- }
-
- ///
- /// Gets if any of the docking indicators are active.
- ///
- public bool AnyActive => (ActiveFlags != 0);
-
- ///
- /// Clear all the active flags.
- ///
- public void ClearActive()
- {
- _flags.ClearFlags(0x07C0);
- }
-
- ///
- /// Gets and sets the hot rectangle of the left docking indicator.
- ///
- public Rectangle RectLeft
- {
- get => _rects[0];
- set => _rects[0] = value;
- }
-
- ///
- /// Gets and sets the hot rectangle of the right docking indicator.
- ///
- public Rectangle RectRight
- {
- get => _rects[1];
- set => _rects[1] = value;
- }
-
- ///
- /// Gets and sets the hot rectangle of the top docking indicator.
- ///
- public Rectangle RectTop
- {
- get => _rects[2];
- set => _rects[2] = value;
- }
-
- ///
- /// Gets and sets the hot rectangle of the bottom docking indicator.
- ///
- public Rectangle RectBottom
- {
- get => _rects[3];
- set => _rects[3] = value;
- }
-
- ///
- /// Gets and sets the hot rectangle of the middle docking indicator.
- ///
- public Rectangle RectMiddle
- {
- get => _rects[4];
- set => _rects[4] = value;
- }
-
- ///
- /// Gets and sets size of the docking window required.
- ///
- public Size DockWindowSize { get; set; }
-
- #endregion
-
- #region Implementation
- private void UpdateFlag(bool value, int flag)
- {
- if (value)
- {
- _flags.SetFlags(flag);
- }
- else
- {
- _flags.ClearFlags(flag);
- }
- }
-
- private void UpdateShowFlag(bool value, int flag)
- {
- if (value != _flags.AreFlagsSet(flag))
- {
- if (value)
- {
- _flags.SetFlags(flag);
- _showTotal++;
- }
- else
- {
- _flags.ClearFlags(flag);
- _showTotal--;
- }
- }
- }
- #endregion
- }
-}
\ No newline at end of file
diff --git a/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/Core/RenderExpertHelpers.cs b/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/Core/RenderExpertHelpers.cs
deleted file mode 100644
index 2ba2a7c5..00000000
--- a/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/Core/RenderExpertHelpers.cs
+++ /dev/null
@@ -1,528 +0,0 @@
-using ComponentFactory.Krypton.Toolkit;
-using System;
-using System.Drawing;
-using System.Drawing.Drawing2D;
-
-namespace ExtendedControls.Base.Renderers.Core
-{
- ///
- /// Helper functions for drawing in the glass styles.
- ///
- internal class RenderExpertHelpers
- {
- #region Static Fields
- private static readonly Blend _rounded1Blend;
- private static readonly Blend _rounded2Blend;
- private const float ITEM_CUT = 1.7f;
-
- #endregion
-
- #region Identity
- static RenderExpertHelpers()
- {
- _rounded1Blend = new Blend
- {
- Positions = new float[] { 0.0f, 0.1f, 1.0f },
- Factors = new float[] { 0.0f, 1.0f, 1.0f }
- };
-
- _rounded2Blend = new Blend
- {
- Positions = new float[] { 0.0f, 0.50f, 0.75f, 1.0f },
- Factors = new float[] { 0.0f, 1.0f, 1.0f, 1.0f }
- };
- }
- #endregion
-
- #region Static Public
- ///
- /// Draw a background for an expert style button with tracking effect.
- ///
- /// Rendering context.
- /// Rectangle to draw.
- /// First color.
- /// Second color.
- /// Drawing orientation.
- /// Clipping path.
- /// Cache used for drawing.
- public static IDisposable DrawBackExpertTracking(RenderContext context,
- Rectangle rect,
- Color backColor1,
- Color backColor2,
- VisualOrientation orientation,
- GraphicsPath path,
- IDisposable memento)
- {
- using (Clipping clip = new Clipping(context.Graphics, path))
- {
- MementoDouble cache;
-
- if (!(memento is MementoDouble))
- {
- memento?.Dispose();
-
- cache = new MementoDouble();
- memento = cache;
- }
- else
- {
- cache = (MementoDouble)memento;
- }
-
- cache.first = DrawBackExpert(rect,
- CommonHelper.MergeColors(backColor1, 0.35f, Color.White, 0.65f),
- CommonHelper.MergeColors(backColor2, 0.53f, Color.White, 0.65f),
- orientation, context.Graphics, memento, true, true);
-
- cache.second = DrawBackExpert(rect, backColor1, backColor2, orientation, context.Graphics, memento, false, true);
-
- return cache;
- }
- }
-
- ///
- /// Draw a background for an expert style button with pressed effect.
- ///
- /// Rendering context.
- /// Rectangle to draw.
- /// First color.
- /// Second color.
- /// Drawing orientation.
- /// Clipping path.
- /// Cache used for drawing.
- public static IDisposable DrawBackExpertPressed(RenderContext context,
- Rectangle rect,
- Color backColor1,
- Color backColor2,
- VisualOrientation orientation,
- GraphicsPath path,
- IDisposable memento)
- {
- using (Clipping clip = new Clipping(context.Graphics, path))
- {
- // Cannot draw a zero length rectangle
- if ((rect.Width > 0) && (rect.Height > 0))
- {
- bool generate = true;
- MementoBackExpertShadow cache;
-
- // Access a cache instance and decide if cache resources need generating
- if (!(memento is MementoBackExpertShadow))
- {
- memento?.Dispose();
-
- cache = new MementoBackExpertShadow(rect, backColor1, backColor2);
- memento = cache;
- }
- else
- {
- cache = (MementoBackExpertShadow)memento;
- generate = !cache.UseCachedValues(rect, backColor1, backColor2);
- }
-
- // Do we need to generate the contents of the cache?
- if (generate)
- {
- rect.X -= 1;
- rect.Y -= 1;
- rect.Width += 2;
- rect.Height += 2;
-
- // Dispose of existing values
- cache.Dispose();
- cache.path1 = CreateBorderPath(rect, ITEM_CUT);
- cache.path2 = CreateBorderPath(new Rectangle(rect.X + 1, rect.Y + 1, rect.Width - 2, rect.Height - 2), ITEM_CUT);
- cache.path3 = CreateBorderPath(new Rectangle(rect.X + 2, rect.Y + 2, rect.Width - 4, rect.Height - 4), ITEM_CUT);
- cache.brush1 = new SolidBrush(CommonHelper.MergeColors(backColor2, 0.4f, backColor1, 0.6f));
- cache.brush2 = new SolidBrush(CommonHelper.MergeColors(backColor2, 0.2f, backColor1, 0.8f));
- cache.brush3 = new SolidBrush(backColor1);
- }
-
- using (AntiAlias aa = new AntiAlias(context.Graphics))
- {
- context.Graphics.FillRectangle(cache.brush3, rect);
- context.Graphics.FillPath(cache.brush1, cache.path1);
- context.Graphics.FillPath(cache.brush2, cache.path2);
- context.Graphics.FillPath(cache.brush3, cache.path3);
- }
- }
-
- return memento;
- }
- }
-
- ///
- /// Draw a background for an expert style button that is checked.
- ///
- /// Rendering context.
- /// Rectangle to draw.
- /// First color.
- /// Second color.
- /// Drawing orientation.
- /// Clipping path.
- /// Cache used for drawing.
- public static IDisposable DrawBackExpertChecked(RenderContext context,
- Rectangle rect,
- Color backColor1,
- Color backColor2,
- VisualOrientation orientation,
- GraphicsPath path,
- IDisposable memento)
- {
- using (Clipping clip = new Clipping(context.Graphics, path))
- {
- // Draw the expert background which is gradient with highlight at bottom
- return DrawBackExpert(rect, backColor1, backColor2, orientation, context.Graphics, memento, true, false);
- }
- }
-
- ///
- /// Draw a background for an expert style button that is checked and tracking.
- ///
- /// Rendering context.
- /// Rectangle to draw.
- /// First color.
- /// Second color.
- /// Drawing orientation.
- /// Clipping path.
- /// Cache used for drawing.
- public static IDisposable DrawBackExpertCheckedTracking(RenderContext context,
- Rectangle rect,
- Color backColor1,
- Color backColor2,
- VisualOrientation orientation,
- GraphicsPath path,
- IDisposable memento)
- {
- using (Clipping clip = new Clipping(context.Graphics, path))
- {
- MementoDouble cache;
-
- if (!(memento is MementoDouble))
- {
- memento?.Dispose();
-
- cache = new MementoDouble();
- memento = cache;
- }
- else
- {
- cache = (MementoDouble)memento;
- }
-
- cache.first = DrawBackExpert(rect,
- CommonHelper.MergeColors(backColor1, 0.5f, Color.White, 0.5f),
- CommonHelper.MergeColors(backColor2, 0.5f, Color.White, 0.5f),
- orientation, context.Graphics, memento, true, false);
-
- cache.second = DrawBackExpert(rect, backColor1, backColor2, orientation, context.Graphics, memento, false, false);
-
- return cache;
- }
- }
-
- ///
- /// Draw a background for an expert style button has a square inside with highlight.
- ///
- /// Rendering context.
- /// Rectangle to draw.
- /// First color.
- /// Second color.
- /// Drawing orientation.
- /// Clipping path.
- /// Cache used for drawing.
- /// Use the 'light' variation.
- public static IDisposable DrawBackExpertSquareHighlight(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- Color backColor1,
- Color backColor2,
- VisualOrientation orientation,
- GraphicsPath path,
- IDisposable memento,
- bool light)
- {
- using (Clipping clip = new Clipping(context.Graphics, path))
- {
- // Cannot draw a zero length rectangle
- if ((rect.Width > 0) && (rect.Height > 0))
- {
- bool generate = true;
- MementoBackExpertSquareHighlight cache;
-
- // Access a cache instance and decide if cache resources need generating
- if (!(memento is MementoBackExpertSquareHighlight))
- {
- memento?.Dispose();
-
- cache = new MementoBackExpertSquareHighlight(rect, backColor1, backColor2, orientation);
- memento = cache;
- }
- else
- {
- cache = (MementoBackExpertSquareHighlight)memento;
- generate = !cache.UseCachedValues(rect, backColor1, backColor2, orientation);
- }
-
- // Do we need to generate the contents of the cache?
- if (generate)
- {
- // Dispose of existing values
- cache.Dispose();
-
- cache.backBrush = new SolidBrush(CommonHelper.WhitenColor(backColor1, 0.8f, 0.8f, 0.8f));
- cache.innerRect = new Rectangle(rect.X + 1, rect.Y + 1, rect.Width - 2, rect.Height - 2);
-
- RectangleF ellipseRect;
- PointF ellipseCenter;
- int ellipseWidth = Math.Max(1, rect.Width / 8);
- int ellipseHeight = Math.Max(1, rect.Height / 8);
-
- switch (orientation)
- {
- default:
- case VisualOrientation.Top:
- cache.innerBrush = new LinearGradientBrush(cache.innerRect, backColor1, backColor2, 90f);
- ellipseRect = new RectangleF(rect.Left, rect.Top + (ellipseHeight * 2), rect.Width, ellipseHeight * 12);
- ellipseCenter = new PointF(ellipseRect.Left + (ellipseRect.Width / 2), ellipseRect.Bottom);
- break;
- case VisualOrientation.Bottom:
- cache.innerBrush = new LinearGradientBrush(cache.innerRect, backColor1, backColor2, 270f);
- ellipseRect = new RectangleF(rect.Left, rect.Top - (ellipseHeight * 6), rect.Width, ellipseHeight * 12);
- ellipseCenter = new PointF(ellipseRect.Left + (ellipseRect.Width / 2), ellipseRect.Top);
- break;
- case VisualOrientation.Left:
- cache.innerBrush = new LinearGradientBrush(cache.innerRect, backColor1, backColor2, 180f);
- ellipseRect = new RectangleF(rect.Left + (ellipseHeight * 2), rect.Top, ellipseWidth * 12, rect.Height);
- ellipseCenter = new PointF(ellipseRect.Right, ellipseRect.Top + (ellipseRect.Height / 2));
- break;
- case VisualOrientation.Right:
- cache.innerBrush = new LinearGradientBrush(rect, backColor1, backColor2, 0f);
- ellipseRect = new RectangleF(rect.Left - (ellipseHeight * 6), rect.Top, ellipseWidth * 12, rect.Height);
- ellipseCenter = new PointF(ellipseRect.Left, ellipseRect.Top + (ellipseRect.Height / 2));
- break;
- }
-
- cache.innerBrush.SetSigmaBellShape(0.5f);
- cache.ellipsePath = new GraphicsPath();
- cache.ellipsePath.AddEllipse(ellipseRect);
- cache.insideLighten = new PathGradientBrush(cache.ellipsePath)
- {
- CenterPoint = ellipseCenter,
- CenterColor = (light ? Color.FromArgb(64, Color.White) : Color.FromArgb(128, Color.White)),
- Blend = _rounded2Blend,
- SurroundColors = new Color[] { Color.Transparent }
- };
- }
-
- context.Graphics.FillRectangle(cache.backBrush, rect);
- context.Graphics.FillRectangle(cache.innerBrush, cache.innerRect);
- context.Graphics.FillRectangle(cache.insideLighten, cache.innerRect);
- }
-
- return memento;
- }
- }
- #endregion
-
- #region Implementation
- private static IDisposable DrawBackSolid(RectangleF drawRect,
- Color color1,
- Graphics g,
- IDisposable memento)
- {
- // Cannot draw a zero length rectangle
- if ((drawRect.Width > 0) && (drawRect.Height > 0))
- {
- bool generate = true;
- MementoBackSolid cache;
-
- // Access a cache instance and decide if cache resources need generating
- if (!(memento is MementoBackSolid))
- {
- memento?.Dispose();
-
- cache = new MementoBackSolid(drawRect, color1);
- memento = cache;
- }
- else
- {
- cache = (MementoBackSolid)memento;
- generate = !cache.UseCachedValues(drawRect, color1);
- }
-
- // Do we need to generate the contents of the cache?
- if (generate)
- {
- // Dispose of existing values
- cache.Dispose();
- cache.solidBrush = new SolidBrush(color1);
- }
-
- if (cache.solidBrush != null)
- {
- g.FillRectangle(cache.solidBrush, drawRect);
- }
- }
-
- return memento;
- }
-
- private static IDisposable DrawBackExpert(Rectangle drawRect,
- Color color1,
- Color color2,
- VisualOrientation orientation,
- Graphics g,
- IDisposable memento,
- bool total,
- bool tracking)
- {
- // Cannot draw a zero length rectangle
- if ((drawRect.Width > 0) && (drawRect.Height > 0))
- {
- bool generate = true;
- MementoBackExpertChecked cache;
-
- // Access a cache instance and decide if cache resources need generating
- if (!(memento is MementoBackExpertChecked))
- {
- memento?.Dispose();
-
- cache = new MementoBackExpertChecked(drawRect, color1, color2, orientation);
- memento = cache;
- }
- else
- {
- cache = (MementoBackExpertChecked)memento;
- generate = !cache.UseCachedValues(drawRect, color1, color2, orientation);
- }
-
- // Do we need to generate the contents of the cache?
- if (generate)
- {
- // Dispose of existing values
- cache.Dispose();
-
- // If not drawing total area...
- if (!total)
- {
- // Update to draw the inside area instead
- drawRect.Inflate(-1, -1);
-
- cache.drawRect = drawRect;
- cache.clipPath = new GraphicsPath();
- cache.clipPath.AddLine(drawRect.X + 1, drawRect.Y, drawRect.Right - 1, drawRect.Y);
- cache.clipPath.AddLine(drawRect.Right - 1, drawRect.Y, drawRect.Right, drawRect.Y + 1);
- cache.clipPath.AddLine(drawRect.Right, drawRect.Y + 1, drawRect.Right, drawRect.Bottom - 2);
- cache.clipPath.AddLine(drawRect.Right, drawRect.Bottom - 2, drawRect.Right - 2, drawRect.Bottom);
- cache.clipPath.AddLine(drawRect.Right - 2, drawRect.Bottom, drawRect.Left + 1, drawRect.Bottom);
- cache.clipPath.AddLine(drawRect.Left + 1, drawRect.Bottom, drawRect.Left, drawRect.Bottom - 2);
- cache.clipPath.AddLine(drawRect.Left, drawRect.Bottom - 2, drawRect.Left, drawRect.Y + 1);
- cache.clipPath.AddLine(drawRect.Left, drawRect.Y + 1, drawRect.X + 1, drawRect.Y);
- }
- else
- {
- cache.clipPath = new GraphicsPath();
- cache.clipPath.AddRectangle(drawRect);
- }
-
- // Create rectangle that covers the enter area
- RectangleF gradientRect = new RectangleF(drawRect.X - 1, drawRect.Y - 1, drawRect.Width + 2, drawRect.Height + 2);
-
- // Cannot draw a zero length rectangle
- if ((gradientRect.Width > 0) && (gradientRect.Height > 0))
- {
- // Draw entire area in a gradient color effect
- cache.entireBrush = new LinearGradientBrush(gradientRect, CommonHelper.WhitenColor(color1, 0.92f, 0.92f, 0.92f), color1, AngleFromOrientation(orientation))
- {
- Blend = _rounded1Blend
- };
- }
-
- RectangleF ellipseRect;
- PointF ellipseCenter;
- int ellipseHeight = Math.Max(1, drawRect.Height / 4);
- int ellipseWidth = Math.Max(1, (tracking ? drawRect.Width : drawRect.Width / 4));
-
- // Ellipse is based on the orientation
- switch (orientation)
- {
- default:
- case VisualOrientation.Top:
- ellipseRect = new RectangleF(drawRect.Left - ellipseWidth, drawRect.Bottom - ellipseHeight, drawRect.Width + (ellipseWidth * 2), ellipseHeight * 2);
- ellipseCenter = new PointF(ellipseRect.Left + (ellipseRect.Width / 2), ellipseRect.Bottom);
- break;
- case VisualOrientation.Bottom:
- ellipseRect = new RectangleF(drawRect.Left - ellipseWidth, drawRect.Top - ellipseHeight, drawRect.Width + (ellipseWidth * 2), ellipseHeight * 2);
- ellipseCenter = new PointF(ellipseRect.Left + (ellipseRect.Width / 2), ellipseRect.Top);
- break;
- case VisualOrientation.Left:
- ellipseRect = new RectangleF(drawRect.Right - ellipseWidth, drawRect.Top - ellipseHeight, ellipseWidth * 2, drawRect.Height + (ellipseHeight * 2));
- ellipseCenter = new PointF(ellipseRect.Right, ellipseRect.Top + (ellipseRect.Height / 2));
- break;
- case VisualOrientation.Right:
- ellipseRect = new RectangleF(drawRect.Left - ellipseWidth, drawRect.Top - ellipseHeight, ellipseWidth * 2, drawRect.Height + (ellipseHeight * 2));
- ellipseCenter = new PointF(ellipseRect.Left, ellipseRect.Top + (ellipseRect.Height / 2));
- break;
- }
-
- cache.ellipsePath = new GraphicsPath();
- cache.ellipsePath.AddEllipse(ellipseRect);
- cache.insideLighten = new PathGradientBrush(cache.ellipsePath)
- {
- CenterPoint = ellipseCenter,
- CenterColor = color2,
- Blend = _rounded2Blend,
- SurroundColors = new Color[] { Color.Transparent }
- };
- }
-
- if (cache.entireBrush != null)
- {
- using (Clipping clip = new Clipping(g, cache.clipPath))
- {
- g.FillRectangle(cache.entireBrush, cache.drawRect);
- g.FillPath(cache.insideLighten, cache.ellipsePath);
- }
- }
- }
-
- return memento;
- }
-
- private static GraphicsPath CreateBorderPath(Rectangle rect, float cut)
- {
- // Drawing lines requires we draw inside the area we want
- rect.Width--;
- rect.Height--;
-
- // Create path using a simple set of lines that cut the corner
- GraphicsPath path = new GraphicsPath();
- path.AddLine(rect.Left + cut, rect.Top, rect.Right - cut, rect.Top);
- path.AddLine(rect.Right - cut, rect.Top, rect.Right, rect.Top + cut);
- path.AddLine(rect.Right, rect.Top + cut, rect.Right, rect.Bottom - cut);
- path.AddLine(rect.Right, rect.Bottom - cut, rect.Right - cut, rect.Bottom);
- path.AddLine(rect.Right - cut, rect.Bottom, rect.Left + cut, rect.Bottom);
- path.AddLine(rect.Left + cut, rect.Bottom, rect.Left, rect.Bottom - cut);
- path.AddLine(rect.Left, rect.Bottom - cut, rect.Left, rect.Top + cut);
- path.AddLine(rect.Left, rect.Top + cut, rect.Left + cut, rect.Top);
- return path;
- }
-
- private static float AngleFromOrientation(VisualOrientation orientation)
- {
- switch (orientation)
- {
- case VisualOrientation.Bottom:
- return 270f;
- case VisualOrientation.Left:
- return 0f;
- case VisualOrientation.Right:
- return 180;
- case VisualOrientation.Top:
- default:
- return 90f;
- }
- }
- #endregion
- }
-}
\ No newline at end of file
diff --git a/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/Core/RenderGlassHelpers.cs b/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/Core/RenderGlassHelpers.cs
deleted file mode 100644
index ef1a61f9..00000000
--- a/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/Core/RenderGlassHelpers.cs
+++ /dev/null
@@ -1,1876 +0,0 @@
-using ComponentFactory.Krypton.Toolkit;
-using System;
-using System.Drawing;
-using System.Drawing.Drawing2D;
-using System.Windows.Forms;
-
-namespace ExtendedControls.Base.Renderers.Core
-{
- ///
- /// Helper functions for drawing in the glass styles.
- ///
- internal class RenderGlassHelpers
- {
- #region Static Fields
- private static readonly Color _glassColorTopL = Color.FromArgb(208, Color.White);
- private static readonly Color _glassColorBottomL = Color.FromArgb(96, Color.White);
- private static readonly Color _glassColorTopD = Color.FromArgb(164, Color.White);
- private static readonly Color _glassColorBottomD = Color.FromArgb(64, Color.White);
- private static readonly Color _glassColorLight = Color.FromArgb(96, Color.White);
- private static readonly Color _glassColorTopDD = Color.FromArgb(128, Color.White);
- private static readonly Color _glassColorBottomDD = Color.FromArgb(48, Color.White);
- private static readonly Blend _glassFadeBlend;
- private const float FULL_GLASS_LENGTH = 0.45f;
- private const float STUMPY_GLASS_LENGTH = 0.19f;
-
- #endregion
-
- #region Identity
- static RenderGlassHelpers()
- {
- _glassFadeBlend = new Blend
- {
- Positions = new float[] { 0.0f, 0.33f, 0.66f, 1.0f },
- Factors = new float[] { 0.0f, 0.0f, 0.8f, 1.0f }
- };
- }
- #endregion
-
- #region Static Public
- ///
- /// Draw a background with glass effect where the fade is from the center.
- ///
- /// Rendering context.
- /// Rectangle to draw.
- /// First color.
- /// Second color.
- /// Drawing orientation.
- /// Clipping path.
- /// Cache used for drawing.
- public static IDisposable DrawBackGlassCenter(RenderContext context,
- Rectangle rect,
- Color backColor1,
- Color backColor2,
- VisualOrientation orientation,
- GraphicsPath path,
- IDisposable memento)
- {
- using (Clipping clip = new Clipping(context.Graphics, path))
- {
- MementoDouble cache;
-
- if (!(memento is MementoDouble))
- {
- memento?.Dispose();
-
- cache = new MementoDouble();
- memento = cache;
- }
- else
- {
- cache = (MementoDouble)memento;
- }
-
- // Draw the one pixel border around the area
- cache.first = DrawBackLinearRadial(rect, false,
- ControlPaint.LightLight(backColor2),
- ControlPaint.Light(backColor2),
- ControlPaint.LightLight(backColor2),
- orientation, context.Graphics,
- cache.first);
-
- // Reduce size of the inside area
- rect.Inflate(-1, -1);
-
- // Draw the inside area as a glass effect
- cache.second = DrawBackGlassCenter(rect, backColor1, backColor2,
- _glassColorTopL, _glassColorBottomL,
- 2f, 1f, orientation, context.Graphics,
- FULL_GLASS_LENGTH, cache.second);
- }
-
- return memento;
- }
-
- ///
- /// Draw a background with glass effect where the fade is from the bottom.
- ///
- /// Rendering context.
- /// Rectangle to draw.
- /// First color.
- /// Second color.
- /// Drawing orientation.
- /// Clipping path.
- /// Cache used for drawing.
- public static IDisposable DrawBackGlassBottom(RenderContext context,
- Rectangle rect,
- Color backColor1,
- Color backColor2,
- VisualOrientation orientation,
- GraphicsPath path,
- IDisposable memento)
- {
- using (Clipping clip = new Clipping(context.Graphics, path))
- {
- MementoDouble cache;
-
- if (!(memento is MementoDouble))
- {
- memento?.Dispose();
-
- cache = new MementoDouble();
- memento = cache;
- }
- else
- {
- cache = (MementoDouble)memento;
- }
-
- // Draw the one pixel border around the area
- cache.first = DrawBackLinear(rect, false,
- ControlPaint.Light(backColor1),
- ControlPaint.LightLight(backColor1),
- orientation, context.Graphics,
- cache.first);
-
- // Reduce size on all but the upper edge
- ModifyRectByEdges(ref rect, 1, 0, 1, 1, orientation);
-
- // Draw the inside areas as a glass effect
- cache.second = DrawBackGlassRadial(rect, backColor1, backColor2,
- _glassColorTopD, _glassColorBottomD,
- 3f, 1.1f, orientation, context.Graphics,
- FULL_GLASS_LENGTH, cache.second);
- }
-
- return memento;
- }
-
- ///
- /// Draw a background in normal full glass effect but only over 50% of the background.
- ///
- /// Rendering context.
- /// Rectangle to draw.
- /// First color.
- /// Second color.
- /// Drawing orientation.
- /// Clipping path.
- /// Cache used for drawing.
- public static IDisposable DrawBackGlassFade(RenderContext context,
- Rectangle rect,
- Color backColor1,
- Color backColor2,
- VisualOrientation orientation,
- GraphicsPath path,
- IDisposable memento)
- {
- using (Clipping clip = new Clipping(context.Graphics, path))
- {
- MementoDouble cache;
-
- if (!(memento is MementoDouble))
- {
- memento?.Dispose();
-
- cache = new MementoDouble();
- memento = cache;
- }
- else
- {
- cache = (MementoDouble)memento;
- }
-
- cache.first = DrawBackGlassFade(rect, rect,
- backColor1, backColor2,
- _glassColorTopL,
- _glassColorBottomL,
- orientation,
- context.Graphics,
- cache.first);
-
- cache.second = DrawBackDarkEdge(rect, ControlPaint.Dark(backColor1),
- 3, orientation, context.Graphics,
- cache.second);
- }
-
- return memento;
- }
-
- ///
- /// Draw a background in simple glass effect.
- ///
- /// Rendering context.
- /// Rectangle to draw.
- /// First color.
- /// Second color.
- /// Drawing orientation.
- /// Clipping path.
- /// Cache used for drawing.
- public static IDisposable DrawBackGlassSimpleFull(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- Color backColor1,
- Color backColor2,
- VisualOrientation orientation,
- GraphicsPath path,
- IDisposable memento)
- {
- return DrawBackGlassSimplePercent(context, rect,
- backColor1, backColor2,
- orientation, path,
- FULL_GLASS_LENGTH, memento);
- }
-
- ///
- /// Draw a background in normal full glass effect.
- ///
- /// Rendering context.
- /// Rectangle to draw.
- /// First color.
- /// Second color.
- /// Drawing orientation.
- /// Clipping path.
- /// Cache used for drawing.
- public static IDisposable DrawBackGlassNormalFull(RenderContext context,
- Rectangle rect,
- Color backColor1,
- Color backColor2,
- VisualOrientation orientation,
- GraphicsPath path,
- IDisposable memento)
- {
- return DrawBackGlassNormalPercent(context, rect,
- backColor1, backColor2,
- orientation, path,
- FULL_GLASS_LENGTH, memento);
- }
-
- ///
- /// Draw a background in tracking full glass effect.
- ///
- /// Rendering context.
- /// Rectangle to draw.
- /// First color.
- /// Second color.
- /// Drawing orientation.
- /// Clipping path.
- /// Cache used for drawing.
- public static IDisposable DrawBackGlassTrackingFull(RenderContext context,
- Rectangle rect,
- Color backColor1,
- Color backColor2,
- VisualOrientation orientation,
- GraphicsPath path,
- IDisposable memento)
- {
- return DrawBackGlassTrackingPercent(context, rect,
- backColor1, backColor2,
- orientation, path,
- FULL_GLASS_LENGTH, memento);
- }
-
- ///
- /// Draw a background in checked full glass effect.
- ///
- /// Rendering context.
- /// Rectangle to draw.
- /// First color.
- /// Second color.
- /// Drawing orientation.
- /// Clipping path.
- /// Cache used for drawing.
- public static IDisposable DrawBackGlassCheckedFull(RenderContext context,
- Rectangle rect,
- Color backColor1,
- Color backColor2,
- VisualOrientation orientation,
- GraphicsPath path,
- IDisposable memento)
- {
- return DrawBackGlassCheckedPercent(context, rect,
- backColor1, backColor2,
- orientation, path,
- FULL_GLASS_LENGTH, memento);
- }
-
- ///
- /// Draw a background in checked/tracking full glass effect.
- ///
- /// Rendering context.
- /// Rectangle to draw.
- /// First color.
- /// Second color.
- /// Drawing orientation.
- /// Clipping path.
- /// Cache used for drawing.
- public static IDisposable DrawBackGlassCheckedTrackingFull(RenderContext context,
- Rectangle rect,
- Color backColor1,
- Color backColor2,
- VisualOrientation orientation,
- GraphicsPath path,
- IDisposable memento)
- {
- return DrawBackGlassCheckedTrackingPercent(context, rect,
- backColor1, backColor2,
- orientation, path,
- FULL_GLASS_LENGTH, memento);
- }
-
- ///
- /// Draw a background in checked/pressed full glass effect.
- ///
- /// Rendering context.
- /// Rectangle to draw.
- /// First color.
- /// Second color.
- /// Drawing orientation.
- /// Clipping path.
- /// Cache used for drawing.
- public static IDisposable DrawBackGlassPressedFull(RenderContext context,
- Rectangle rect,
- Color backColor1,
- Color backColor2,
- VisualOrientation orientation,
- GraphicsPath path,
- IDisposable memento)
- {
- return DrawBackGlassPressedPercent(context, rect,
- backColor1, backColor2,
- orientation, path,
- FULL_GLASS_LENGTH, memento);
- }
-
- ///
- /// Draw a background in normal stumpy glass effect.
- ///
- /// Rendering context.
- /// Rectangle to draw.
- /// First color.
- /// Second color.
- /// Drawing orientation.
- /// Clipping path.
- /// Cache used for drawing.
- public static IDisposable DrawBackGlassNormalStump(RenderContext context,
- Rectangle rect,
- Color backColor1,
- Color backColor2,
- VisualOrientation orientation,
- GraphicsPath path,
- IDisposable memento)
- {
- return DrawBackGlassNormalPercent(context, rect,
- backColor1, backColor2,
- orientation, path,
- STUMPY_GLASS_LENGTH, memento);
- }
-
- ///
- /// Draw a background in tracking stumpy glass effect.
- ///
- /// Rendering context.
- /// Rectangle to draw.
- /// First color.
- /// Second color.
- /// Drawing orientation.
- /// Clipping path.
- /// Cache used for drawing.
- public static IDisposable DrawBackGlassTrackingStump(RenderContext context,
- Rectangle rect,
- Color backColor1,
- Color backColor2,
- VisualOrientation orientation,
- GraphicsPath path,
- IDisposable memento)
- {
- return DrawBackGlassTrackingPercent(context, rect,
- backColor1, backColor2,
- orientation, path,
- STUMPY_GLASS_LENGTH, memento);
- }
-
- ///
- /// Draw a background in checked/pressed stumpy glass effect.
- ///
- /// Rendering context.
- /// Rectangle to draw.
- /// First color.
- /// Second color.
- /// Drawing orientation.
- /// Clipping path.
- /// Cache used for drawing.
- public static IDisposable DrawBackGlassPressedStump(RenderContext context,
- Rectangle rect,
- Color backColor1,
- Color backColor2,
- VisualOrientation orientation,
- GraphicsPath path,
- IDisposable memento)
- {
- return DrawBackGlassPressedPercent(context, rect,
- backColor1, backColor2,
- orientation, path,
- STUMPY_GLASS_LENGTH, memento);
- }
-
- ///
- /// Draw a background in checked stumpy glass effect.
- ///
- /// Rendering context.
- /// Rectangle to draw.
- /// First color.
- /// Second color.
- /// Drawing orientation.
- /// Clipping path.
- /// Cache used for drawing.
- public static IDisposable DrawBackGlassCheckedStump(RenderContext context,
- Rectangle rect,
- Color backColor1,
- Color backColor2,
- VisualOrientation orientation,
- GraphicsPath path,
- IDisposable memento)
- {
- return DrawBackGlassCheckedPercent(context, rect,
- backColor1, backColor2,
- orientation, path,
- STUMPY_GLASS_LENGTH, memento);
- }
-
- ///
- /// Draw a background in checked/tracking stumpy glass effect.
- ///
- /// Rendering context.
- /// Rectangle to draw.
- /// First color.
- /// Second color.
- /// Drawing orientation.
- /// Clipping path.
- /// Cache used for drawing.
- public static IDisposable DrawBackGlassCheckedTrackingStump(RenderContext context,
- Rectangle rect,
- Color backColor1,
- Color backColor2,
- VisualOrientation orientation,
- GraphicsPath path,
- IDisposable memento)
- {
- return DrawBackGlassCheckedTrackingPercent(context, rect,
- backColor1, backColor2,
- orientation, path,
- STUMPY_GLASS_LENGTH, memento);
- }
-
- ///
- /// Draw a background in glass effect with three edges lighter.
- ///
- /// Rendering context.
- /// Rectangle to draw.
- /// First color.
- /// Second color.
- /// Drawing orientation.
- /// Clipping path.
- /// Cache used for drawing.
- public static IDisposable DrawBackGlassThreeEdge(RenderContext context,
- Rectangle rect,
- Color backColor1,
- Color backColor2,
- VisualOrientation orientation,
- GraphicsPath path,
- IDisposable memento)
- {
- using (Clipping clip = new Clipping(context.Graphics, path))
- {
- bool generate = true;
- MementoBackGlassThreeEdge cache;
-
- // Access a cache instance and decide if cache resources need generating
- if (!(memento is MementoBackGlassThreeEdge))
- {
- memento?.Dispose();
-
- cache = new MementoBackGlassThreeEdge(rect, backColor1, backColor2, orientation);
- memento = cache;
- }
- else
- {
- cache = (MementoBackGlassThreeEdge)memento;
- generate = !cache.UseCachedValues(rect, backColor1, backColor2, orientation);
- }
-
- // Do we need to generate the contents of the cache?
- if (generate)
- {
- // Dispose of existing values
- cache.Dispose();
-
- // Generate color values
- cache.colorA1L = CommonHelper.MergeColors(backColor1, 0.7f, Color.White, 0.3f);
- cache.colorA2L = CommonHelper.MergeColors(backColor2, 0.7f, Color.White, 0.3f);
- cache.colorA2LL = CommonHelper.MergeColors(cache.colorA2L, 0.8f, Color.White, 0.2f);
- cache.colorB2LL = CommonHelper.MergeColors(backColor2, 0.8f, Color.White, 0.2f);
- cache.rectB = new Rectangle(rect.X + 1, rect.Y + 1, rect.Width - 1, rect.Height - 2);
- }
-
- // Draw entire area in a lighter version
- cache.first = DrawBackGlassLinear(rect, rect,
- cache.colorA1L, _glassColorLight,
- cache.colorA2L, cache.colorA2LL,
- orientation,
- context.Graphics,
- FULL_GLASS_LENGTH,
- cache.first);
-
-
- // Draw the inside area in the full color
- cache.second = DrawBackGlassLinear(cache.rectB, cache.rectB,
- backColor1, _glassColorLight,
- backColor2, cache.colorB2LL,
- orientation,
- context.Graphics,
- FULL_GLASS_LENGTH,
- cache.second);
-
- return cache;
- }
- }
-
- ///
- /// Draw a background in normal simple glass effect.
- ///
- /// Rendering context.
- /// Rectangle to draw.
- /// First color.
- /// Second color.
- /// Drawing orientation.
- /// Clipping path.
- /// Cache used for drawing.
- public static IDisposable DrawBackGlassNormalSimple(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- Color backColor1,
- Color backColor2,
- VisualOrientation orientation,
- GraphicsPath path,
- IDisposable memento)
- {
- using (Clipping clip = new Clipping(context.Graphics, path))
- {
- // Draw the inside area
- return DrawBackGlassLinear(rect, rect,
- backColor1, backColor2,
- _glassColorTopL,
- _glassColorBottomL,
- orientation,
- context.Graphics,
- FULL_GLASS_LENGTH,
- memento);
- }
- }
-
- ///
- /// Draw a background in tracking simple glass effect.
- ///
- /// Rendering context.
- /// Rectangle to draw.
- /// First color.
- /// Second color.
- /// Drawing orientation.
- /// Clipping path.
- /// Cache used for drawing.
- public static IDisposable DrawBackGlassTrackingSimple(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- Color backColor1,
- Color backColor2,
- VisualOrientation orientation,
- GraphicsPath path,
- IDisposable memento)
- {
- using (Clipping clip = new Clipping(context.Graphics, path))
- {
- // Draw the inside area as a glass effect
- return DrawBackGlassRadial(rect, backColor1, backColor2,
- _glassColorTopL, _glassColorBottomL,
- 2f, 1f, orientation, context.Graphics,
- FULL_GLASS_LENGTH, memento);
- }
- }
-
- ///
- /// Draw a background in checked simple glass effect.
- ///
- /// Rendering context.
- /// Rectangle to draw.
- /// First color.
- /// Second color.
- /// Drawing orientation.
- /// Clipping path.
- /// Cache used for drawing.
- public static IDisposable DrawBackGlassCheckedSimple(RenderContext context,
- Rectangle rect,
- Color backColor1,
- Color backColor2,
- VisualOrientation orientation,
- GraphicsPath path,
- IDisposable memento)
- {
- using (Clipping clip = new Clipping(context.Graphics, path))
- {
- // Draw the inside areas as a glass effect
- return DrawBackGlassRadial(rect, backColor1, backColor2,
- _glassColorTopL, _glassColorBottomL,
- 6f, 1.2f, orientation, context.Graphics,
- FULL_GLASS_LENGTH, memento);
- }
- }
-
- ///
- /// Draw a background in checked/tracking simple glass effect.
- ///
- /// Rendering context.
- /// Rectangle to draw.
- /// First color.
- /// Second color.
- /// Drawing orientation.
- /// Clipping path.
- /// Cache used for drawing.
- public static IDisposable DrawBackGlassCheckedTrackingSimple(RenderContext context,
- Rectangle rect,
- Color backColor1,
- Color backColor2,
- VisualOrientation orientation,
- GraphicsPath path,
- IDisposable memento)
- {
- using (Clipping clip = new Clipping(context.Graphics, path))
- {
- // Draw the inside areas as a glass effect
- return DrawBackGlassRadial(rect, backColor1, backColor2,
- _glassColorTopD, _glassColorBottomD,
- 5f, 1.2f, orientation, context.Graphics,
- FULL_GLASS_LENGTH, memento);
- }
- }
-
- ///
- /// Draw a background in checked/pressed simple glass effect.
- ///
- /// Rendering context.
- /// Rectangle to draw.
- /// First color.
- /// Second color.
- /// Drawing orientation.
- /// Clipping path.
- /// Cache used for drawing.
- public static IDisposable DrawBackGlassPressedSimple(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- Color backColor1,
- Color backColor2,
- VisualOrientation orientation,
- GraphicsPath path,
- IDisposable memento)
- {
- using (Clipping clip = new Clipping(context.Graphics, path))
- {
- // Draw the inside areas as a glass effect
- return DrawBackGlassRadial(rect, backColor1, backColor2,
- _glassColorTopD, _glassColorBottomD,
- 3f, 1.1f, orientation, context.Graphics,
- FULL_GLASS_LENGTH, memento);
- }
- }
-
- #endregion
-
- #region Implementation
- private static IDisposable DrawBackGlassSimplePercent(ComponentFactory.Krypton.Toolkit.RenderContext context,
- Rectangle rect,
- Color backColor1,
- Color backColor2,
- VisualOrientation orientation,
- GraphicsPath path,
- float glassPercent,
- IDisposable memento)
- {
- using (Clipping clip = new Clipping(context.Graphics, path))
- {
- MementoDouble cache;
-
- if (!(memento is MementoDouble))
- {
- memento?.Dispose();
-
- cache = new MementoDouble();
- memento = cache;
- }
- else
- {
- cache = (MementoDouble)memento;
- }
-
- // Get the drawing rectangle for the path
- RectangleF drawRect = new RectangleF(rect.X, rect.Y, rect.Width, rect.Height);
-
- // Draw the border as a lighter version of the inside
- cache.first = DrawBackGlassLinear(drawRect, drawRect,
- backColor2,
- backColor2,
- _glassColorBottomDD,
- _glassColorBottomDD,
- orientation,
- context.Graphics,
- 0,
- cache.first);
-
- // Reduce by 1 pixel on all edges to get the inside
- RectangleF insetRect = drawRect;
- insetRect.Inflate(-1f, -1f);
-
- // Draw the inside area
- cache.second = DrawBackGlassLinear(insetRect, drawRect,
- backColor1,
- CommonHelper.MergeColors(backColor1, 0.5f, backColor2, 0.5f),
- _glassColorTopDD,
- _glassColorBottomDD,
- orientation,
- context.Graphics,
- glassPercent,
- cache.second);
- }
-
- return memento;
- }
-
- private static IDisposable DrawBackGlassNormalPercent(RenderContext context,
- Rectangle rect,
- Color backColor1,
- Color backColor2,
- VisualOrientation orientation,
- GraphicsPath path,
- float glassPercent,
- IDisposable memento)
- {
- using (Clipping clip = new Clipping(context.Graphics, path))
- {
- MementoDouble cache;
-
- if (!(memento is MementoDouble))
- {
- memento?.Dispose();
-
- cache = new MementoDouble();
- memento = cache;
- }
- else
- {
- cache = (MementoDouble)memento;
- }
-
- // Get the drawing rectangle for the path
- RectangleF drawRect = new RectangleF(rect.X, rect.Y, rect.Width, rect.Height);
-
- // Draw the border as a lighter version of the inside
- cache.first = DrawBackGlassLinear(drawRect, drawRect,
- Color.White,
- Color.White,
- _glassColorTopL,
- _glassColorBottomL,
- orientation,
- context.Graphics,
- glassPercent,
- cache.first);
-
- // Reduce by 1 pixel on all edges to get the inside
- RectangleF insetRect = drawRect;
- insetRect.Inflate(-1f, -1f);
-
- // Draw the inside area
- cache.second = DrawBackGlassLinear(insetRect, drawRect,
- backColor1, backColor2,
- _glassColorTopL,
- _glassColorBottomL,
- orientation,
- context.Graphics,
- glassPercent,
- cache.second);
- }
-
- return memento;
- }
-
- private static IDisposable DrawBackGlassTrackingPercent(RenderContext context,
- Rectangle rect,
- Color backColor1,
- Color backColor2,
- VisualOrientation orientation,
- GraphicsPath path,
- float glassPercent,
- IDisposable memento)
- {
- using (Clipping clip = new Clipping(context.Graphics, path))
- {
- MementoDouble cache;
-
- if (!(memento is MementoDouble))
- {
- memento?.Dispose();
-
- cache = new MementoDouble();
- memento = cache;
- }
- else
- {
- cache = (MementoDouble)memento;
- }
-
- // Draw the one pixel border around the area
- cache.first = DrawBackLinearRadial(rect, false,
- ControlPaint.LightLight(backColor2),
- ControlPaint.Light(backColor2),
- ControlPaint.LightLight(backColor2),
- orientation, context.Graphics,
- cache.first);
-
- // Reduce size of the inside area
- rect.Inflate(-1, -1);
-
- // Draw the inside area as a glass effect
- cache.second = DrawBackGlassRadial(rect, backColor1, backColor2,
- _glassColorTopL, _glassColorBottomL,
- 2f, 1f, orientation, context.Graphics,
- glassPercent, cache.second);
- }
-
- return memento;
- }
-
- private static IDisposable DrawBackGlassPressedPercent(RenderContext context,
- Rectangle rect,
- Color backColor1,
- Color backColor2,
- VisualOrientation orientation,
- GraphicsPath path,
- float glassPercent,
- IDisposable memento)
- {
- using (Clipping clip = new Clipping(context.Graphics, path))
- {
- MementoTriple cache;
-
- if (!(memento is MementoTriple))
- {
- memento?.Dispose();
-
- cache = new MementoTriple();
- memento = cache;
- }
- else
- {
- cache = (MementoTriple)memento;
- }
-
- // Draw the one pixel border around the area
- cache.first = DrawBackLinear(rect, false,
- ControlPaint.Light(backColor1),
- ControlPaint.LightLight(backColor1),
- orientation, context.Graphics,
- cache.first);
-
- // Reduce size on all but the upper edge
- ModifyRectByEdges(ref rect, 1, 0, 1, 1, orientation);
-
- // Draw the inside areas as a glass effect
- cache.second = DrawBackGlassRadial(rect, backColor1, backColor2,
- _glassColorTopD, _glassColorBottomD,
- 3f, 1.1f, orientation, context.Graphics,
- glassPercent, cache.second);
-
- // Widen back to original
- ModifyRectByEdges(ref rect, -1, 0, -1, 0, orientation);
-
- cache.third = DrawBackDarkEdge(rect, ControlPaint.Dark(backColor1),
- 3, orientation, context.Graphics,
- cache.third);
- }
-
- return memento;
- }
-
- private static IDisposable DrawBackGlassCheckedPercent(RenderContext context,
- Rectangle rect,
- Color backColor1,
- Color backColor2,
- VisualOrientation orientation,
- GraphicsPath path,
- float glassPercent,
- IDisposable memento)
- {
- using (Clipping clip = new Clipping(context.Graphics, path))
- {
- MementoTriple cache;
-
- if (!(memento is MementoTriple))
- {
- memento?.Dispose();
-
- cache = new MementoTriple();
- memento = cache;
- }
- else
- {
- cache = (MementoTriple)memento;
- }
-
- // Draw the one pixel border around the area
- cache.first = DrawBackLinearRadial(rect, false,
- ControlPaint.Light(backColor1),
- ControlPaint.LightLight(backColor1),
- ControlPaint.LightLight(backColor1),
- orientation, context.Graphics,
- cache.first);
-
- // Reduce size on all but the upper edge
- ModifyRectByEdges(ref rect, 1, 0, 1, 1, orientation);
-
- // Draw the inside areas as a glass effect
- cache.second = DrawBackGlassRadial(rect, backColor1, backColor2,
- _glassColorTopL, _glassColorBottomL,
- 6f, 1.2f, orientation, context.Graphics,
- glassPercent, cache.second);
-
- // Widen back to original
- ModifyRectByEdges(ref rect, -1, 0, -1, 0, orientation);
-
- // Draw a darker area for top edge
- cache.third = DrawBackDarkEdge(rect, ControlPaint.Dark(backColor1),
- 3, orientation, context.Graphics,
- cache.third);
- }
-
- return memento;
- }
-
- private static IDisposable DrawBackGlassCheckedTrackingPercent(RenderContext context,
- Rectangle rect,
- Color backColor1,
- Color backColor2,
- VisualOrientation orientation,
- GraphicsPath path,
- float glassPercent,
- IDisposable memento)
- {
- using (Clipping clip = new Clipping(context.Graphics, path))
- {
- MementoTriple cache;
-
- if (!(memento is MementoTriple))
- {
- memento?.Dispose();
-
- cache = new MementoTriple();
- memento = cache;
- }
- else
- {
- cache = (MementoTriple)memento;
- }
-
- // Draw the one pixel border around the area
- cache.first = DrawBackLinear(rect, true,
- backColor2,
- ControlPaint.LightLight(backColor2),
- orientation,
- context.Graphics,
- cache.first);
-
- // Reduce size on all but the upper edge
- ModifyRectByEdges(ref rect, 1, 0, 1, 1, orientation);
-
- // Draw the inside areas as a glass effect
- cache.second = DrawBackGlassRadial(rect, backColor1, backColor2,
- _glassColorTopD, _glassColorBottomD,
- 5f, 1.2f, orientation, context.Graphics,
- glassPercent, cache.second);
-
- // Widen back to original
- ModifyRectByEdges(ref rect, -1, 0, -1, 0, orientation);
-
- cache.third = DrawBackDarkEdge(rect, ControlPaint.Dark(backColor1),
- 3, orientation, context.Graphics,
- cache.third);
- }
-
- return memento;
- }
-
- private static IDisposable DrawBackLinearRadial(RectangleF drawRect,
- bool sigma,
- Color color1,
- Color color2,
- Color color3,
- VisualOrientation orientation,
- Graphics g,
- IDisposable memento)
- {
- MementoDouble cache;
-
- if (!(memento is MementoDouble))
- {
- memento?.Dispose();
-
- cache = new MementoDouble();
- memento = cache;
- }
- else
- {
- cache = (MementoDouble)memento;
- }
-
- // Draw entire background in linear gradient effect
- cache.first = DrawBackLinear(drawRect, sigma, color1, color2, orientation, g, cache.first);
-
- bool generate = true;
- MementoBackLinearRadial cacheThis;
-
- // Access a cache instance and decide if cache resources need generating
- if (!(cache.second is MementoBackLinearRadial))
- {
- cache.second?.Dispose();
-
- cacheThis = new MementoBackLinearRadial(drawRect, color2, color3, orientation);
- cache.second = cacheThis;
- }
- else
- {
- cacheThis = (MementoBackLinearRadial)cache.second;
- generate = !cacheThis.UseCachedValues(drawRect, color2, color3, orientation);
- }
-
- // Do we need to generate the contents of the cache?
- if (generate)
- {
- // Dispose of existing values
- cacheThis.Dispose();
-
- float third;
-
- // Find the 1/3 height used for the ellipse
- if (VerticalOrientation(orientation))
- {
- third = drawRect.Height / 3;
- }
- else
- {
- third = drawRect.Width / 3;
- }
-
- // Find the bottom area rectangle
- RectangleF ellipseRect;
- PointF centerPoint;
-
- switch (orientation)
- {
- case VisualOrientation.Left:
- ellipseRect = new RectangleF(drawRect.Right - third, drawRect.Y + 1, third, drawRect.Height - 2);
- centerPoint = new PointF(ellipseRect.Right, ellipseRect.Y + (ellipseRect.Height / 2));
- break;
- case VisualOrientation.Right:
- ellipseRect = new RectangleF(drawRect.X - 1, drawRect.Y + 1, third, drawRect.Height - 2);
- centerPoint = new PointF(ellipseRect.Left, ellipseRect.Y + (ellipseRect.Height / 2));
- break;
- case VisualOrientation.Bottom:
- ellipseRect = new RectangleF(drawRect.X + 1, drawRect.Y - 1, drawRect.Width - 2, third);
- centerPoint = new PointF(ellipseRect.X + (ellipseRect.Width / 2), ellipseRect.Top);
- break;
- case VisualOrientation.Top:
- default:
- ellipseRect = new RectangleF(drawRect.X + 1, drawRect.Bottom - third, drawRect.Width - 2, third);
- centerPoint = new PointF(ellipseRect.X + (ellipseRect.Width / 2), ellipseRect.Bottom);
- break;
- }
-
- cacheThis.ellipseRect = ellipseRect;
-
- // Cannot draw a path that contains a zero sized element
- if ((ellipseRect.Width > 0) && (ellipseRect.Height > 0))
- {
- cacheThis.path = new GraphicsPath();
- cacheThis.path.AddEllipse(ellipseRect);
- cacheThis.bottomBrush = new PathGradientBrush(cacheThis.path)
- {
- CenterColor = ControlPaint.Light(color3),
- CenterPoint = centerPoint,
- SurroundColors = new Color[] { color2 }
- };
- }
- }
-
- if (cacheThis.bottomBrush != null)
- {
- g.FillRectangle(cacheThis.bottomBrush, cacheThis.ellipseRect);
- }
-
- return memento;
- }
-
- private static IDisposable DrawBackGlassRadial(RectangleF drawRect,
- Color color1,
- Color color2,
- Color glassColor1,
- Color glassColor2,
- float factorX,
- float factorY,
- VisualOrientation orientation,
- Graphics g,
- float glassPercent,
- IDisposable memento)
- {
- MementoDouble cache;
-
- if (!(memento is MementoDouble))
- {
- memento?.Dispose();
-
- cache = new MementoDouble();
- memento = cache;
- }
- else
- {
- cache = (MementoDouble)memento;
- }
-
- // Draw the gradient effect background
- RectangleF glassRect = DrawBackGlassBasic(drawRect, color1, color2,
- glassColor1, glassColor2,
- factorX, factorY,
- orientation, g,
- glassPercent,
- ref cache.first);
-
- bool generate = true;
- MementoBackGlassRadial cacheThis;
-
- // Access a cache instance and decide if cache resources need generating
- if (!(cache.second is MementoBackGlassRadial))
- {
- cache.second?.Dispose();
-
- cacheThis = new MementoBackGlassRadial(drawRect, color1, color2, factorX, factorY, orientation);
- cache.second = cacheThis;
- }
- else
- {
- cacheThis = (MementoBackGlassRadial)cache.second;
- generate = !cacheThis.UseCachedValues(drawRect, color1, color2, factorX, factorY, orientation);
- }
-
- // Do we need to generate the contents of the cache?
- if (generate)
- {
- // Dispose of existing values
- cacheThis.Dispose();
-
- // Find the bottom area rectangle
- RectangleF mainRect;
-
- switch (orientation)
- {
- case VisualOrientation.Right:
- mainRect = new RectangleF(drawRect.X, drawRect.Y, drawRect.Width - glassRect.Width - 1, drawRect.Height);
- break;
- case VisualOrientation.Left:
- mainRect = new RectangleF(glassRect.Right + 1, drawRect.Y, drawRect.Width - glassRect.Width - 1, drawRect.Height);
- break;
- case VisualOrientation.Bottom:
- mainRect = new RectangleF(drawRect.X, drawRect.Y, drawRect.Width, drawRect.Height - glassRect.Height - 1);
- break;
- case VisualOrientation.Top:
- default:
- mainRect = new RectangleF(drawRect.X, glassRect.Bottom + 1, drawRect.Width, drawRect.Height - glassRect.Height - 1);
- break;
- }
-
- RectangleF doubleRect;
-
- // Find the box that encloses the ellipse (ellipses is sized using the factorX, factorY)
- if (VerticalOrientation(orientation))
- {
- float mainRectWidth = (mainRect.Width * factorX);
- float mainRectWidthOffset = (mainRectWidth - mainRect.Width) / 2;
- float mainRectHeight = (mainRect.Height * factorY);
- float mainRectHeightOffset;
-
- // Find orientation specific ellsipe rectangle
- if (orientation == VisualOrientation.Top)
- {
- mainRectHeightOffset = (mainRectHeight - mainRect.Height) / 2;
- }
- else
- {
- mainRectHeightOffset = (mainRectHeight + ((mainRectHeight - mainRect.Height) / 2));
- }
-
- doubleRect = new RectangleF(mainRect.X - mainRectWidthOffset,
- mainRect.Y - mainRectHeightOffset,
- mainRectWidth, mainRectHeight * 2);
- }
- else
- {
- float mainRectHeight = (mainRect.Height * factorX);
- float mainRectHeightOffset = (mainRectHeight - mainRect.Height) / 2;
- float mainRectWidth = (mainRect.Width * factorY);
- float mainRectWidthOffset;
-
- // Find orientation specific ellsipe rectangle
- if (orientation == VisualOrientation.Left)
- {
- mainRectWidthOffset = (mainRectWidth - mainRect.Width) / 2;
- }
- else
- {
- mainRectWidthOffset = (mainRectWidth + ((mainRectWidth - mainRect.Width) / 2));
- }
-
- doubleRect = new RectangleF(mainRect.X - mainRectWidthOffset,
- mainRect.Y - mainRectHeightOffset,
- mainRectWidth * 2, mainRectHeight);
- }
-
- // Cannot draw a path that contains a zero sized element
- if ((doubleRect.Width > 0) && (doubleRect.Height > 0))
- {
- // We use a path to create an ellipse for the light effect in the bottom of the area
- cacheThis.path = new GraphicsPath();
- cacheThis.path.AddEllipse(doubleRect);
-
- // Create a brush from the path
- cacheThis.bottomBrush = new PathGradientBrush(cacheThis.path)
- {
- CenterColor = color2,
- CenterPoint = new PointF(doubleRect.X + (doubleRect.Width / 2), doubleRect.Y + (doubleRect.Height / 2)),
- SurroundColors = new Color[] { color1 }
- };
- cacheThis.mainRect = mainRect;
- }
- }
-
- if (cacheThis.bottomBrush != null)
- {
- g.FillRectangle(cacheThis.bottomBrush, cacheThis.mainRect);
- }
-
- return memento;
- }
-
- private static IDisposable DrawBackGlassCenter(RectangleF drawRect,
- Color color1,
- Color color2,
- Color glassColor1,
- Color glassColor2,
- float factorX,
- float factorY,
- VisualOrientation orientation,
- Graphics g,
- float glassPercent,
- IDisposable memento)
- {
- // Cannot draw a path that contains a zero sized element
- if ((drawRect.Width > 0) && (drawRect.Height > 0))
- {
- MementoDouble cache;
-
- if (!(memento is MementoDouble))
- {
- memento?.Dispose();
-
- cache = new MementoDouble();
- memento = cache;
- }
- else
- {
- cache = (MementoDouble)memento;
- }
-
- // Draw the gradient effect background
- DrawBackGlassBasic(drawRect, color1, color2,
- glassColor1, glassColor2,
- factorX, factorY,
- orientation, g,
- glassPercent,
- ref cache.first);
-
- bool generate = true;
- MementoBackGlassCenter cacheThis;
-
- // Access a cache instance and decide if cache resources need generating
- if (!(cache.second is MementoBackGlassCenter))
- {
- cache.second?.Dispose();
-
- cacheThis = new MementoBackGlassCenter(drawRect, color2);
- cache.second = cacheThis;
- }
- else
- {
- cacheThis = (MementoBackGlassCenter)cache.second;
- generate = !cacheThis.UseCachedValues(drawRect, color2);
- }
-
- // Do we need to generate the contents of the cache?
- if (generate)
- {
- // Dispose of existing values
- cacheThis.Dispose();
-
- cacheThis.path = new GraphicsPath();
- cacheThis.path.AddEllipse(drawRect);
- cacheThis.bottomBrush = new PathGradientBrush(cacheThis.path)
- {
- CenterColor = color2,
- CenterPoint = new PointF(drawRect.X + (drawRect.Width / 2), drawRect.Y + (drawRect.Height / 2)),
- SurroundColors = new Color[] { Color.Transparent }
- };
- }
-
- g.FillRectangle(cacheThis.bottomBrush, drawRect);
- }
-
- return memento;
- }
-
- private static IDisposable DrawBackGlassFade(RectangleF drawRect,
- RectangleF outerRect,
- Color color1,
- Color color2,
- Color glassColor1,
- Color glassColor2,
- VisualOrientation orientation,
- Graphics g,
- IDisposable memento)
- {
- // Cannot draw a zero length rectangle
- if ((drawRect.Width > 0) && (drawRect.Height > 0) &&
- (outerRect.Width > 0) && (outerRect.Height > 0))
- {
- bool generate = true;
- MementoBackGlassFade cache;
-
- // Access a cache instance and decide if cache resources need generating
- if (!(memento is MementoBackGlassFade))
- {
- memento?.Dispose();
-
- cache = new MementoBackGlassFade(drawRect, outerRect, color1, color2,
- glassColor1, glassColor2, orientation);
- memento = cache;
- }
- else
- {
- cache = (MementoBackGlassFade)memento;
- generate = !cache.UseCachedValues(drawRect, outerRect, color1, color2,
- glassColor1, glassColor2, orientation);
- }
-
- // Do we need to generate the contents of the cache?
- if (generate)
- {
- // Dispose of existing values
- cache.Dispose();
-
- // Create gradient rect from the drawing rect
- RectangleF gradientRect = new RectangleF(drawRect.X - 1, drawRect.Y - 1, drawRect.Width + 2, drawRect.Height + 2);
-
- // Cannot draw a zero sized rectangle
- if ((gradientRect.Width > 0) && (gradientRect.Height > 0))
- {
- // Draw a gradient from first to second over the length, but use the
- // first color for the first 33% of distance and fade over the rest
- cache.mainBrush = new LinearGradientBrush(gradientRect, color1, color2, AngleFromOrientation(orientation))
- {
- Blend = _glassFadeBlend
- };
- }
-
- float glassLength;
-
- // Glass covers 33% of the orienatated length
- if (VerticalOrientation(orientation))
- {
- glassLength = ((int)(outerRect.Height * 0.33f) + outerRect.Y) - drawRect.Y;
- }
- else
- {
- glassLength = ((int)(outerRect.Width * 0.33f) + outerRect.X) - drawRect.X;
- }
-
- RectangleF glassRect;
- RectangleF mainRect;
-
- // Create rectangles that cover the glass and main area
- switch (orientation)
- {
- case VisualOrientation.Left:
- glassRect = new RectangleF(drawRect.X, drawRect.Y, glassLength, drawRect.Height);
- break;
- case VisualOrientation.Right:
- mainRect = new RectangleF(drawRect.X, drawRect.Y, drawRect.Width - glassLength, drawRect.Height);
- glassRect = new RectangleF(mainRect.Right, drawRect.Y, glassLength, drawRect.Height);
- break;
- case VisualOrientation.Top:
- default:
- glassRect = new RectangleF(drawRect.X, drawRect.Y, drawRect.Width, glassLength);
- break;
- case VisualOrientation.Bottom:
- mainRect = new RectangleF(drawRect.X, drawRect.Y, drawRect.Width, drawRect.Height - glassLength);
- glassRect = new RectangleF(drawRect.X, mainRect.Bottom, drawRect.Width, glassLength);
- break;
- }
-
- // Create gradient rectangles
- RectangleF glassGradientRect = new RectangleF(glassRect.X - 1, glassRect.Y - 1, glassRect.Width + 2, glassRect.Height + 2);
-
- // Cannot draw a zero sized rectangle
- if ((glassRect.Width > 0) && (glassRect.Height > 0) &&
- (glassGradientRect.Width > 0) && (glassGradientRect.Height > 0))
- {
- // Use semi-transparent white colors to create the glass effect
- cache.topBrush = new LinearGradientBrush(glassGradientRect, glassColor1, glassColor2, AngleFromOrientation(orientation));
- cache.glassRect = glassRect;
- }
- }
-
- if (cache.mainBrush != null)
- {
- g.FillRectangle(cache.mainBrush, drawRect);
- }
-
- if (cache.topBrush != null)
- {
- g.FillRectangle(cache.topBrush, cache.glassRect);
- }
- }
-
- return memento;
- }
-
- private static IDisposable DrawBackGlassLinear(RectangleF drawRect,
- RectangleF outerRect,
- Color color1,
- Color color2,
- Color glassColor1,
- Color glassColor2,
- VisualOrientation orientation,
- Graphics g,
- float glassPercent,
- IDisposable memento)
- {
- // Cannot draw a zero length rectangle
- if ((drawRect.Width > 0) && (drawRect.Height > 0) &&
- (outerRect.Width > 0) && (outerRect.Height > 0))
- {
- bool generate = true;
- MementoBackGlassLinear cache;
-
- // Access a cache instance and decide if cache resources need generating
- if (!(memento is MementoBackGlassLinear))
- {
- memento?.Dispose();
-
- cache = new MementoBackGlassLinear(drawRect, outerRect, color1, color2,
- glassColor1, glassColor2, orientation, glassPercent);
- memento = cache;
- }
- else
- {
- cache = (MementoBackGlassLinear)memento;
- generate = !cache.UseCachedValues(drawRect, outerRect, color1, color2,
- glassColor1, glassColor2, orientation, glassPercent);
- }
-
- // Do we need to generate the contents of the cache?
- if (generate)
- {
- // Dispose of existing values
- cache.Dispose();
-
- RectangleF glassRect;
- RectangleF mainRect;
- float glassLength;
-
- // Glass covers specified percentage of the orienatated length
- if (VerticalOrientation(orientation))
- {
- glassLength = ((int)(outerRect.Height * glassPercent) + outerRect.Y) - drawRect.Y;
- }
- else
- {
- glassLength = ((int)(outerRect.Width * glassPercent) + outerRect.X) - drawRect.X;
- }
-
- // Create rectangles that cover the glass and main area
- switch (orientation)
- {
- case VisualOrientation.Left:
- glassRect = new RectangleF(drawRect.X, drawRect.Y, glassLength, drawRect.Height);
- mainRect = new RectangleF(glassRect.Right + 1, drawRect.Y, drawRect.Width - glassRect.Width - 1, drawRect.Height);
- break;
- case VisualOrientation.Right:
- mainRect = new RectangleF(drawRect.X, drawRect.Y, drawRect.Width - glassLength, drawRect.Height);
- glassRect = new RectangleF(mainRect.Right, drawRect.Y, glassLength, drawRect.Height);
- break;
- case VisualOrientation.Top:
- default:
- glassRect = new RectangleF(drawRect.X, drawRect.Y, drawRect.Width, glassLength);
- mainRect = new RectangleF(drawRect.X, glassRect.Bottom + 1, drawRect.Width, drawRect.Height - glassRect.Height - 1);
- break;
- case VisualOrientation.Bottom:
- mainRect = new RectangleF(drawRect.X, drawRect.Y, drawRect.Width, drawRect.Height - glassLength);
- glassRect = new RectangleF(drawRect.X, mainRect.Bottom, drawRect.Width, glassLength);
- break;
- }
-
- cache.totalBrush = new SolidBrush(color1);
- cache.glassRect = glassRect;
- cache.mainRect = mainRect;
-
- // Create gradient rectangles
- RectangleF glassGradientRect = new RectangleF(cache.glassRect.X - 1, cache.glassRect.Y - 1, cache.glassRect.Width + 2, cache.glassRect.Height + 2);
- RectangleF mainGradientRect = new RectangleF(cache.mainRect.X - 1, cache.mainRect.Y - 1, cache.mainRect.Width + 2, cache.mainRect.Height + 2);
-
- // Cannot draw a zero length rectangle
- if ((cache.glassRect.Width > 0) && (cache.glassRect.Height > 0) &&
- (cache.mainRect.Width > 0) && (cache.mainRect.Height > 0) &&
- (glassGradientRect.Width > 0) && (glassGradientRect.Height > 0) &&
- (mainGradientRect.Width > 0) && (mainGradientRect.Height > 0))
- {
- cache.topBrush = new LinearGradientBrush(glassGradientRect, glassColor1, glassColor2, AngleFromOrientation(orientation));
- cache.bottomBrush = new LinearGradientBrush(mainGradientRect, color1, color2, AngleFromOrientation(orientation));
- }
- }
-
- // Draw entire area in a solid color
- g.FillRectangle(cache.totalBrush, drawRect);
-
- if ((cache.topBrush != null) && (cache.bottomBrush != null))
- {
- g.FillRectangle(cache.topBrush, cache.glassRect);
- g.FillRectangle(cache.bottomBrush, cache.mainRect);
- }
- }
-
- return memento;
- }
-
- private static RectangleF DrawBackGlassBasic(RectangleF drawRect,
- Color color1,
- Color color2,
- Color glassColor1,
- Color glassColor2,
- float factorX,
- float factorY,
- VisualOrientation orientation,
- Graphics g,
- float glassPercent,
- ref IDisposable memento)
- {
- // Cannot draw a zero length rectangle
- if ((drawRect.Width > 0) && (drawRect.Height > 0))
- {
- bool generate = true;
- MementoBackGlassBasic cache;
-
- // Access a cache instance and decide if cache resources need generating
- if (!(memento is MementoBackGlassBasic))
- {
- memento?.Dispose();
-
- cache = new MementoBackGlassBasic(drawRect, color1, color2,
- glassColor1, glassColor2,
- factorX, factorY,
- orientation, glassPercent);
- memento = cache;
- }
- else
- {
- cache = (MementoBackGlassBasic)memento;
- generate = !cache.UseCachedValues(drawRect, color1, color2,
- glassColor1, glassColor2,
- factorX, factorY,
- orientation, glassPercent);
- }
-
- // Do we need to generate the contents of the cache?
- if (generate)
- {
- // Dispose of existing values
- cache.Dispose();
-
- // Draw entire area in a solid color
- cache.totalBrush = new SolidBrush(color1);
-
- int length;
-
- if (VerticalOrientation(orientation))
- {
- length = (int)(drawRect.Height * glassPercent);
- }
- else
- {
- length = (int)(drawRect.Width * glassPercent);
- }
-
- RectangleF glassRect;
-
- // Create rectangles that covers the glassy area
- switch (orientation)
- {
- case VisualOrientation.Left:
- glassRect = new RectangleF(drawRect.X, drawRect.Y, length, drawRect.Height);
- break;
- case VisualOrientation.Right:
- glassRect = new RectangleF(drawRect.Right - length, drawRect.Y, length, drawRect.Height);
- break;
- case VisualOrientation.Bottom:
- glassRect = new RectangleF(drawRect.X, drawRect.Bottom - length, drawRect.Width, length);
- break;
- case VisualOrientation.Top:
- default:
- glassRect = new RectangleF(drawRect.X, drawRect.Y, drawRect.Width, length);
- break;
- }
-
- // Gradient rectangle is always a little bigger to prevent tiling at edges
- RectangleF glassGradientRect = new RectangleF(glassRect.X - 1, glassRect.Y - 1, glassRect.Width + 2, glassRect.Height + 2);
-
- // Cannot draw a zero length rectangle
- if ((glassGradientRect.Width > 0) && (glassGradientRect.Height > 0))
- {
- cache.glassBrush = new LinearGradientBrush(glassGradientRect, glassColor1, glassColor2, AngleFromOrientation(orientation));
- cache.glassRect = glassRect;
- }
- }
-
- g.FillRectangle(cache.totalBrush, drawRect);
-
- if (cache.glassBrush != null)
- {
- g.FillRectangle(cache.glassBrush, cache.glassRect);
- return cache.glassRect;
- }
- }
-
- return RectangleF.Empty;
- }
-
- private static IDisposable DrawBackLinear(RectangleF drawRect,
- bool sigma,
- Color color1,
- Color color2,
- VisualOrientation orientation,
- Graphics g,
- IDisposable memento)
- {
- // Cannot draw a zero length rectangle
- if ((drawRect.Width > 0) && (drawRect.Height > 0))
- {
- bool generate = true;
- MementoBackLinear cache;
-
- // Access a cache instance and decide if cache resources need generating
- if (!(memento is MementoBackLinear))
- {
- memento?.Dispose();
-
- cache = new MementoBackLinear(drawRect, sigma, color1, color2, orientation);
- memento = cache;
- }
- else
- {
- cache = (MementoBackLinear)memento;
- generate = !cache.UseCachedValues(drawRect, sigma, color1, color2, orientation);
- }
-
- // Do we need to generate the contents of the cache?
- if (generate)
- {
- // Dispose of existing values
- cache.Dispose();
-
- // Create rectangle that covers the enter area
- RectangleF gradientRect = new RectangleF(drawRect.X - 1, drawRect.Y - 1, drawRect.Width + 2, drawRect.Height + 2);
-
- // Cannot draw a zero length rectangle
- if ((gradientRect.Width > 0) && (gradientRect.Height > 0))
- {
- // Draw entire area in a gradient color effect
- cache.entireBrush = new LinearGradientBrush(gradientRect, color1, color2, AngleFromOrientation(orientation));
-
- if (sigma)
- {
- cache.entireBrush.SetSigmaBellShape(0.5f);
- }
- }
- }
-
- if (cache.entireBrush != null)
- {
- g.FillRectangle(cache.entireBrush, drawRect);
- }
- }
-
- return memento;
- }
-
- private static IDisposable DrawBackDarkEdge(RectangleF drawRect,
- Color color1,
- int thickness,
- VisualOrientation orientation,
- Graphics g,
- IDisposable memento)
- {
- // Cannot draw a zero length rectangle
- if ((drawRect.Width > 0) && (drawRect.Height > 0))
- {
- bool generate = true;
- MementoBackDarkEdge cache;
-
- // Access a cache instance and decide if cache resources need generating
- if (!(memento is MementoBackDarkEdge))
- {
- memento?.Dispose();
-
- cache = new MementoBackDarkEdge(drawRect, color1, thickness, orientation);
- memento = cache;
- }
- else
- {
- cache = (MementoBackDarkEdge)memento;
- generate = !cache.UseCachedValues(drawRect, color1, thickness, orientation);
- }
-
- // Do we need to generate the contents of the cache?
- if (generate)
- {
- // Dispose of existing values
- cache.Dispose();
-
- // If we need to scale down the dark thickness
- if (VerticalOrientation(orientation))
- {
- if (drawRect.Height < 30)
- {
- thickness = (int)drawRect.Height / 10;
- }
- }
- else
- {
- if (drawRect.Width < 30)
- {
- thickness = (int)drawRect.Width / 10;
- }
- }
-
- // If there is something to draw
- if (thickness >= 0)
- {
- // Alter rectangle to the drawing edge only
- switch (orientation)
- {
- case VisualOrientation.Top:
- drawRect.Height = thickness;
- break;
- case VisualOrientation.Left:
- drawRect.Width = thickness;
- break;
- case VisualOrientation.Bottom:
- drawRect.Y = drawRect.Bottom - thickness - 1;
- drawRect.Height = thickness + 1;
- break;
- case VisualOrientation.Right:
- drawRect.X = drawRect.Right - thickness - 1;
- drawRect.Width = thickness + 1;
- break;
-
- }
-
- // Create rectangle that covers the enter area
- RectangleF gradientRect = new RectangleF(drawRect.X - 0.5f, drawRect.Y - 0.5f, drawRect.Width + 1, drawRect.Height + 1);
-
- // Cannot draw a zero length rectangle
- if ((gradientRect.Width > 0) && (gradientRect.Height > 0))
- {
- // Draw entire area in a gradient color effect
- cache.entireBrush = new LinearGradientBrush(gradientRect, Color.FromArgb(64, color1), Color.Transparent, AngleFromOrientation(orientation));
- cache.entireBrush.SetSigmaBellShape(1.0f);
- cache.entireRect = drawRect;
- }
- }
- }
-
- if (cache.entireBrush != null)
- {
- g.FillRectangle(cache.entireBrush, cache.entireRect);
- }
- }
-
- return memento;
- }
-
- private static bool VerticalOrientation(VisualOrientation orientation)
- {
- return (orientation == VisualOrientation.Top) ||
- (orientation == VisualOrientation.Bottom);
- }
-
- private static float AngleFromOrientation(VisualOrientation orientation)
- {
- switch (orientation)
- {
- case VisualOrientation.Bottom:
- return 270f;
- case VisualOrientation.Left:
- return 0f;
- case VisualOrientation.Right:
- return 180;
- case VisualOrientation.Top:
- default:
- return 90f;
- }
- }
-
- private static void ModifyRectByEdges(ref Rectangle rect,
- int left,
- int top,
- int right,
- int bottom,
- VisualOrientation orientation)
- {
- switch (orientation)
- {
- case VisualOrientation.Top:
- rect.X += left;
- rect.Width -= (left + right);
- rect.Y += top;
- rect.Height -= (top + bottom);
- break;
- case VisualOrientation.Bottom:
- rect.X += left;
- rect.Width -= (left + right);
- rect.Y += bottom;
- rect.Height -= (top + bottom);
- break;
- case VisualOrientation.Left:
- rect.X += top;
- rect.Width -= (top + bottom);
- rect.Y += right;
- rect.Height -= (left + right);
- break;
- case VisualOrientation.Right:
- rect.X += bottom;
- rect.Width -= (top + bottom);
- rect.Y += left;
- rect.Height -= (left + right);
- break;
- }
- }
- #endregion
- }
-}
\ No newline at end of file
diff --git a/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/NT 10 Glass/AccentColorService.cs b/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/NT 10 Glass/AccentColorService.cs
deleted file mode 100644
index 719d6a96..00000000
--- a/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/NT 10 Glass/AccentColorService.cs
+++ /dev/null
@@ -1,54 +0,0 @@
-using System;
-using System.Drawing;
-using System.Runtime.InteropServices;
-
-//https://github.com/File-New-Project/EarTrumpet/blob/master/EarTrumpet/Services/AccentColorService.cs
-//Seb add
-namespace ExtendedControls.Base.Renderers.NT10Glass
-{
- ///
- /// Gets the Windows accent color
- ///
- public static class AccentColorService
- {
- static class Interop
- {
- // Thanks, Quppa! -RR
- [DllImport("uxtheme.dll", EntryPoint = "#94", CharSet = CharSet.Unicode)]
- internal static extern int GetImmersiveColorSetCount();
-
- [DllImport("uxtheme.dll", EntryPoint = "#95", CharSet = CharSet.Unicode)]
- internal static extern uint GetImmersiveColorFromColorSetEx(uint dwImmersiveColorSet, uint dwImmersiveColorType, bool bIgnoreHighContrast, uint dwHighContrastCacheMode);
-
- [DllImport("uxtheme.dll", EntryPoint = "#96", CharSet = CharSet.Unicode)]
- internal static extern uint GetImmersiveColorTypeFromName(string name);
-
- [DllImport("uxtheme.dll", EntryPoint = "#98", CharSet = CharSet.Unicode)]
- internal static extern uint GetImmersiveUserColorSetPreference(bool bForceCheckRegistry, bool bSkipCheckOnFail);
-
- [DllImport("uxtheme.dll", EntryPoint = "#100", CharSet = CharSet.Unicode)]
- internal static extern IntPtr GetImmersiveColorNamedTypeByIndex(uint dwIndex);
- }
-
- internal static Color GetColorByTypeName(string name)
- {
- uint colorSet = Interop.GetImmersiveUserColorSetPreference(false, false);
- uint colorType = Interop.GetImmersiveColorTypeFromName(name);
-
- uint rawColor = Interop.GetImmersiveColorFromColorSetEx(colorSet, colorType, false, 0);
-
- return FromABGR((int)rawColor);
- }
-
- private static Color FromABGR(int abgrValue)
- {
- byte[] colorBytes = new byte[4];
- colorBytes[0] = (byte)((0xFF000000 & abgrValue) >> 24); // A
- colorBytes[1] = (byte)((0x00FF0000 & abgrValue) >> 16); // B
- colorBytes[2] = (byte)((0x0000FF00 & abgrValue) >> 8); // G
- colorBytes[3] = (byte)(0x000000FF & abgrValue); // R
-
- return Color.FromArgb(colorBytes[0], colorBytes[3], colorBytes[2], colorBytes[1]);
- }
- }
-}
\ No newline at end of file
diff --git a/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/NT 10 Glass/BlurWindowExtensions.cs b/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/NT 10 Glass/BlurWindowExtensions.cs
deleted file mode 100644
index 5a90eff8..00000000
--- a/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/NT 10 Glass/BlurWindowExtensions.cs
+++ /dev/null
@@ -1,139 +0,0 @@
-using System;
-using System.Runtime.InteropServices;
-using System.Windows.Forms;
-
-namespace ExtendedControls.Base.Renderers.NT10Glass
-{
- ///
- /// Manages the Windows blur
- ///
- public static class BlurWindowExtensions
- {
- static class Interop
- {
- [DllImport("user32.dll")]
- internal static extern int SetWindowCompositionAttribute(IntPtr hwnd, ref WindowCompositionAttribData data);
-
- [StructLayout(LayoutKind.Sequential)]
- internal struct WindowCompositionAttribData
- {
- public WindowCompositionAttribute Attribute;
- public IntPtr Data;
- public int SizeOfData;
- }
-
- [StructLayout(LayoutKind.Sequential)]
- internal struct AccentPolicy
- {
- public AccentState AccentState;
- public AccentFlags AccentFlags;
- public int GradientColor;
- public int AnimationId;
- }
-
- [Flags]
- internal enum AccentFlags
- {
- // ...
- DrawLeftBorder = 0x20,
- DrawTopBorder = 0x40,
- DrawRightBorder = 0x80,
- DrawBottomBorder = 0x100,
- DrawAllBorders = (DrawLeftBorder | DrawTopBorder | DrawRightBorder | DrawBottomBorder)
- // ...
- }
-
- internal enum WindowCompositionAttribute
- {
- // ...
- WCA_ACCENT_POLICY = 19
- // ...
- }
-
- internal enum AccentState
- {
- ACCENT_DISABLED = 0,
- ACCENT_ENABLE_GRADIENT = 1,
- ACCENT_ENABLE_TRANSPARENTGRADIENT = 2,
- ACCENT_ENABLE_BLURBEHIND = 3,
- ACCENT_INVALID_STATE = 4
- }
- }
-
- ///
- ///
- ///
- ///
- public static void EnableBlur(this Form window)
- {
- if (SystemInformation.HighContrast)
- {
- return; // Blur is not useful in high contrast mode
- }
-
- SetAccentPolicy(window, Interop.AccentState.ACCENT_ENABLE_BLURBEHIND);
- }
-
- ///
- ///
- ///
- ///
- public static void DisableBlur(this Form window)
- {
- SetAccentPolicy(window, Interop.AccentState.ACCENT_DISABLED);
- }
-
- private static void SetAccentPolicy(Form window, Interop.AccentState accentState)
- {
- // var windowHelper = new WindowInteropHelper(window);
-
- Interop.AccentPolicy accent = new Interop.AccentPolicy
- {
- AccentState = accentState,
- AccentFlags = GetAccentFlagsForTaskbarPosition()
- };
-
- int accentStructSize = Marshal.SizeOf(accent);
-
- IntPtr accentPtr = Marshal.AllocHGlobal(accentStructSize);
- Marshal.StructureToPtr(accent, accentPtr, false);
-
- Interop.WindowCompositionAttribData data = new Interop.WindowCompositionAttribData
- {
- Attribute = Interop.WindowCompositionAttribute.WCA_ACCENT_POLICY,
- SizeOfData = accentStructSize,
- Data = accentPtr
- };
-
- Interop.SetWindowCompositionAttribute(window.Handle, ref data);
-
- Marshal.FreeHGlobal(accentPtr);
- }
-
- private static Interop.AccentFlags GetAccentFlagsForTaskbarPosition()
- {
- Interop.AccentFlags flags = Interop.AccentFlags.DrawAllBorders;
-
- //switch (TaskbarService.TaskbarPosition)
- //{
- // case TaskbarPosition.Top:
- // flags &= ~Interop.AccentFlags.DrawTopBorder;
- // break;
-
- // case TaskbarPosition.Bottom:
- // flags &= ~Interop.AccentFlags.DrawBottomBorder;
- // break;
-
- // case TaskbarPosition.Left:
- // flags &= ~Interop.AccentFlags.DrawLeftBorder;
- // break;
-
- // case TaskbarPosition.Right:
- // flags &= ~Interop.AccentFlags.DrawRightBorder;
- // break;
- //}
-
- return flags;
- }
- }
-}
\ No newline at end of file
diff --git a/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/NT 10 Glass/ThemeService.cs b/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/NT 10 Glass/ThemeService.cs
deleted file mode 100644
index 6f888ecf..00000000
--- a/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/NT 10 Glass/ThemeService.cs
+++ /dev/null
@@ -1,74 +0,0 @@
-using ComponentFactory.Krypton.Toolkit;
-using System.Drawing;
-using System.Windows.Forms;
-
-namespace ExtendedControls.Base.Renderers.NT10Glass
-{
- ///
- ///
- ///
- public class ThemeService
- {
- ///
- ///
- ///
- public static bool IsWindowTransparencyEnabled => !SystemInformation.HighContrast && UserSystemPreferencesService.IsTransparencyEnabled;
-
- //public static void UpdateThemeResources(ResourceDictionary dictionary)
- //{
- // dictionary["WindowBackground"] = new SolidColorBrush(GetWindowBackgroundColor());
-
- // SetBrush(dictionary, "WindowForeground", "ImmersiveApplicationTextDarkTheme");
- // ReplaceBrush(dictionary, "CottonSwabSliderThumb", "ImmersiveSystemAccent");
- // ReplaceBrush(dictionary, "CottonSwabSliderTrackBackground", SystemParameters.HighContrast ? "ImmersiveSystemAccentLight1" : "ImmersiveControlDarkSliderTrackBackgroundRest");
- // SetBrushWithOpacity(dictionary, "CottonSwabSliderTrackBackgroundHover", SystemParameters.HighContrast ? "ImmersiveSystemAccentLight1" : "ImmersiveDarkBaseMediumHigh", SystemParameters.HighContrast ? 1.0 : 0.25);
- // SetBrush(dictionary, "CottonSwabSliderTrackBackgroundPressed", "ImmersiveControlDarkSliderTrackBackgroundRest");
- // ReplaceBrush(dictionary, "CottonSwabSliderTrackFill", "ImmersiveSystemAccentLight1");
- // SetBrush(dictionary, "CottonSwabSliderThumbHover", "ImmersiveControlDarkSliderThumbHover");
- // SetBrush(dictionary, "CottonSwabSliderThumbPressed", "ImmersiveControlDarkSliderThumbHover");
- //}
-
- ///
- ///
- ///
- ///
- public static Color GetWindowBackgroundColor()
- {
- string resource;
- if (SystemInformation.HighContrast)
- {
- resource = "ImmersiveApplicationBackground";
- }
- else if (UserSystemPreferencesService.UseAccentColor)
- {
- resource = IsWindowTransparencyEnabled ? "ImmersiveSystemAccentDark2" : "ImmersiveSystemAccentDark1";
- }
- else
- {
- resource = "ImmersiveDarkChromeMedium";
- }
-
- Color color = AccentColorService.GetColorByTypeName(resource);
- //return color;
- //color.A = (byte)(IsWindowTransparencyEnabled ? 190 : 255);
- return Color.FromArgb(IsWindowTransparencyEnabled ? 190 : 255, color.R, color.G, color.B);
- }
-
- //private static void SetBrushWithOpacity(ResourceDictionary dictionary, string name, string immersiveAccentName, double opacity)
- //{
- // var color = AccentColorService.GetColorByTypeName(immersiveAccentName);
- // color.A = (byte) (opacity*255);
- // ((SolidColorBrush) dictionary[name]).Color = color;
- //}
-
- //private static void SetBrush(ResourceDictionary dictionary, string name, string immersiveAccentName)
- //{
- // SetBrushWithOpacity(dictionary, name, immersiveAccentName, 1.0);
- //}
-
- //private static void ReplaceBrush(ResourceDictionary dictionary, string name, string immersiveAccentName)
- //{
- // dictionary[name] = new SolidColorBrush(AccentColorService.GetColorByTypeName(immersiveAccentName));
- //}
- }
-}
\ No newline at end of file
diff --git a/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/NT 10 Glass/UserSystemPreferencesService.cs b/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/NT 10 Glass/UserSystemPreferencesService.cs
deleted file mode 100644
index b323d645..00000000
--- a/Source/Krypton Toolkit Suite Extended/Extended Controls/Base/Renderers/NT 10 Glass/UserSystemPreferencesService.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-using Microsoft.Win32;
-
-namespace ExtendedControls.Base.Renderers.NT10Glass
-{
- ///
- ///
- ///
- public static class UserSystemPreferencesService
- {
- ///
- ///
- ///
- public static bool IsTransparencyEnabled
- {
- get
- {
- using (RegistryKey baseKey = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Registry64))
- {
- return (int)baseKey.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Themes\Personalize").GetValue("EnableTransparency", 0) > 0;
- }
- }
- }
-
- ///
- ///
- ///
- public static bool UseAccentColor
- {
- get
- {
- using (RegistryKey baseKey = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Registry64))
- {
- return (int)baseKey.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Themes\Personalize").GetValue("ColorPrevalence", 0) > 0;
- }
- }
- }
- }
-}
\ No newline at end of file
diff --git a/Source/Krypton Toolkit Suite Extended/Extended Controls/Extended Controls.csproj b/Source/Krypton Toolkit Suite Extended/Extended Controls/Extended Controls.csproj
index 7f9015e6..4e916a6a 100644
--- a/Source/Krypton Toolkit Suite Extended/Extended Controls/Extended Controls.csproj
+++ b/Source/Krypton Toolkit Suite Extended/Extended Controls/Extended Controls.csproj
@@ -34,29 +34,29 @@
app.manifest
-
+
False
- ..\..\Required\ComponentFactory.Krypton.Design.dll
+ A:\Developer DLLs\Krypton DLLs\Versions\4.7\ComponentFactory.Krypton.Design.dll
-
+
False
- ..\..\Required\ComponentFactory.Krypton.Docking.dll
+ A:\Developer DLLs\Krypton DLLs\Versions\4.7\ComponentFactory.Krypton.Docking.dll
-
+
False
- ..\..\Required\ComponentFactory.Krypton.Navigator.dll
+ A:\Developer DLLs\Krypton DLLs\Versions\4.7\ComponentFactory.Krypton.Navigator.dll
-
+
False
- ..\..\Required\ComponentFactory.Krypton.Ribbon.dll
+ A:\Developer DLLs\Krypton DLLs\Versions\4.7\ComponentFactory.Krypton.Ribbon.dll
-
+
False
- ..\..\Required\ComponentFactory.Krypton.Toolkit.dll
+ A:\Developer DLLs\Krypton DLLs\Versions\4.7\ComponentFactory.Krypton.Toolkit.dll
-
+
False
- ..\..\Required\ComponentFactory.Krypton.Workspace.dll
+ A:\Developer DLLs\Krypton DLLs\Versions\4.7\ComponentFactory.Krypton.Workspace.dll
@@ -93,42 +93,6 @@
-
- Component
-
-
- Component
-
-
- Component
-
-
- Component
-
-
- Component
-
-
- Component
-
-
- Component
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Form
@@ -149,6 +113,7 @@
+
UserControl
@@ -157,6 +122,12 @@
+
+ UserControl
+
+
+ ModernProgressBar.cs
+
Form
@@ -194,6 +165,12 @@
KryptonPanelForm.cs
+
+ Form
+
+
+ KryptonSplashScreen.cs
+
True
@@ -235,6 +212,7 @@
+
@@ -248,9 +226,15 @@
Test.cs
+
+ ModernProgressBar.cs
+
ExtendedKryptonMessagebox.cs
+
+ KryptonSplashScreen.cs
+
ResXFileCodeGenerator
Resources.Designer.cs
diff --git a/Source/Krypton Toolkit Suite Extended/Extended Controls/ExtendedToolkit/Controls/KryptonDateTimePickerExtended.cs b/Source/Krypton Toolkit Suite Extended/Extended Controls/ExtendedToolkit/Controls/KryptonDateTimePickerExtended.cs
new file mode 100644
index 00000000..9cc650ca
--- /dev/null
+++ b/Source/Krypton Toolkit Suite Extended/Extended Controls/ExtendedToolkit/Controls/KryptonDateTimePickerExtended.cs
@@ -0,0 +1,1101 @@
+using ComponentFactory.Krypton.Toolkit;
+using System;
+using System.Collections;
+using System.ComponentModel;
+using System.Drawing;
+using System.Windows.Forms;
+
+namespace ExtendedControls.ExtendedToolkit.Controls
+{
+ ///
+ /// An enhanced version of .
+ ///
+ ///
+ [Description("An enhanced version of the Krypton Date/Time picker.")]
+ [ToolboxItem(true)]
+ [ToolboxBitmap(typeof(KryptonDateTimePicker))]
+ public partial class KryptonDateTimePickerExtended : KryptonDateTimePicker
+ {
+ #region Variables
+ private KryptonTextBox ktxtDateTime;
+
+ private IContainer components;
+
+ private bool _setDate, _bDroppedDown, _showButtons = true;
+
+ private ErrorProvider errorMessage;
+
+ private ToolTip toolTip;
+
+ private string _linkedTo, _customFormatMessage;
+
+ private int _buttonWidth = BUTTON_WIDTH, _checkWith = 0;
+
+ private DateTimePickerCustomExtensions _customExtensions;
+
+ private KryptonDateTimePickerExtended _linkTo;
+
+ private ArrayList _linkToArray = new ArrayList(), _linkedArray = new ArrayList();
+ #endregion
+
+ #region Constants
+ private const int BUTTON_WIDTH = 16;
+ #endregion
+
+ #region Enumerations
+ ///
+ ///
+ ///
+ public enum DateTimePickerCustomExtensions
+ {
+ DTPLONG = 0,
+ DTPSHORT = 1,
+ DTPTIME = 2,
+ DTPSHORTDATESHORTTIMEAMPM = 3,
+ DTPSHORTDATELONGTIMEAMPM = 4,
+ DTPSHORTDATESHORTTIME24HOUR = 5,
+ DTPSHORTDATELONGTIME24HOUR = 6,
+ DTPLONGDATESHORTTIMEAMPM = 7,
+ DTPLONGDATELONGTIMEAMPM = 8,
+ DTPLONGDATESHORTTIME24HOUR = 9,
+ DTPLONGDATELONGTIME24HOUR = 10,
+ DTPSORTABLEDATEANDTIMELOCALTIME = 11,
+ DTPUTFLOCALDATEANDSHORTTIMEAMPM = 12,
+ DTPUTFLOCALDATEANDLONGTIMEAMPM = 13,
+ DTPUTFLOCALDATEANDSHORTTIME24HOUR = 14,
+ DTPUTFLOCALDATEANDLONGTIME24HOUR = 15,
+ DTPSHORTTIMEAMPM = 16,
+ DTPSHORTTIME24HOUR = 17,
+ DTPLONGTIME24HOUR = 18,
+ DTPYEARANDMONTHNAME = 19,
+ DTPMONTHNAMEANDDAY = 20,
+ DTPYEAR4DIGIT = 21,
+ DTPMONTHFULLNAME = 22,
+ DTPMONTHSHORTNAME = 23,
+ DTPDAYFULLNAME = 24,
+ DTPDAYSHORTNAME = 25,
+ DTPSHORTDATEAMPM = 26,
+ DTPSHORTDATEMORNINGAFTERNOON = 27,
+ DTPCUSTOM = 28
+ }
+ #endregion
+
+ #region Constructor
+ ///
+ /// Initialises a new instance of the class.
+ ///
+ public KryptonDateTimePickerExtended()
+ {
+ InitialiseComponent();
+
+ base.Format = DateTimePickerFormat.Custom;
+
+ KryptonDateTimePickerExtended_Resize(this, null);
+ }
+ #endregion
+
+ #region Setup
+ ///
+ /// Releases unmanaged and - optionally - managed resources.
+ ///
+ /// true to release both managed and unmanaged resources; false to release only unmanaged resources.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ if (components != null)
+ {
+ components.Dispose();
+ }
+ }
+
+ base.Dispose(disposing);
+ }
+
+ private void InitialiseComponent()
+ {
+ components = new Container();
+
+ ktxtDateTime = new KryptonTextBox();
+
+ errorMessage = new ErrorProvider();
+
+ toolTip = new ToolTip(components);
+
+ SuspendLayout();
+ //
+ // ktxtDateTime
+ //
+ ktxtDateTime.Location = new Point(20, 40);
+
+ ktxtDateTime.MaxLength = 50;
+
+ ktxtDateTime.Name = "ktxtDateTime";
+
+ ktxtDateTime.TabIndex = 0;
+
+ ktxtDateTime.Leave += new EventHandler(ktxtDateTime_Leave);
+
+ ktxtDateTime.Enter += new EventHandler(ktxtDateTime_Enter);
+
+ //
+ // errorMessage
+ //
+ errorMessage.DataMember = null;
+
+ //
+ // KryptonDateTimePickerExtended
+ //
+ Controls.AddRange(new Control[] { ktxtDateTime });
+
+ Value = new DateTime(1753, 1, 1, 15, 8, 40, 119);
+
+ DropDown += new EventHandler(KryptonDateTimePickerExtended_DropDown);
+
+ FontChanged += new EventHandler(KryptonDateTimePickerExtended_FontChanged);
+
+ Resize += new EventHandler(KryptonDateTimePickerExtended_Resize);
+
+ Enter += new EventHandler(KryptonDateTimePickerExtended_Enter);
+
+ CloseUp += new EventHandler(KryptonDateTimePickerExtended_CloseUp);
+
+ ForeColorChanged += new EventHandler(KryptonDateTimePickerExtended_ForeColorChanged);
+
+ BackColorChanged += new EventHandler(KryptonDateTimePickerExtended_BackColorChanged);
+
+ ValueChanged += new EventHandler(FormatOrValue_Changed);
+
+ FormatChanged += new EventHandler(FormatOrValue_Changed);
+
+ ResumeLayout(false);
+ }
+ #endregion
+
+ #region Event Handlers
+ private void ktxtDateTime_Leave(object sender, EventArgs e)
+ {
+ if (!SetDate)
+ {
+ SetDate = true;
+
+ errorMessage.SetError(this, "");
+
+ if (Text != "")
+ {
+ try
+ {
+ FormatKryptonTextBox();
+
+ _linkToArray.Clear();
+
+ if (_linkedTo != "" && _linkedTo != null)
+ {
+ for (int j = 0; j < _linkedArray.Count; j++)
+ {
+ for (int i = 0; i < Parent.Controls.Count; i++)
+ {
+ if (Parent.Controls[i].Name == _linkedArray[j].ToString() && Parent.Controls[i] is KryptonDateTimePickerExtended)
+ {
+ _linkTo = (KryptonDateTimePickerExtended)Parent.Controls[i];
+
+ _linkToArray.Add(_linkTo);
+
+ break;
+ }
+ }
+ }
+ }
+ }
+ catch
+ {
+ errorMessage.SetError(this, $"Invalid date - { ktxtDateTime.Text }, valid format is { _customFormatMessage }");
+ }
+ }
+
+ for (int i = 0; i < _linkToArray.Count; i++)
+ {
+ if (_linkToArray[i] != null)
+ {
+ _linkTo = (KryptonDateTimePickerExtended)_linkToArray[i];
+
+ _linkTo.Text = Text;
+ }
+ }
+
+ SetDate = false;
+ }
+ }
+
+ private void ktxtDateTime_Enter(object sender, EventArgs e)
+ {
+ toolTip.SetToolTip(ktxtDateTime, _customFormatMessage);
+
+ if (ktxtDateTime.Text.Length > 0)
+ {
+ ktxtDateTime.SelectionStart = 0;
+
+ ktxtDateTime.SelectionLength = ktxtDateTime.Text.Length;
+ }
+
+ SetDate = true;
+
+ Value = DateTime.Now;
+
+ SetDate = false;
+ }
+
+ private void FormatOrValue_Changed(object sender, EventArgs e)
+ {
+ errorMessage.SetError(this, "");
+
+ if (Text != "")
+ {
+ try
+ {
+ FormatKryptonTextBox();
+ }
+ catch
+ {
+ errorMessage.SetError(this, $"Invalid Date - { ktxtDateTime.Text }, valid format is { _customFormatMessage }");
+ }
+ }
+ }
+
+ private void KryptonDateTimePickerExtended_BackColorChanged(object sender, EventArgs e)
+ {
+ ktxtDateTime.BackColor = BackColor;
+
+ if (ktxtDateTime.BackColor != BackColor)
+ {
+ BackColor = ktxtDateTime.BackColor;
+ }
+ }
+
+ private void KryptonDateTimePickerExtended_ForeColorChanged(object sender, EventArgs e)
+ {
+ ktxtDateTime.ForeColor = BackColor;
+ }
+
+ private void KryptonDateTimePickerExtended_CloseUp(object sender, DateTimePickerCloseArgs e)
+ {
+ if (_bDroppedDown || ShowUpDown)
+ {
+ if (!SetDate)
+ {
+ ktxtDateTime.Text = Value.ToString();
+
+ FormatKryptonTextBox();
+ }
+ }
+ }
+
+ private void KryptonDateTimePickerExtended_Enter(object sender, EventArgs e)
+ {
+ ktxtDateTime.Focus();
+ }
+
+ private void KryptonDateTimePickerExtended_Resize(object sender, EventArgs e)
+ {
+ ktxtDateTime.Location = new Point(-2 + _checkWith, -2);
+
+ ktxtDateTime.Size = new Size(Width - _buttonWidth - _checkWith, Height);
+ }
+
+ private void KryptonDateTimePickerExtended_FontChanged(object sender, EventArgs e)
+ {
+ ktxtDateTime.Font = Font;
+ }
+
+ private void KryptonDateTimePickerExtended_DropDown(object sender, DateTimePickerDropArgs e)
+ {
+ _bDroppedDown = true;
+ }
+ #endregion
+
+ #region Overrides and Additional Properties
+ ///
+ /// Gets the format.
+ ///
+ ///
+ /// The format.
+ ///
+ [Browsable(false)]
+ public new DateTimePickerFormat Format
+ {
+ get
+ {
+ return base.Format;
+ }
+ }
+
+ ///
+ /// Gets or sets the extended format.
+ ///
+ ///
+ /// The extended format.
+ ///
+ [Browsable(true), Category("Appearance"), Description("Format Extensions replaces Format gets sets display Formats")]
+ public DateTimePickerCustomExtensions ExtendedFormat
+ {
+ get
+ {
+ return _customExtensions;
+ }
+
+ set
+ {
+ _customExtensions = value;
+
+ InitialiseCustomMessage();
+ }
+ }
+
+ ///
+ /// Gets or sets a value indicating whether [show buttons].
+ ///
+ ///
+ /// true if [show buttons]; otherwise, false.
+ ///
+ [Browsable(true), Category("Appearance"), Description("Hides DropDown and Spin Buttons, Allows keyed entry only.")]
+ public bool ShowButtons
+ {
+ get
+ {
+ return _showButtons;
+ }
+
+ set
+ {
+ if (!ReadOnly)
+ {
+ _showButtons = value;
+
+ if (_showButtons)
+ {
+ _buttonWidth = BUTTON_WIDTH;
+ }
+ else
+ {
+ _buttonWidth = 0;
+ }
+
+ KryptonDateTimePickerExtended_Resize(this, null);
+ }
+ }
+ }
+
+ ///
+ /// Gets or sets a value indicating whether [show CheckBox].
+ ///
+ ///
+ /// true if [show CheckBox]; otherwise, false.
+ ///
+ [Browsable(true), Category("Appearance"), Description("Hides DropDown and Spin Buttons, Allows keyed entry only.")]
+ public new bool ShowCheckBox
+ {
+ get
+ {
+ return base.ShowCheckBox;
+ }
+
+ set
+ {
+ if (!ReadOnly)
+ {
+ base.ShowCheckBox = value;
+
+ if (base.ShowCheckBox)
+ {
+ _checkWith = BUTTON_WIDTH;
+ }
+ else
+ {
+ _checkWith = 0;
+ }
+
+ KryptonDateTimePickerExtended_Resize(this, null);
+ }
+ }
+ }
+
+ ///
+ /// Gets or sets the text.
+ ///
+ ///
+ /// The text.
+ ///
+ [Browsable(true), Category("Behavior"), Description("Date and Time displayed")]
+ public new string Text
+ {
+ get
+ {
+ return ktxtDateTime.Text;
+ }
+
+ set
+ {
+ ktxtDateTime.Text = value;
+
+ if (value != "")
+ {
+ FormatKryptonTextBox();
+ }
+ }
+ }
+
+ ///
+ /// Gets or sets a value indicating whether [show up down].
+ ///
+ ///
+ /// true if [show up down]; otherwise, false.
+ ///
+ [Browsable(true), Category("Appearance"), Description("Uses Updown control to select dates instead of Dropdown control")]
+ public new bool ShowUpDown
+ {
+ get
+ {
+ return base.ShowUpDown;
+ }
+
+ set
+ {
+ if (!ReadOnly)
+ {
+ base.ShowUpDown = value;
+
+ ktxtDateTime.Text = "";
+ }
+ }
+ }
+
+ ///
+ /// Gets or sets the colour of the back.
+ ///
+ ///
+ /// The colour of the back.
+ ///
+ [Browsable(true), Category("Appearance"), Description("The Backround Colour user to display Text and Graphics in this Control")]
+ public new Color BackColor
+ {
+ get
+ {
+ return base.BackColor;
+ }
+
+ set
+ {
+ base.BackColor = value;
+ }
+ }
+
+ ///
+ /// Gets or sets a value indicating whether [read only].
+ ///
+ ///
+ /// true if [read only]; otherwise, false.
+ ///
+ [Browsable(true), Category("Behavior"), Description("Used to set whether the control can be edited")]
+ public bool ReadOnly
+ {
+ get
+ {
+ return ktxtDateTime.ReadOnly;
+ }
+
+ set
+ {
+ if (value)
+ {
+ ShowCheckBox = false;
+
+ ShowUpDown = false;
+
+ ShowButtons = false;
+
+ ktxtDateTime.ReadOnly = value;
+ }
+ else
+ {
+ ktxtDateTime.ReadOnly = value;
+
+ ShowButtons = true;
+ }
+ }
+ }
+
+ ///
+ /// Gets or sets the linked to.
+ ///
+ ///
+ /// The linked to.
+ ///
+ [Browsable(true), Category("Behavior"), Description("Set Get another Date Picker Control that this control receives data from.")]
+ public string LinkedTo
+ {
+ get
+ {
+ return _linkedTo;
+ }
+
+ set
+ {
+ _linkedTo = value;
+
+ _linkedArray.Clear();
+
+ if (_linkedTo != "" && _linkedTo != null)
+ {
+ string[] splitLinkedTo = _linkedTo.Split(",".ToCharArray());
+
+ for (int i = 0; i < splitLinkedTo.Length; i++)
+ {
+ _linkedArray.Add(splitLinkedTo[i].Trim());
+ }
+ }
+ }
+ }
+
+ ///
+ /// Gets or sets a value indicating whether [set date].
+ ///
+ ///
+ /// true if [set date]; otherwise, false.
+ ///
+ public bool SetDate
+ {
+ get
+ {
+ return _setDate;
+ }
+
+ set
+ {
+ _setDate = value;
+ }
+ }
+ #endregion
+
+ #region Methods
+ private void InitialiseCustomMessage()
+ {
+ switch (_customExtensions)
+ {
+ case DateTimePickerCustomExtensions.DTPLONG:
+ _customFormatMessage = "Long Date (" + DateTime.Now.ToLongDateString() + ")";
+
+ CustomFormat = "yyyy-MM-dd HH:mm:ss";
+ break;
+ case DateTimePickerCustomExtensions.DTPSHORT:
+ _customFormatMessage = "Short Date (" + DateTime.Now.ToShortDateString() + ")";
+
+ CustomFormat = "yyyy-MM-dd HH:mm:ss";
+ break;
+ case DateTimePickerCustomExtensions.DTPTIME:
+ _customFormatMessage = "Long Time AM/PM (" + DateTime.Now.ToLongTimeString() + ")";
+
+ CustomFormat = "HH:mm:ss yyyy-MM-dd ";
+ break;
+ case DateTimePickerCustomExtensions.DTPSHORTDATESHORTTIMEAMPM:
+ _customFormatMessage = " Short Date Short Time AM/PM (" + DateTime.Now.ToString("d", Application.CurrentCulture) + " " + DateTime.Now.ToString("hh:mmss tt", Application.CurrentCulture) + ")";
+
+ CustomFormat = "yyyy-MM-dd HH:mm:ss";
+ break;
+ case DateTimePickerCustomExtensions.DTPSHORTDATELONGTIMEAMPM:
+ _customFormatMessage = "Short Date Long Time AM/PM (" + DateTime.Now.ToString("G", Application.CurrentCulture) + ")";
+
+ CustomFormat = "yyyy-MM-dd HH:mm:ss";
+ break;
+ case DateTimePickerCustomExtensions.DTPSHORTDATESHORTTIME24HOUR:
+ _customFormatMessage = " Short Date Short Time 24 Hour (" + DateTime.Now.ToString("d", Application.CurrentCulture) + " " + DateTime.Now.ToString("HH:mm", Application.CurrentCulture) + ")";
+
+ CustomFormat = "yyyy-MM-dd HH:mm:ss";
+ break;
+ case DateTimePickerCustomExtensions.DTPSHORTDATELONGTIME24HOUR:
+ _customFormatMessage = "Short Date Long Time AM/PM (" + DateTime.Now.ToString("G", Application.CurrentCulture) + ")";
+
+ CustomFormat = "yyyy-MM-dd HH:mm:ss";
+ break;
+ case DateTimePickerCustomExtensions.DTPLONGDATESHORTTIMEAMPM:
+ _customFormatMessage = "Long Date Short Time AM/PM (" + DateTime.Now.ToString("D", Application.CurrentCulture) + " " + DateTime.Now.ToString("hh:mm tt", Application.CurrentCulture) + ")";
+
+ CustomFormat = "yyyy-MM-dd HH:mm:ss";
+ break;
+ case DateTimePickerCustomExtensions.DTPLONGDATELONGTIMEAMPM:
+ _customFormatMessage = "Long Date Long Time AM/PM (" + DateTime.Now.ToString("D", Application.CurrentCulture) + " " + DateTime.Now.ToString("hh:mm:ss tt", Application.CurrentCulture) + ")";
+
+ CustomFormat = "yyyy-MM-dd HH:mm:ss";
+ break;
+ case DateTimePickerCustomExtensions.DTPLONGDATESHORTTIME24HOUR:
+ _customFormatMessage = "Long Date Short Time 24 Hour (" + DateTime.Now.ToString("D", Application.CurrentCulture) + " " + DateTime.Now.ToString("HH:mm", Application.CurrentCulture) + ")";
+
+ CustomFormat = "yyyy-MM-dd HH:mm:ss";
+ break;
+ case DateTimePickerCustomExtensions.DTPLONGDATELONGTIME24HOUR:
+ _customFormatMessage = "Long Date Long Time 24 Hour (" + DateTime.Now.ToString("D", Application.CurrentCulture) + " " + DateTime.Now.ToString("HH:mm:ss", Application.CurrentCulture) + ")";
+
+ CustomFormat = "yyyy-MM-dd HH:mm:ss";
+ break;
+ case DateTimePickerCustomExtensions.DTPSORTABLEDATEANDTIMELOCALTIME:
+ _customFormatMessage = "Sortable Date and Local Time (" + DateTime.Now.ToString("s", Application.CurrentCulture) + ")";
+
+ CustomFormat = "yyyy-MM-dd HH:mm:ss";
+ break;
+ case DateTimePickerCustomExtensions.DTPUTFLOCALDATEANDSHORTTIMEAMPM:
+ _customFormatMessage = "UTF Local Date and Short Time AM/PM (" + DateTime.Now.ToString("yyyy-MM-dd HH:mm tt", Application.CurrentCulture) + ")";
+
+ CustomFormat = "yyyy-MM-dd HH:mm:ss";
+ break;
+ case DateTimePickerCustomExtensions.DTPUTFLOCALDATEANDLONGTIMEAMPM:
+ Value = DateTime.Parse(ktxtDateTime.Text);
+
+ ktxtDateTime.Text = Value.ToString("yyyy-MM-dd", Application.CurrentCulture) + " " + Value.ToString("hh:mm:ss tt", Application.CurrentCulture);
+ break;
+ case DateTimePickerCustomExtensions.DTPUTFLOCALDATEANDSHORTTIME24HOUR:
+ Value = DateTime.Parse(ktxtDateTime.Text);
+
+ ktxtDateTime.Text = Value.ToString("yyyy-MM-dd", Application.CurrentCulture) + " " + Value.ToString("HH:mm", Application.CurrentCulture);
+ break;
+ case DateTimePickerCustomExtensions.DTPUTFLOCALDATEANDLONGTIME24HOUR:
+ _customFormatMessage = "UTF Local Date and Long Time 24 Hour (" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss", Application.CurrentCulture) + ")";
+
+ CustomFormat = "yyyy-MM-dd HH:mm:ss";
+ break;
+ case DateTimePickerCustomExtensions.DTPSHORTTIMEAMPM:
+ Value = DateTime.Parse(ktxtDateTime.Text);
+
+ ktxtDateTime.Text = Value.ToString("hh:mm tt", Application.CurrentCulture);
+ break;
+ case DateTimePickerCustomExtensions.DTPSHORTTIME24HOUR:
+ _customFormatMessage = "Short Time 24 Hour (" + DateTime.Now.ToString("HH:mm", Application.CurrentCulture) + ")";
+
+ CustomFormat = "HH:mm:ss yyyy-MM-dd ";
+ break;
+ case DateTimePickerCustomExtensions.DTPLONGTIME24HOUR:
+ Value = DateTime.Parse(ktxtDateTime.Text);
+
+ ktxtDateTime.Text = Value.ToString("HH:mm:ss", Application.CurrentCulture);
+ break;
+ case DateTimePickerCustomExtensions.DTPYEARANDMONTHNAME:
+ try
+ {
+ Value = DateTime.Parse(ktxtDateTime.Text);
+ }
+ catch
+ {
+ try
+ {
+ ktxtDateTime.Text = DateTime.Now.Year.ToString() + " " + int.Parse(ktxtDateTime.Text, Application.CurrentCulture).ToString();
+ }
+ catch
+ {
+ Value = DateTime.Parse(ktxtDateTime.Text + " 01");
+ }
+ }
+
+ ktxtDateTime.Text = Value.ToString("Y", Application.CurrentCulture);
+ break;
+ case DateTimePickerCustomExtensions.DTPMONTHNAMEANDDAY:
+ _customFormatMessage = "Month Name and Day (" + DateTime.Now.ToString("M", Application.CurrentCulture) + ")";
+
+ CustomFormat = "dd-MM-yyyy HH:mm:ss";
+ break;
+ case DateTimePickerCustomExtensions.DTPYEAR4DIGIT:
+ _customFormatMessage = "4 Digit Year (" + DateTime.Now.ToString("yyyy", Application.CurrentCulture);
+
+ CustomFormat = "yyyy-MM-dd HH:mm:ss";
+ break;
+ case DateTimePickerCustomExtensions.DTPMONTHFULLNAME:
+ try
+ {
+ Value = DateTime.Parse(ktxtDateTime.Text);
+ }
+ catch
+ {
+ int aMonth;
+
+ DateTime aDate;
+
+ string[] sMonth = new string[] { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
+
+ for (aMonth = 0; aMonth < 12; aMonth++)
+ {
+ aDate = DateTime.Parse(DateTime.Now.Year.ToString() + "-" + (aMonth + 1) + "-" + "01");
+
+ if (sMonth[aMonth].ToLower() == ktxtDateTime.Text.ToLower() || sMonth[aMonth].ToLower() == ktxtDateTime.Text.Substring(0, 3).ToLower())
+ {
+ Value = DateTime.Parse(DateTime.Now.Year.ToString() + "-" + (aMonth + 1) + "-" + "01");
+
+ break;
+ }
+ }
+ }
+
+ ktxtDateTime.Text = Value.ToString("MMMM", Application.CurrentCulture);
+ break;
+ case DateTimePickerCustomExtensions.DTPMONTHSHORTNAME:
+ try
+ {
+ Value = DateTime.Parse(ktxtDateTime.Text);
+ }
+ catch
+ {
+ int aMonth;
+
+ DateTime aDate;
+
+ string[] sMonth = new string[] { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
+
+ for (aMonth = 0; aMonth < 12; aMonth++)
+ {
+ aDate = DateTime.Parse(DateTime.Now.Year.ToString() + "-" + (aMonth + 1) + "-" + "01");
+
+ if (sMonth[aMonth].ToLower() == ktxtDateTime.Text.ToLower() || sMonth[aMonth].ToLower() == ktxtDateTime.Text.Substring(0, 3).ToLower())
+ {
+ Value = DateTime.Parse(DateTime.Now.Year.ToString() + "-" + (aMonth + 1) + "-" + "01");
+
+ break;
+ }
+ }
+ }
+
+ ktxtDateTime.Text = Value.ToString("MMM", Application.CurrentCulture);
+ break;
+ case DateTimePickerCustomExtensions.DTPDAYFULLNAME:
+ _customFormatMessage = "Day of the Week Full Name (" + DateTime.Now.ToString("dddd", Application.CurrentCulture) + ")";
+
+ CustomFormat = "dd-MM-yyyy HH:mm:ss";
+ break;
+ case DateTimePickerCustomExtensions.DTPDAYSHORTNAME:
+ _customFormatMessage = "Day of the Week Short Name (" + DateTime.Now.ToString("ddd", Application.CurrentCulture) + ")";
+
+ CustomFormat = "dd-MM-yyyy HH:mm:ss";
+ break;
+ case DateTimePickerCustomExtensions.DTPSHORTDATEAMPM:
+ _customFormatMessage = "Short Date AM/PM (" + DateTime.Now.ToString("d", Application.CurrentCulture) + " " + DateTime.Now.ToString("tt", Application.CurrentCulture) + ")";
+
+ CustomFormat = "MM-dd-yyyy HH:mm:ss";
+ break;
+ case DateTimePickerCustomExtensions.DTPSHORTDATEMORNINGAFTERNOON:
+ string AMPM = "AM";
+
+ if (DateTime.Now.Hour >= 12)
+ {
+ AMPM = "Afternoon";
+ }
+
+ _customFormatMessage = "Short Date Morning/Afternoon (" + DateTime.Now.ToString("d", Application.CurrentCulture) + " " + AMPM + ")";
+
+ CustomFormat = "MM-dd-yyyy HH:mm:ss";
+
+ break;
+ case DateTimePickerCustomExtensions.DTPCUSTOM:
+ _customFormatMessage = CustomFormat;
+ break;
+ }
+
+ toolTip.SetToolTip(ktxtDateTime, _customFormatMessage);
+ }
+
+ private void FormatKryptonTextBox()
+ {
+ switch (_customExtensions)
+ {
+ case DateTimePickerCustomExtensions.DTPLONG:
+ Value = DateTime.Parse(ktxtDateTime.Text);
+
+ ktxtDateTime.Text = Value.ToLongDateString();
+ break;
+ case DateTimePickerCustomExtensions.DTPSHORT:
+ Value = DateTime.Parse(ktxtDateTime.Text);
+
+ ktxtDateTime.Text = Value.ToShortDateString();
+ break;
+ case DateTimePickerCustomExtensions.DTPTIME:
+ Value = DateTime.Parse(ktxtDateTime.Text);
+
+ ktxtDateTime.Text = Value.ToLongTimeString();
+ break;
+ case DateTimePickerCustomExtensions.DTPSHORTDATESHORTTIMEAMPM:
+ Value = DateTime.Parse(ktxtDateTime.Text);
+
+ ktxtDateTime.Text = Value.ToString("d", Application.CurrentCulture) + " " + Value.ToString("hh:mms tt", Application.CurrentCulture);
+ break;
+ case DateTimePickerCustomExtensions.DTPSHORTDATELONGTIMEAMPM:
+ Value = DateTime.Parse(ktxtDateTime.Text);
+
+ ktxtDateTime.Text = Value.ToString("d", Application.CurrentCulture) + " " + Value.ToString("hh:mms:ss tt", Application.CurrentCulture);
+ break;
+ case DateTimePickerCustomExtensions.DTPSHORTDATESHORTTIME24HOUR:
+ Value = DateTime.Parse(ktxtDateTime.Text);
+
+ ktxtDateTime.Text = Value.ToString("d", Application.CurrentCulture) + " " + Value.ToString("HH:mm", Application.CurrentCulture);
+ break;
+ case DateTimePickerCustomExtensions.DTPSHORTDATELONGTIME24HOUR:
+ Value = DateTime.Parse(ktxtDateTime.Text);
+
+ ktxtDateTime.Text = Value.ToString("d", Application.CurrentCulture) + " " + Value.ToString("HH:mms:ss", Application.CurrentCulture);
+ break;
+ case DateTimePickerCustomExtensions.DTPLONGDATESHORTTIMEAMPM:
+ Value = DateTime.Parse(ktxtDateTime.Text);
+
+ ktxtDateTime.Text = Value.ToString("D", Application.CurrentCulture) + " " + Value.ToString("hh:mm tt", Application.CurrentCulture);
+ break;
+ case DateTimePickerCustomExtensions.DTPLONGDATELONGTIMEAMPM:
+ Value = DateTime.Parse(ktxtDateTime.Text);
+
+ ktxtDateTime.Text = Value.ToString("D", Application.CurrentCulture) + " " + Value.ToString("hh:mm:ss tt", Application.CurrentCulture);
+ break;
+ case DateTimePickerCustomExtensions.DTPLONGDATESHORTTIME24HOUR:
+ Value = DateTime.Parse(ktxtDateTime.Text);
+
+ ktxtDateTime.Text = Value.ToString("D", Application.CurrentCulture) + " " + Value.ToString("HH:mm", Application.CurrentCulture);
+ break;
+ case DateTimePickerCustomExtensions.DTPLONGDATELONGTIME24HOUR:
+ Value = DateTime.Parse(ktxtDateTime.Text);
+
+ ktxtDateTime.Text = Value.ToString("D", Application.CurrentCulture) + " " + Value.ToString("HH:mm:ss", Application.CurrentCulture);
+ break;
+ case DateTimePickerCustomExtensions.DTPSORTABLEDATEANDTIMELOCALTIME:
+ Value = DateTime.Parse(ktxtDateTime.Text);
+
+ ktxtDateTime.Text = Value.ToString("s", Application.CurrentCulture);
+ break;
+ case DateTimePickerCustomExtensions.DTPUTFLOCALDATEANDSHORTTIMEAMPM:
+ Value = DateTime.Parse(ktxtDateTime.Text);
+
+ ktxtDateTime.Text = Value.ToString("yyyy-MM-dd", Application.CurrentCulture) + " " + Value.ToString("hh:mm tt", Application.CurrentCulture);
+ break;
+ case DateTimePickerCustomExtensions.DTPUTFLOCALDATEANDLONGTIMEAMPM:
+ Value = DateTime.Parse(ktxtDateTime.Text);
+
+ ktxtDateTime.Text = Value.ToString("yyyy-MM-dd", Application.CurrentCulture) + " " + Value.ToString("hh:mm:ss tt", Application.CurrentCulture);
+ break;
+ case DateTimePickerCustomExtensions.DTPUTFLOCALDATEANDSHORTTIME24HOUR:
+ Value = DateTime.Parse(ktxtDateTime.Text);
+
+ ktxtDateTime.Text = Value.ToString("yyyy-MM-dd", Application.CurrentCulture) + " " + Value.ToString("HH:mm", Application.CurrentCulture);
+ break;
+ case DateTimePickerCustomExtensions.DTPUTFLOCALDATEANDLONGTIME24HOUR:
+ Value = DateTime.Parse(ktxtDateTime.Text);
+
+ ktxtDateTime.Text = Value.ToString("yyyy-MM-dd", Application.CurrentCulture) + " " + Value.ToString("HH:mm:ss", Application.CurrentCulture);
+ break;
+ case DateTimePickerCustomExtensions.DTPSHORTTIMEAMPM:
+ Value = DateTime.Parse(ktxtDateTime.Text);
+
+ ktxtDateTime.Text = Value.ToString("hh:mm tt", Application.CurrentCulture);
+ break;
+ case DateTimePickerCustomExtensions.DTPSHORTTIME24HOUR:
+ Value = DateTime.Parse(ktxtDateTime.Text);
+
+ ktxtDateTime.Text = Value.ToString("HH:mm", Application.CurrentCulture);
+ break;
+ case DateTimePickerCustomExtensions.DTPLONGTIME24HOUR:
+ Value = DateTime.Parse(ktxtDateTime.Text);
+
+ ktxtDateTime.Text = Value.ToString("HH:mm:ss", Application.CurrentCulture);
+ break;
+ case DateTimePickerCustomExtensions.DTPYEARANDMONTHNAME:
+ try
+ {
+ Value = DateTime.Parse(ktxtDateTime.Text);
+ }
+ catch
+ {
+ try
+ {
+ ktxtDateTime.Text = DateTime.Now.Year.ToString() + " " + int.Parse(ktxtDateTime.Text, Application.CurrentCulture).ToString();
+ }
+ catch
+ {
+ Value = DateTime.Parse(ktxtDateTime.Text + " 01");
+ }
+ }
+
+ ktxtDateTime.Text = Value.ToString("Y", Application.CurrentCulture);
+ break;
+ case DateTimePickerCustomExtensions.DTPMONTHNAMEANDDAY:
+ Value = DateTime.Parse(ktxtDateTime.Text);
+
+ ktxtDateTime.Text = Value.ToString("M", Application.CurrentCulture);
+ break;
+ case DateTimePickerCustomExtensions.DTPYEAR4DIGIT:
+ try
+ {
+ Value = DateTime.Parse(ktxtDateTime.Text);
+ }
+ catch
+ {
+ Value = DateTime.Parse("01 01 " + ktxtDateTime.Text);
+ }
+
+ ktxtDateTime.Text = Value.ToString("yyyy", Application.CurrentCulture);
+ break;
+ case DateTimePickerCustomExtensions.DTPMONTHFULLNAME:
+ try
+ {
+ Value = DateTime.Parse(ktxtDateTime.Text);
+ }
+ catch
+ {
+ int aMonth;
+
+ DateTime aDate;
+
+ string[] sMonth = new string[] { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
+
+ for (aMonth = 0; aMonth < 12; aMonth++)
+ {
+ aDate = DateTime.Parse(DateTime.Now.Year.ToString() + "-" + (aMonth + 1) + "-" + "01");
+
+ if (sMonth[aMonth].ToLower() == ktxtDateTime.Text.ToLower() || sMonth[aMonth].ToLower() == ktxtDateTime.Text.Substring(0, 3).ToLower())
+ {
+ Value = DateTime.Parse(DateTime.Now.Year.ToString() + "-" + (aMonth + 1) + "-" + "01");
+
+ break;
+ }
+ }
+ }
+
+ ktxtDateTime.Text = Value.ToString("MMMM", Application.CurrentCulture);
+ break;
+ case DateTimePickerCustomExtensions.DTPMONTHSHORTNAME:
+ try
+ {
+ Value = DateTime.Parse(ktxtDateTime.Text);
+ }
+ catch
+ {
+ int aMonth;
+
+ DateTime aDate;
+
+ string[] sMonth = new string[] { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
+
+ for (aMonth = 0; aMonth < 12; aMonth++)
+ {
+ aDate = DateTime.Parse(DateTime.Now.Year.ToString() + "-" + (aMonth + 1) + "-" + "01");
+
+ if (sMonth[aMonth].ToLower() == ktxtDateTime.Text.ToLower() || sMonth[aMonth].ToLower() == ktxtDateTime.Text.Substring(0, 3).ToLower())
+ {
+ Value = DateTime.Parse(DateTime.Now.Year.ToString() + "-" + (aMonth + 1) + "-" + "01");
+
+ break;
+ }
+ }
+ }
+
+ ktxtDateTime.Text = Value.ToString("MMM", Application.CurrentCulture);
+ break;
+ case DateTimePickerCustomExtensions.DTPDAYFULLNAME:
+ try
+ {
+ Value = DateTime.Parse(ktxtDateTime.Text);
+ }
+ catch
+ {
+ int aDay;
+
+ DateTime aDate;
+
+ for (aDay = 1; aDay < 8; aDay++)
+ {
+ aDate = DateTime.Parse(DateTime.Now.Year.ToString() + "-01-" + aDay.ToString());
+
+ if (aDate.DayOfWeek.ToString().ToLower() == ktxtDateTime.Text.ToLower() || aDate.DayOfWeek.ToString().Substring(0, 3).ToLower() == ktxtDateTime.Text.ToLower())
+ {
+ Value = DateTime.Parse(DateTime.Now.Year.ToString() + "-01-" + aDay.ToString());
+
+ break;
+ }
+ }
+ }
+
+ ktxtDateTime.Text = Value.ToString("dddd", Application.CurrentCulture);
+ break;
+ case DateTimePickerCustomExtensions.DTPDAYSHORTNAME:
+ try
+ {
+ Value = DateTime.Parse(ktxtDateTime.Text);
+ }
+ catch
+ {
+ int aDay;
+
+ DateTime aDate;
+
+ for (aDay = 1; aDay < 8; aDay++)
+ {
+ aDate = DateTime.Parse(DateTime.Now.Year.ToString() + "-01-" + aDay.ToString());
+
+ if (aDate.DayOfWeek.ToString().ToLower() == ktxtDateTime.Text.ToLower() || aDate.DayOfWeek.ToString().Substring(0, 3).ToLower() == ktxtDateTime.Text.ToLower())
+ {
+ Value = DateTime.Parse(DateTime.Now.Year.ToString() + "-01-" + aDay.ToString());
+
+ break;
+ }
+ }
+ }
+
+ ktxtDateTime.Text = Value.ToString("ddd", Application.CurrentCulture);
+ break;
+ case DateTimePickerCustomExtensions.DTPSHORTDATEAMPM:
+ if (ktxtDateTime.Text.Substring(ktxtDateTime.Text.Length - 2, 2).ToLower() == "pm")
+ {
+ ktxtDateTime.Text = ktxtDateTime.Text.Substring(0, ktxtDateTime.Text.Length - 2);
+
+ ktxtDateTime.Text = ktxtDateTime.Text + " 13:00";
+ }
+ else
+ {
+ if (ktxtDateTime.Text.Substring(ktxtDateTime.Text.Length - 2, 2).ToLower() == "am")
+ {
+ ktxtDateTime.Text = ktxtDateTime.Text.Substring(0, ktxtDateTime.Text.Length - 2);
+ }
+
+ ktxtDateTime.Text = ktxtDateTime.Text + " 01:00";
+ }
+
+ Value = DateTime.Parse(ktxtDateTime.Text);
+
+ ktxtDateTime.Text = Value.ToString("d", Application.CurrentCulture) + " " + Value.ToString("tt", Application.CurrentCulture);
+ break;
+ case DateTimePickerCustomExtensions.DTPSHORTDATEMORNINGAFTERNOON:
+ string AMPM = "Morning";
+
+ if (ktxtDateTime.Text.Substring(ktxtDateTime.Text.Length - 2, 2).ToLower() == "pm")
+ {
+ ktxtDateTime.Text = ktxtDateTime.Text.Substring(0, ktxtDateTime.Text.Length - 2);
+
+ ktxtDateTime.Text = ktxtDateTime.Text + " 13:00";
+ }
+ else
+ {
+ if (ktxtDateTime.Text.Substring(ktxtDateTime.Text.Length - 2, 2).ToLower() == "am")
+ {
+ ktxtDateTime.Text = ktxtDateTime.Text.Substring(0, ktxtDateTime.Text.Length - 2);
+ }
+
+ ktxtDateTime.Text = ktxtDateTime.Text + " 01:00";
+ }
+
+ Value = DateTime.Parse(ktxtDateTime.Text);
+
+ if (Value.Hour >= 12)
+ {
+ AMPM = "Afternoon";
+ }
+
+ ktxtDateTime.Text = Value.ToString("d", Application.CurrentCulture) + " " + AMPM;
+ break;
+ case DateTimePickerCustomExtensions.DTPCUSTOM:
+ Value = DateTime.Parse(ktxtDateTime.Text);
+
+ ktxtDateTime.Text = Value.ToString(CustomFormat, Application.CurrentCulture);
+ break;
+ }
+ }
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/Source/Krypton Toolkit Suite Extended/Extended Controls/ExtendedToolkit/Controls/ModernProgressBar.Designer.cs b/Source/Krypton Toolkit Suite Extended/Extended Controls/ExtendedToolkit/Controls/ModernProgressBar.Designer.cs
new file mode 100644
index 00000000..88b19381
--- /dev/null
+++ b/Source/Krypton Toolkit Suite Extended/Extended Controls/ExtendedToolkit/Controls/ModernProgressBar.Designer.cs
@@ -0,0 +1,65 @@
+namespace ExtendedControls.ExtendedToolkit.Controls
+{
+ partial class ModernProgressBar
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Component Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ModernProgressBar));
+ this.pictureBox1 = new System.Windows.Forms.PictureBox();
+ ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
+ this.SuspendLayout();
+ //
+ // pictureBox1
+ //
+ this.pictureBox1.BackColor = System.Drawing.Color.Transparent;
+ this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
+ this.pictureBox1.Location = new System.Drawing.Point(0, 0);
+ this.pictureBox1.Name = "pictureBox1";
+ this.pictureBox1.Size = new System.Drawing.Size(308, 14);
+ this.pictureBox1.TabIndex = 1;
+ this.pictureBox1.TabStop = false;
+ //
+ // ModernProgressBar
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.AutoSize = true;
+ this.BackColor = System.Drawing.Color.Transparent;
+ this.Controls.Add(this.pictureBox1);
+ this.Name = "ModernProgressBar";
+ this.Size = new System.Drawing.Size(308, 14);
+ ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.PictureBox pictureBox1;
+ }
+}
diff --git a/Source/Krypton Toolkit Suite Extended/Extended Controls/ExtendedToolkit/Controls/ModernProgressBar.cs b/Source/Krypton Toolkit Suite Extended/Extended Controls/ExtendedToolkit/Controls/ModernProgressBar.cs
new file mode 100644
index 00000000..2a54720a
--- /dev/null
+++ b/Source/Krypton Toolkit Suite Extended/Extended Controls/ExtendedToolkit/Controls/ModernProgressBar.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Drawing;
+using System.Data;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace ExtendedControls.ExtendedToolkit.Controls
+{
+ public partial class ModernProgressBar : UserControl
+ {
+ public ModernProgressBar()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/Source/Krypton Toolkit Suite Extended/Extended Controls/ExtendedToolkit/Controls/ModernProgressBar.resx b/Source/Krypton Toolkit Suite Extended/Extended Controls/ExtendedToolkit/Controls/ModernProgressBar.resx
new file mode 100644
index 00000000..8e769d6c
--- /dev/null
+++ b/Source/Krypton Toolkit Suite Extended/Extended Controls/ExtendedToolkit/Controls/ModernProgressBar.resx
@@ -0,0 +1,195 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+
+
+ R0lGODlhIAEEAIABAJmZmZmZmSH/C05FVFNDQVBFMi4wAwEAAAAh/wtYTVAgRGF0YVhNUDw/eHBhY2tl
+ dCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1s
+ bnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEz
+ NDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRw
+ Oi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiBy
+ ZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4
+ bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9u
+ cy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRv
+ YmUgUGhvdG9zaG9wIENTNSBNYWNpbnRvc2giIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6NzIyODk0
+ OTIzQzQ4MTFFMDhDMkI5MTRDRkI1NUZCRDAiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6NzIyODk0
+ OTMzQzQ4MTFFMDhDMkI5MTRDRkI1NUZCRDAiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFu
+ Y2VJRD0ieG1wLmlpZDpCMzk3NkZDRDNCOUYxMUUwOEMyQjkxNENGQjU1RkJEMCIgc3RSZWY6ZG9jdW1l
+ bnRJRD0ieG1wLmRpZDpCMzk3NkZDRTNCOUYxMUUwOEMyQjkxNENGQjU1RkJEMCIvPiA8L3JkZjpEZXNj
+ cmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PgH//v38+/r5
+ +Pf29fTz8vHw7+7t7Ovq6ejn5uXk4+Lh4N/e3dzb2tnY19bV1NPS0dDPzs3My8rJyMfGxcTDwsHAv769
+ vLu6ubi3trW0s7KxsK+urayrqqmop6alpKOioaCfnp2cm5qZmJeWlZSTkpGQj46NjIuKiYiHhoWEg4KB
+ gH9+fXx7enl4d3Z1dHNycXBvbm1sa2ppaGdmZWRjYmFgX15dXFtaWVhXVlVUU1JRUE9OTUxLSklIR0ZF
+ RENCQUA/Pj08Ozo5ODc2NTQzMjEwLy4tLCsqKSgnJiUkIyIhIB8eHRwbGhkYFxYVFBMSERAPDg0MCwoJ
+ CAcGBQQDAgEAACH5BAkAAAEALAAAAAAgAQQAAAIojI+giu0Po5y02ouz3rz7Xy0MSJbmiabqmooAC8fy
+ TNeqa+f6zvdaAQAh+QQJAAABACwAAAAAIAEEAAACKYyPqct9AKGbtNqLs968+w+GTwSI5omm6sq2FVm6
+ 8kzX9o3B+M73/lUAACH5BAkAAAEALAAAAAAgAQQAAAIojI+py+0PgZSw2ouz3rz7D4bgRInmiabqyrYR
+ 6cbyTNd2RgL3zvdqAQAh+QQJAAABACwAAAAAIAEEAAACLoyPCbvpD6OctB7WrN68+w+GIoQB44lGZcq2
+ 7gtza0xvc43n+v7c/O/7CYfERAEAIfkECQAAAQAsAAAAACABBAAAAi2Mj6nLzQChm7RaE+XdvPsPhuL4
+ ZQCJTmbKtu4Lx8oqp3SN5/re3rzn+wmHsQIAIfkECQAAAQAsAAAAACABBAAAAjKMj6kH3QujnLQi96zC
+ QPsPhuJIlgtnpikqsuoLx/KcuPS9YaON9/5P4wFnQk1xiEy+CgAh+QQJAAABACwAAAAAIAEEAAACNIyP
+ qcvtBmJ8tNogZ836+g+G4kiWpsOdarqx6gvH8kxDWQ26Dwfg/g8MvnRCBrHBKyqXrwIAIfkECQAAAQAs
+ AAAAACABBAAAAjkEgqnL7Q+jRKaeiYO9cucPhuJIkkaJptHGqZqFee5M1zZz3vrH1nIH2wmHREeuiEz0
+ aL9VMAmNqgoAIfkECQAAAQAsAAAAACABBAAAAjmMj6mb4M6inFQ+WM8FOewOhuJIlubZXOg6faBbwexM
+ 1/ZtyDiqU3302wmHxFuw2DkylKkH8gllFQAAIfkECQAAAQAsAAAAACABBAAAAjiMj6nL7QtifLTKWc0F
+ OewOhuJIluaJKl/qrJlLwexM1/bNyrfeXh2PCwqHRBSQdoT4Xsui83kqAAAh+QQJAAABACwAAAAAIAEE
+ AAACPowNmcftD6OcUS36LMBH8+B94kiW5omF6MqClqmmLxe39o3nrqL3U/0BSoQQou+IPBqTuOVwRoNS
+ nMyqFVMAACH5BAkAAAEALAAAAAAgAQQAAAI+jI+pywH/mpyUwVgvqEdzz4XiSJbmiSpgyjrX94brNLf2
+ jed6rcsxxZMEF8Oe8YjsFZOqH80JhDaWzKp1UgAAIfkECQAAAQAsAAAAACABBAAAAj6Mj6nL7QtifFTJ
+ SS+oR/PgfeJIluaJpmSodlfFwi8Xt/aN5/pZqz00owUzw53xiEzyij4mUCL6MaTKqrVRAAAh+QQJAAAB
+ ACwAAAAAIAEEAAACP4yPqcvt/4CUME1aL6hH8+B94kiW5ommqnWNIfRmLRev9o3n+g7OX90AOoQMIu+I
+ TCpTxqIv8oRFh9Ol9YooAAAh+QQJAAABACwAAAAAIAEEAAACP4yPqcvtDxGYMx5aIwbW7P514kiW5omm
+ qhJa7fNCsTOv9o3n+l43PYsR/YCUnfGITCoDQ2JGFgRFNdOl9XooAAAh+QQJAAABACwAAAAAIAEEAAAC
+ PoyPqcvtDxmYMx5aIwbWbPt14kiW5omm6hKCmEuJ7TOv9o3n+n69Xd0AOoQsH++ITCp3RImR9oQ0E9Ol
+ lVcAACH5BAkAAAEALAAAAAAgAQQAAAI/jI+py+0PIZgzHlolBjZsHm3dSJbmiabqyoid+3wvHGPsjef6
+ zi+0Rgn9HDJhsIdMKpe9IdEGPBqlNSrzmiwAACH5BAkAAAEALAAAAAAgAQQAAAI+jI+py+0PowGUylmB
+ zPpyn13iSJbmiabq8oHVFroW/K72jef6nrT0DPFFhA8i74hMKm9GR5MV+3WG0aV1VwAAIfkECQAAAQAs
+ AAAAACABBAAAAj6Mj6nL7Q+jApRKU23M4AZ+gd5IluaJpuopSu3zQrEzr/aN5/peN/2U8fyAlZ3xiEwq
+ P8FQU/bcRGHTpXVVAAAh+QQJAAABACwAAAAAIAEEAAACPoyPqcvtD6MDlEpTbczgBi6B3kiW5ommKiqG
+ mVt57TOv9o3n+n7U9LsBwjQQH++ITCpvxkZT8VxEEdOl1VMAACH5BAkAAAEALAAAAAAgAQQAAAI/jI+p
+ y+0PowSUSlMtzDpyMGXXSJbmiabqynCju8Ge/NDsjef6zh92LYoFZ0NgpYdMKpfIn8Op+FykxA7zeioA
+ ACH5BAkAAAEALAAAAAAgAQQAAAI9jI+py+0Pozyg1hnsjRrgPoHYSJbmiabqKUrt80KxM6/2jef6Xje9
+ 8lsEE8Od8YhM2ooIZkbzgbqkymqpAAAh+QQJAAABACwAAAAAIAEEAAACPYyPqcvtD6NcoNYZ7I0a4D6B
+ 2EiW5omm6ilK7fNCsTOv9o3n+l43vfKjaELDnfGITCqDwKLMyYHCpMoqpAAAIfkECQAAAQAsAAAAACAB
+ BAAAAj+Mj6nL7Q+jfKDWGeyNGuAudR5GluaJpuqKgpMLwZwWyuyN5/rOGzZFm1k+wdivh0wql7djw6mA
+ LqQIEfP6KAAAIfkECQAAAQAsAAAAACABBAAAAj6Mj6nL7Q+jnKDWGeyNGuAugdhIluaJpioqhpprfS83
+ r/aN5/qetHT828CEDx/viEwqc8ZizQkceoLTpVVRAAAh+QQJAAABACwAAAAAIAEEAAACPoyPqcvtD6Oc
+ B9g7L4Ya0J5p1EiW5ommKtp5UhuB4RaL643n+s4n8Ct7BGs0jq2HTCqXux+x2BgaoQ4pk1kAACH5BAkA
+ AAEALAAAAAAgAQQAAAI9jI+py+0Po5wLWEsvjhpkPXXUSJbmiaYqKoYg90otfK32jef6rsz0BvEFY8Ma
+ 74hMKnfCR5PxbEQrxCWyAAAh+QQJAAABACwAAAAAIAEEAAACPYyPqcvtD6OcD1hLL44aZE1JXUiW5omm
+ ajpOLfRy4IrE9I3n+g7Pol8B9i46G++ITCqHmx9R9nQ2b8ZlpAAAIfkECQAAAQAsAAAAACABBAAAAj2M
+ j6nL7Q+jnBNYSy+OGmRNhSIHjuaJpmrafZfUVuVKP3GN5/qu3OT728BmvJyviEwqbUTIsfF0RJemqaMA
+ ACH5BAkAAAEALAAAAAAgAQQAAAI5jI+py+0Po5zUgIsnznCDinjgSJbmiabq6H1SG4mkvNb2jed6Ar+0
+ 86sEd8Si8ZjrxYYLpo+DPBYAACH5BAkAAAEALAAAAAAgAQQAAAI5jI+py+0Po5xUgXspznGDCnZbSJbm
+ iaaq42mjiK1lK9f2jefWK9GQr3sAg8Si8RgYCnnLGHKhfAYKACH5BAkAAAEALAAAAAAgAQQAAAI4jI+p
+ y+0Po5zUgXspznGDCoai5I3miaZqU04t9K7yHMT0jeei/fCMrwvCNsKi8Qj8ETvLo3MRKwAAIfkECQAA
+ AQAsAAAAACABBAAAAjKMj6nL7Q+jnFSCeynOFW7QheJIluaJpsanberqvvJM1/YNY63+svgPDApxPktM
+ VRzWCgAh+QQJAAABACwAAAAAIAEEAAACMoyPqcvtD6OctAaAMc3a+s9wAEiW5ommpbhx6tuw8EzXNixL
+ +a3u/A8M/nwPovBjhBUAACH5BAkAAAEALAAAAAAgAQQAAAItjI+py+0Po5y0IoCxPVnvD4biSJbmCXZA
+ 2qHuC8fyHKtsRuf6zvel/QH6hpECACH5BAkAAAEALAAAAAAgAQQAAAItjI+py+0Po5y0MoCx3TBrDobi
+ SJbm2Xko5wHrC8fyLLd0ZN/6zvdx7ksAg6ECACH5BAkAAAEALAAAAAAgAQQAAAIujI+py+0Po5y0QoCx
+ 3bzHrHniSJbm+YAAyraB6sbyTFdwjU93zve+uPsJXyBPAQAh+QQJAAABACwAAAAAIAEEAAACKIyPqcvt
+ D6OctNoJcr68+w+G4kiWl7aZ6sq27gtLKBDX9o3n9qz3TAEAIfkECQAAAQAsAAAAACABBAAAAiiMj6nL
+ 7Q+jnLTaiyvYO/sPhuJIlibJdefKtu4Lx0oKyPaN53pL708BACH5BAUAAAEALAAAAAAgAQQAAAIojI+p
+ y+0Po5y02ouz3gZ4z4XiSJbmiZ4fmLbuC8eyuQLzjef6TtZJAQAh+QQFAAABACwAAAAAAQABAAACAkwB
+ ADs=
+
+
+
\ No newline at end of file
diff --git a/Source/Krypton Toolkit Suite Extended/Extended Controls/ExtendedToolkit/UI/KryptonFormWithDropShadow.cs b/Source/Krypton Toolkit Suite Extended/Extended Controls/ExtendedToolkit/UI/KryptonFormWithDropShadow.cs
index 43277304..871e5f36 100644
--- a/Source/Krypton Toolkit Suite Extended/Extended Controls/ExtendedToolkit/UI/KryptonFormWithDropShadow.cs
+++ b/Source/Krypton Toolkit Suite Extended/Extended Controls/ExtendedToolkit/UI/KryptonFormWithDropShadow.cs
@@ -1,6 +1,5 @@
using ComponentFactory.Krypton.Toolkit;
using ExtendedControls.Base.Code;
-using ExtendedControls.Base.Renderers.Core;
using System;
using System.ComponentModel;
using System.Diagnostics;
diff --git a/Source/Krypton Toolkit Suite Extended/Extended Controls/ExtendedToolkit/UI/KryptonSplashScreen.Designer.cs b/Source/Krypton Toolkit Suite Extended/Extended Controls/ExtendedToolkit/UI/KryptonSplashScreen.Designer.cs
new file mode 100644
index 00000000..d2b47d70
--- /dev/null
+++ b/Source/Krypton Toolkit Suite Extended/Extended Controls/ExtendedToolkit/UI/KryptonSplashScreen.Designer.cs
@@ -0,0 +1,132 @@
+namespace ExtendedControls.ExtendedToolkit.UI
+{
+ partial class KryptonSplashScreen
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.components = new System.ComponentModel.Container();
+ this.kryptonManager1 = new ComponentFactory.Krypton.Toolkit.KryptonManager(this.components);
+ this.kpnlBackground = new ComponentFactory.Krypton.Toolkit.KryptonPanel();
+ this.lblCloseActive = new System.Windows.Forms.Label();
+ this.lblMinimise = new System.Windows.Forms.Label();
+ this.lblCloseInactive = new System.Windows.Forms.Label();
+ this.pbLoad = new System.Windows.Forms.ProgressBar();
+ ((System.ComponentModel.ISupportInitialize)(this.kpnlBackground)).BeginInit();
+ this.kpnlBackground.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // kpnlBackground
+ //
+ this.kpnlBackground.Controls.Add(this.lblCloseActive);
+ this.kpnlBackground.Controls.Add(this.lblMinimise);
+ this.kpnlBackground.Controls.Add(this.lblCloseInactive);
+ this.kpnlBackground.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.kpnlBackground.Location = new System.Drawing.Point(0, 0);
+ this.kpnlBackground.Name = "kpnlBackground";
+ this.kpnlBackground.Size = new System.Drawing.Size(814, 487);
+ this.kpnlBackground.TabIndex = 0;
+ //
+ // lblCloseActive
+ //
+ this.lblCloseActive.AutoSize = true;
+ this.lblCloseActive.BackColor = System.Drawing.Color.Transparent;
+ this.lblCloseActive.Cursor = System.Windows.Forms.Cursors.Hand;
+ this.lblCloseActive.Font = new System.Drawing.Font("Segoe UI", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.lblCloseActive.ForeColor = System.Drawing.Color.Red;
+ this.lblCloseActive.Location = new System.Drawing.Point(784, 9);
+ this.lblCloseActive.Name = "lblCloseActive";
+ this.lblCloseActive.Size = new System.Drawing.Size(18, 20);
+ this.lblCloseActive.TabIndex = 3;
+ this.lblCloseActive.Text = "X";
+ this.lblCloseActive.Click += new System.EventHandler(this.lblCloseActive_Click);
+ this.lblCloseActive.MouseLeave += new System.EventHandler(this.lblCloseActive_MouseLeave);
+ //
+ // lblMinimise
+ //
+ this.lblMinimise.AutoSize = true;
+ this.lblMinimise.BackColor = System.Drawing.Color.Transparent;
+ this.lblMinimise.Cursor = System.Windows.Forms.Cursors.Hand;
+ this.lblMinimise.Font = new System.Drawing.Font("Segoe UI", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.lblMinimise.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
+ this.lblMinimise.Location = new System.Drawing.Point(763, 9);
+ this.lblMinimise.Name = "lblMinimise";
+ this.lblMinimise.Size = new System.Drawing.Size(15, 20);
+ this.lblMinimise.TabIndex = 2;
+ this.lblMinimise.Text = "-";
+ this.lblMinimise.Click += new System.EventHandler(this.lblMinimise_Click);
+ //
+ // lblCloseInactive
+ //
+ this.lblCloseInactive.AutoSize = true;
+ this.lblCloseInactive.BackColor = System.Drawing.Color.Transparent;
+ this.lblCloseInactive.Cursor = System.Windows.Forms.Cursors.Hand;
+ this.lblCloseInactive.Font = new System.Drawing.Font("Segoe UI", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.lblCloseInactive.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
+ this.lblCloseInactive.Location = new System.Drawing.Point(784, 9);
+ this.lblCloseInactive.Name = "lblCloseInactive";
+ this.lblCloseInactive.Size = new System.Drawing.Size(18, 20);
+ this.lblCloseInactive.TabIndex = 1;
+ this.lblCloseInactive.Text = "X";
+ this.lblCloseInactive.MouseEnter += new System.EventHandler(this.lblCloseInactive_MouseEnter);
+ //
+ // pbLoad
+ //
+ this.pbLoad.Dock = System.Windows.Forms.DockStyle.Bottom;
+ this.pbLoad.Location = new System.Drawing.Point(0, 473);
+ this.pbLoad.Name = "pbLoad";
+ this.pbLoad.Size = new System.Drawing.Size(814, 14);
+ this.pbLoad.TabIndex = 1;
+ //
+ // KryptonSplashScreen
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(814, 487);
+ this.ControlBox = false;
+ this.Controls.Add(this.pbLoad);
+ this.Controls.Add(this.kpnlBackground);
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
+ this.Name = "KryptonSplashScreen";
+ this.ShowInTaskbar = false;
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
+ ((System.ComponentModel.ISupportInitialize)(this.kpnlBackground)).EndInit();
+ this.kpnlBackground.ResumeLayout(false);
+ this.kpnlBackground.PerformLayout();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private ComponentFactory.Krypton.Toolkit.KryptonManager kryptonManager1;
+ private ComponentFactory.Krypton.Toolkit.KryptonPanel kpnlBackground;
+ private System.Windows.Forms.Label lblCloseActive;
+ private System.Windows.Forms.Label lblMinimise;
+ private System.Windows.Forms.Label lblCloseInactive;
+ private System.Windows.Forms.ProgressBar pbLoad;
+ }
+}
\ No newline at end of file
diff --git a/Source/Krypton Toolkit Suite Extended/Extended Controls/ExtendedToolkit/UI/KryptonSplashScreen.cs b/Source/Krypton Toolkit Suite Extended/Extended Controls/ExtendedToolkit/UI/KryptonSplashScreen.cs
new file mode 100644
index 00000000..5b22c7ac
--- /dev/null
+++ b/Source/Krypton Toolkit Suite Extended/Extended Controls/ExtendedToolkit/UI/KryptonSplashScreen.cs
@@ -0,0 +1,291 @@
+using ComponentFactory.Krypton.Toolkit;
+using System.ComponentModel;
+using System.Windows.Forms;
+
+namespace ExtendedControls.ExtendedToolkit.UI
+{
+ public partial class KryptonSplashScreen : KryptonForm
+ {
+ #region Variables
+ private bool _useFadeEffects, _enableProgressBar, _enableModernProgressBar, _enableMinimiseButton, _enableCloseButton, _useDropShadow;
+
+ private string _applicationName, _companyOrAuthorName, _statusString;
+
+ private Form _nextWindow;
+
+ private KryptonForm _nextKryptonWindow;
+ #endregion
+
+ #region Properties
+
+ #region Booleans
+ ///
+ /// Gets or sets a value indicating whether [use fade effects].
+ ///
+ ///
+ /// true if [use fade effects]; otherwise, false.
+ ///
+ [DefaultValue(true)]
+ public bool UseFadeEffects
+ {
+ get
+ {
+ return _useFadeEffects;
+ }
+
+ set
+ {
+ _useFadeEffects = value;
+ }
+ }
+
+ ///
+ /// Gets or sets a value indicating whether [enable progress bar].
+ ///
+ ///
+ /// true if [enable progress bar]; otherwise, false.
+ ///
+ [DefaultValue(false)]
+ public bool EnableProgressBar
+ {
+ get
+ {
+ return _enableProgressBar;
+ }
+
+ set
+ {
+ _enableProgressBar = value;
+ }
+ }
+
+ ///
+ /// Gets or sets a value indicating whether [enable modern progress bar].
+ ///
+ ///
+ /// true if [enable modern progress bar]; otherwise, false.
+ ///
+ [DefaultValue(false)]
+ public bool EnableModernProgressBar
+ {
+ get
+ {
+ return _enableModernProgressBar;
+ }
+
+ set
+ {
+ _enableModernProgressBar = value;
+ }
+ }
+
+ ///
+ /// Gets or sets a value indicating whether [enable minimise button].
+ ///
+ ///
+ /// true if [enable minimise button]; otherwise, false.
+ ///
+ [DefaultValue(true)]
+ public bool EnableMinimiseButton
+ {
+ get
+ {
+ return _enableMinimiseButton;
+ }
+
+ set
+ {
+ _enableMinimiseButton = value;
+ }
+ }
+
+ ///
+ /// Gets or sets a value indicating whether [enable close button].
+ ///
+ ///
+ /// true if [enable close button]; otherwise, false.
+ ///
+ [DefaultValue(true)]
+ public bool EnableCloseButton
+ {
+ get
+ {
+ return _enableCloseButton;
+ }
+
+ set
+ {
+ _enableCloseButton = value;
+ }
+ }
+
+ ///
+ /// Gets or sets a value indicating whether [enable use drop shadow].
+ ///
+ ///
+ /// true if [enable use drop shadow]; otherwise, false.
+ ///
+ [DefaultValue(false)]
+ public bool EnableUseDropShadow
+ {
+ get
+ {
+ return _useDropShadow;
+ }
+
+ set
+ {
+ _useDropShadow = value;
+ }
+ }
+ #endregion
+
+ #region Strings
+ ///
+ /// Gets or sets the name of the application.
+ ///
+ ///
+ /// The name of the application.
+ ///
+ public string ApplicationName
+ {
+ get
+ {
+ return _applicationName;
+ }
+
+ set
+ {
+ _applicationName = value;
+ }
+ }
+
+ ///
+ /// Gets or sets the name of the company or author.
+ ///
+ ///
+ /// The name of the company or author.
+ ///
+ public string CompanyOrAuthorName
+ {
+ get
+ {
+ return _companyOrAuthorName;
+ }
+
+ set
+ {
+ _companyOrAuthorName = value;
+ }
+ }
+
+ ///
+ /// Gets or sets the status string.
+ ///
+ ///
+ /// The status string.
+ ///
+ public string StatusString
+ {
+ get
+ {
+ return _statusString;
+ }
+
+ set
+ {
+ _statusString = value;
+ }
+ }
+ #endregion
+
+ #region Forms
+ ///
+ /// Gets or sets the nextwindow.
+ ///
+ ///
+ /// The nextwindow.
+ ///
+ public Form Nextwindow
+ {
+ get
+ {
+ return _nextWindow;
+ }
+
+ set
+ {
+ _nextWindow = value;
+ }
+ }
+ #endregion
+
+ #region Krypton Forms
+ ///
+ /// Gets or sets the next krypton window.
+ ///
+ ///
+ /// The next krypton window.
+ ///
+ public KryptonForm NextKryptonWindow
+ {
+ get
+ {
+ return _nextKryptonWindow;
+ }
+
+ set
+ {
+ _nextKryptonWindow = value;
+ }
+ }
+ #endregion
+
+ #endregion
+
+ ///
+ /// Initialises a new instance of the class.
+ ///
+ /// if set to true [use fade effects].
+ /// if set to true [enable progress bar].
+ /// if set to true [enable modern progress bar].
+ /// if set to true [enable minimise button].
+ /// if set to true [enable close button].
+ /// if set to true [use drop shadow].
+ /// Name of the application.
+ /// Name of the company or author.
+ /// The status string.
+ /// The next window.
+ /// The next krypton window.
+ public KryptonSplashScreen(bool useFadeEffects, bool enableProgressBar, bool enableModernProgressBar, bool enableMinimiseButton, bool enableCloseButton, bool useDropShadow, string applicationName, string companyOrAuthorName, string statusString, Form nextWindow = null, KryptonForm nextKryptonWindow = null)
+ {
+ InitializeComponent();
+ }
+
+ #region Event Handlers
+ private void lblMinimise_Click(object sender, System.EventArgs e)
+ {
+ WindowState = FormWindowState.Minimized;
+ }
+
+ private void lblCloseInactive_MouseEnter(object sender, System.EventArgs e)
+ {
+ lblCloseInactive.Visible = false;
+
+ lblCloseActive.Visible = true;
+ }
+
+ private void lblCloseActive_Click(object sender, System.EventArgs e)
+ {
+ Application.Exit();
+ }
+
+ private void lblCloseActive_MouseLeave(object sender, System.EventArgs e)
+ {
+ lblCloseActive.Visible = false;
+
+ lblCloseInactive.Visible = true;
+ }
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/Source/Krypton Toolkit Suite Extended/Extended Controls/ExtendedToolkit/UI/KryptonSplashScreen.resx b/Source/Krypton Toolkit Suite Extended/Extended Controls/ExtendedToolkit/UI/KryptonSplashScreen.resx
new file mode 100644
index 00000000..d0bfb46c
--- /dev/null
+++ b/Source/Krypton Toolkit Suite Extended/Extended Controls/ExtendedToolkit/UI/KryptonSplashScreen.resx
@@ -0,0 +1,123 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ 17, 17
+
+
\ No newline at end of file
diff --git a/Source/Krypton Toolkit Suite Extended/Extended Controls/Properties/AssemblyInfo.cs b/Source/Krypton Toolkit Suite Extended/Extended Controls/Properties/AssemblyInfo.cs
index 6b879f4e..68a12396 100644
--- a/Source/Krypton Toolkit Suite Extended/Extended Controls/Properties/AssemblyInfo.cs
+++ b/Source/Krypton Toolkit Suite Extended/Extended Controls/Properties/AssemblyInfo.cs
@@ -33,7 +33,7 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("4.7.436.0")]
-[assembly: AssemblyFileVersion("4.7.436.0")]
+[assembly: AssemblyVersion("4.7.440.0")]
+[assembly: AssemblyFileVersion("4.7.440.0")]
[assembly: NeutralResourcesLanguage("en-GB")]
diff --git a/Source/Krypton Toolkit Suite Extended/Extended Controls/Properties/Resources.Designer.cs b/Source/Krypton Toolkit Suite Extended/Extended Controls/Properties/Resources.Designer.cs
index ed5d6fdf..03671374 100644
--- a/Source/Krypton Toolkit Suite Extended/Extended Controls/Properties/Resources.Designer.cs
+++ b/Source/Krypton Toolkit Suite Extended/Extended Controls/Properties/Resources.Designer.cs
@@ -220,6 +220,16 @@ internal static System.Drawing.Bitmap information {
}
}
+ ///
+ /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
+ ///
+ internal static System.Drawing.Icon progress_bar {
+ get {
+ object obj = ResourceManager.GetObject("progress_bar", resourceCulture);
+ return ((System.Drawing.Icon)(obj));
+ }
+ }
+
///
/// Looks up a localized resource of type System.Drawing.Bitmap.
///
diff --git a/Source/Krypton Toolkit Suite Extended/Extended Controls/Properties/Resources.resx b/Source/Krypton Toolkit Suite Extended/Extended Controls/Properties/Resources.resx
index 345a1255..f760e193 100644
--- a/Source/Krypton Toolkit Suite Extended/Extended Controls/Properties/Resources.resx
+++ b/Source/Krypton Toolkit Suite Extended/Extended Controls/Properties/Resources.resx
@@ -202,4 +202,7 @@
..\Resources\GridSortOrder.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+ ..\Resources\progress_bar.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
\ No newline at end of file
diff --git a/Source/Krypton Toolkit Suite Extended/Extended Controls/Resources/progress_bar.ico b/Source/Krypton Toolkit Suite Extended/Extended Controls/Resources/progress_bar.ico
new file mode 100644
index 00000000..fac5edf9
Binary files /dev/null and b/Source/Krypton Toolkit Suite Extended/Extended Controls/Resources/progress_bar.ico differ
diff --git a/Source/Krypton Toolkit Suite Extended/Global Utilities/Classes/Special Effects/FadeEffects.cs b/Source/Krypton Toolkit Suite Extended/Global Utilities/Classes/Special Effects/FadeEffects.cs
new file mode 100644
index 00000000..e0b1ee44
--- /dev/null
+++ b/Source/Krypton Toolkit Suite Extended/Global Utilities/Classes/Special Effects/FadeEffects.cs
@@ -0,0 +1,151 @@
+using ComponentFactory.Krypton.Toolkit;
+using System;
+using System.Threading;
+using System.Windows.Forms;
+
+namespace GlobalUtilities.Classes.SpecialEffects
+{
+ ///
+ /// Fades the selected or in and out.
+ ///
+ public class FadeEffects
+ {
+ #region Variables
+ private Double _fadeIn, _fadeOut;
+ #endregion
+
+ #region Properties
+ ///
+ /// Gets or sets the fade in value.
+ ///
+ ///
+ /// The fade in value.
+ ///
+ private Double FadeIn
+ {
+ get
+ {
+ return _fadeIn;
+ }
+
+ set
+ {
+ _fadeIn = value;
+ }
+ }
+
+ ///
+ /// Gets or sets the fade out value.
+ ///
+ ///
+ /// The fade out value.
+ ///
+ private Double FadeOut
+ {
+ get
+ {
+ return _fadeOut;
+ }
+
+ set
+ {
+ _fadeOut = value;
+ }
+ }
+ #endregion
+
+ #region Constructor
+ ///
+ /// Initialises a new instance of the class.
+ ///
+ public FadeEffects()
+ {
+
+ }
+ #endregion
+
+ #region Methods
+
+ #region Fade In
+ ///
+ /// Fades the form in.
+ /// Use this in your 'Form_Load' event.
+ ///
+ /// The krypton window.
+ /// The window.
+ /// The fade in sleep timer.
+ public void FadeInWindow(KryptonForm kryptonWindow, Form window = null, int fadeInSleepTimer = 50)
+ {
+ for (FadeIn = 0.0; FadeIn <= 1.1; FadeIn += 0.1)
+ {
+ if (window != null)
+ {
+ window.Opacity = FadeIn;
+
+ window.Refresh();
+ }
+ else
+ {
+ kryptonWindow.Opacity = FadeIn;
+
+ kryptonWindow.Refresh();
+ }
+
+ Thread.Sleep(fadeInSleepTimer);
+ }
+ }
+ #endregion
+
+ #region Fade Out
+ ///
+ /// Fades the out window.
+ ///
+ /// The current krypton window.
+ /// The next krypton window.
+ /// The current window.
+ /// The next window.
+ /// The fade out sleep timer.
+ public void FadeOutWindow(KryptonForm currentKryptonWindow, KryptonForm nextKryptonWindow, Form currentWindow = null, Form nextWindow = null, int fadeOutSleepTimer = 50)
+ {
+ for (FadeOut = 90; FadeOut >= 10; FadeOut += -10)
+ {
+ if (nextWindow != null)
+ {
+ nextWindow.Opacity = FadeOut / 100;
+
+ nextWindow.Refresh();
+ }
+ else
+ {
+ nextKryptonWindow.Opacity = FadeOut / 100;
+
+ nextKryptonWindow.Refresh();
+ }
+
+ Thread.Sleep(fadeOutSleepTimer);
+ }
+
+ if (nextWindow != null)
+ {
+ nextWindow.Show();
+ }
+ else
+ {
+ nextKryptonWindow.Show();
+ }
+ }
+ #endregion
+
+ #endregion
+
+ #region Deconstructor
+ ///
+ /// Finalises an instance of the class.
+ ///
+ ~FadeEffects()
+ {
+ GC.SuppressFinalize(this);
+ }
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/Source/Krypton Toolkit Suite Extended/Global Utilities/Global Utilities.csproj b/Source/Krypton Toolkit Suite Extended/Global Utilities/Global Utilities.csproj
index e35a463d..d4e5a3c3 100644
--- a/Source/Krypton Toolkit Suite Extended/Global Utilities/Global Utilities.csproj
+++ b/Source/Krypton Toolkit Suite Extended/Global Utilities/Global Utilities.csproj
@@ -73,6 +73,7 @@
+
diff --git a/Source/Krypton Toolkit Suite Extended/Global Utilities/Properties/AssemblyInfo.cs b/Source/Krypton Toolkit Suite Extended/Global Utilities/Properties/AssemblyInfo.cs
index 2bf025b2..e8ed72b0 100644
--- a/Source/Krypton Toolkit Suite Extended/Global Utilities/Properties/AssemblyInfo.cs
+++ b/Source/Krypton Toolkit Suite Extended/Global Utilities/Properties/AssemblyInfo.cs
@@ -33,7 +33,7 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("4.70.225.0")]
-[assembly: AssemblyFileVersion("4.70.225.0")]
+[assembly: AssemblyVersion("4.70.228.0")]
+[assembly: AssemblyFileVersion("4.70.228.0")]
[assembly: NeutralResourcesLanguage("en-GB")]
diff --git a/Source/Krypton Toolkit Suite Extended/Item Templates/Properties/AssemblyInfo.cs b/Source/Krypton Toolkit Suite Extended/Item Templates/Properties/AssemblyInfo.cs
index 6b2bccf6..6a0e7a10 100644
--- a/Source/Krypton Toolkit Suite Extended/Item Templates/Properties/AssemblyInfo.cs
+++ b/Source/Krypton Toolkit Suite Extended/Item Templates/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.17.0")]
-[assembly: AssemblyFileVersion("1.0.17.0")]
+[assembly: AssemblyVersion("1.0.20.0")]
+[assembly: AssemblyFileVersion("1.0.20.0")]
diff --git a/Source/Krypton Toolkit Suite Extended/Krypton Outlook Grid/Krypton Outlook Grid.csproj b/Source/Krypton Toolkit Suite Extended/Krypton Outlook Grid/Krypton Outlook Grid.csproj
index 6779ff7c..212aaf2a 100644
--- a/Source/Krypton Toolkit Suite Extended/Krypton Outlook Grid/Krypton Outlook Grid.csproj
+++ b/Source/Krypton Toolkit Suite Extended/Krypton Outlook Grid/Krypton Outlook Grid.csproj
@@ -34,11 +34,12 @@
app.manifest
-
+
False
A:\Developer DLLs\Krypton DLLs\Versions\4.7\ComponentFactory.Krypton.Design.dll
-
+
+ False
A:\Developer DLLs\Krypton DLLs\Versions\4.7\ComponentFactory.Krypton.Toolkit.dll
diff --git a/Source/Krypton Toolkit Suite Extended/Krypton Outlook Grid/Properties/AssemblyInfo.cs b/Source/Krypton Toolkit Suite Extended/Krypton Outlook Grid/Properties/AssemblyInfo.cs
index cd25de76..ac91b6ea 100644
--- a/Source/Krypton Toolkit Suite Extended/Krypton Outlook Grid/Properties/AssemblyInfo.cs
+++ b/Source/Krypton Toolkit Suite Extended/Krypton Outlook Grid/Properties/AssemblyInfo.cs
@@ -33,7 +33,7 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("4.7.417.0")]
-[assembly: AssemblyFileVersion("4.7.417.0")]
+[assembly: AssemblyVersion("4.7.420.0")]
+[assembly: AssemblyFileVersion("4.7.420.0")]
[assembly: NeutralResourcesLanguage("en-GB")]
diff --git a/Source/Krypton Toolkit Suite Extended/Krypton Wizard/Krypton Wizard.csproj b/Source/Krypton Toolkit Suite Extended/Krypton Wizard/Krypton Wizard.csproj
index da63a22c..b9b47968 100644
--- a/Source/Krypton Toolkit Suite Extended/Krypton Wizard/Krypton Wizard.csproj
+++ b/Source/Krypton Toolkit Suite Extended/Krypton Wizard/Krypton Wizard.csproj
@@ -31,23 +31,29 @@
4
-
- ..\..\Required\ComponentFactory.Krypton.Design.dll
+
+ False
+ A:\Developer DLLs\Krypton DLLs\Versions\4.7\ComponentFactory.Krypton.Design.dll
-
- ..\..\Required\ComponentFactory.Krypton.Docking.dll
+
+ False
+ A:\Developer DLLs\Krypton DLLs\Versions\4.7\ComponentFactory.Krypton.Docking.dll
-
- ..\..\Required\ComponentFactory.Krypton.Navigator.dll
+
+ False
+ A:\Developer DLLs\Krypton DLLs\Versions\4.7\ComponentFactory.Krypton.Navigator.dll
-
- ..\..\Required\ComponentFactory.Krypton.Ribbon.dll
+
+ False
+ A:\Developer DLLs\Krypton DLLs\Versions\4.7\ComponentFactory.Krypton.Ribbon.dll
-
- ..\..\Required\ComponentFactory.Krypton.Toolkit.dll
+
+ False
+ A:\Developer DLLs\Krypton DLLs\Versions\4.7\ComponentFactory.Krypton.Toolkit.dll
-
- ..\..\Required\ComponentFactory.Krypton.Workspace.dll
+
+ False
+ A:\Developer DLLs\Krypton DLLs\Versions\4.7\ComponentFactory.Krypton.Workspace.dll
diff --git a/Source/Krypton Toolkit Suite Extended/Krypton Wizard/Properties/AssemblyInfo.cs b/Source/Krypton Toolkit Suite Extended/Krypton Wizard/Properties/AssemblyInfo.cs
index a0b07a76..977c7eca 100644
--- a/Source/Krypton Toolkit Suite Extended/Krypton Wizard/Properties/AssemblyInfo.cs
+++ b/Source/Krypton Toolkit Suite Extended/Krypton Wizard/Properties/AssemblyInfo.cs
@@ -33,7 +33,7 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("4.70.518.0")]
-[assembly: AssemblyFileVersion("4.70.518.0")]
+[assembly: AssemblyVersion("4.70.522.0")]
+[assembly: AssemblyFileVersion("4.70.522.0")]
[assembly: NeutralResourcesLanguage("en-GB")]
diff --git a/Source/Krypton Toolkit Suite Extended/Playground/Form1.Designer.cs b/Source/Krypton Toolkit Suite Extended/Playground/Form1.Designer.cs
index 1b24eb48..865d3f94 100644
--- a/Source/Krypton Toolkit Suite Extended/Playground/Form1.Designer.cs
+++ b/Source/Krypton Toolkit Suite Extended/Playground/Form1.Designer.cs
@@ -28,6 +28,7 @@ protected override void Dispose(bool disposing)
///
private void InitializeComponent()
{
+ this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@@ -42,7 +43,6 @@ private void InitializeComponent()
this.printToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.printPreviewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator();
- this.tsmiUACTest = new ExtendedControls.ExtendedToolkit.ToolstripControls.ToolStripMenuItemUACSheld();
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@@ -66,15 +66,47 @@ private void InitializeComponent()
this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator();
this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.lblIsAdminMode = new System.Windows.Forms.Label();
- this.kryptonCommandLinkVersion11 = new ExtendedControls.ExtendedToolkit.Controls.KryptonCommandLinkVersion1();
- this.kryptonCommandLinkVersion21 = new ExtendedControls.ExtendedToolkit.Controls.KryptonCommandLinkVersion2();
- this.kryptonWaterMarkTextBox1 = new ExtendedControls.ExtendedToolkit.Controls.KryptonWaterMarkTextBox();
- this.kctb1 = new ExtendedControls.ExtendedToolkit.Controls.KryptonCueTextBox();
- this.kbtnUACTest = new ExtendedControls.ExtendedToolkit.Controls.KryptonUACShieldButton();
- this.kryptonMostRecentlyUsedFileMenuItem1 = new ExtendedControls.ExtendedToolkit.ToolstripControls.KryptonMostRecentlyUsedFileMenuItem();
this.rtbTextPad = new System.Windows.Forms.RichTextBox();
this.lblVersion = new System.Windows.Forms.Label();
+ this.kuacsbElevate = new ExtendedControls.ExtendedToolkit.Controls.KryptonUACShieldButton();
+ this.kryptonManager1 = new ComponentFactory.Krypton.Toolkit.KryptonManager(this.components);
+ this.menuStrip2 = new System.Windows.Forms.MenuStrip();
+ this.fileToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
+ this.newToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
+ this.openToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
+ this.toolStripSeparator6 = new System.Windows.Forms.ToolStripSeparator();
+ this.saveToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
+ this.saveAsToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
+ this.toolStripSeparator7 = new System.Windows.Forms.ToolStripSeparator();
+ this.printToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
+ this.printPreviewToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
+ this.toolStripSeparator8 = new System.Windows.Forms.ToolStripSeparator();
+ this.exitToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
+ this.editToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
+ this.undoToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
+ this.redoToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
+ this.toolStripSeparator9 = new System.Windows.Forms.ToolStripSeparator();
+ this.cutToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
+ this.copyToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
+ this.pasteToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
+ this.toolStripSeparator10 = new System.Windows.Forms.ToolStripSeparator();
+ this.selectAllToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
+ this.toolsToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
+ this.customizeToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
+ this.optionsToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
+ this.helpToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
+ this.contentsToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
+ this.indexToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
+ this.searchToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
+ this.toolStripSeparator11 = new System.Windows.Forms.ToolStripSeparator();
+ this.aboutToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
+ this.checkForUpdatesToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
+ this.testsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.advancedToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.basicToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.recentDocumentsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip1.SuspendLayout();
+ this.menuStrip2.SuspendLayout();
this.SuspendLayout();
//
// menuStrip1
@@ -105,7 +137,6 @@ private void InitializeComponent()
this.printToolStripMenuItem,
this.printPreviewToolStripMenuItem,
this.toolStripMenuItem1,
- this.tsmiUACTest,
this.toolStripSeparator2,
this.exitToolStripMenuItem});
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
@@ -185,13 +216,6 @@ private void InitializeComponent()
this.toolStripMenuItem1.Name = "toolStripMenuItem1";
this.toolStripMenuItem1.Size = new System.Drawing.Size(140, 6);
//
- // tsmiUACTest
- //
- this.tsmiUACTest.Image = ((System.Drawing.Image)(resources.GetObject("tsmiUACTest.Image")));
- this.tsmiUACTest.Name = "tsmiUACTest";
- this.tsmiUACTest.Size = new System.Drawing.Size(143, 22);
- this.tsmiUACTest.Text = "Click Me";
- //
// toolStripSeparator2
//
this.toolStripSeparator2.Name = "toolStripSeparator2";
@@ -308,42 +332,41 @@ private void InitializeComponent()
// contentsToolStripMenuItem
//
this.contentsToolStripMenuItem.Name = "contentsToolStripMenuItem";
- this.contentsToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
+ this.contentsToolStripMenuItem.Size = new System.Drawing.Size(171, 22);
this.contentsToolStripMenuItem.Text = "&Contents";
//
// indexToolStripMenuItem
//
this.indexToolStripMenuItem.Name = "indexToolStripMenuItem";
- this.indexToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
+ this.indexToolStripMenuItem.Size = new System.Drawing.Size(171, 22);
this.indexToolStripMenuItem.Text = "&Index";
//
// searchToolStripMenuItem
//
this.searchToolStripMenuItem.Name = "searchToolStripMenuItem";
- this.searchToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
+ this.searchToolStripMenuItem.Size = new System.Drawing.Size(171, 22);
this.searchToolStripMenuItem.Text = "&Search";
//
// toolStripMenuItem3
//
this.toolStripMenuItem3.Name = "toolStripMenuItem3";
- this.toolStripMenuItem3.Size = new System.Drawing.Size(177, 6);
+ this.toolStripMenuItem3.Size = new System.Drawing.Size(168, 6);
//
// checkForUpdatesToolStripMenuItem
//
this.checkForUpdatesToolStripMenuItem.Name = "checkForUpdatesToolStripMenuItem";
- this.checkForUpdatesToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
+ this.checkForUpdatesToolStripMenuItem.Size = new System.Drawing.Size(171, 22);
this.checkForUpdatesToolStripMenuItem.Text = "&Check for Updates";
- this.checkForUpdatesToolStripMenuItem.Click += new System.EventHandler(this.checkForUpdatesToolStripMenuItem_Click);
//
// toolStripSeparator5
//
this.toolStripSeparator5.Name = "toolStripSeparator5";
- this.toolStripSeparator5.Size = new System.Drawing.Size(177, 6);
+ this.toolStripSeparator5.Size = new System.Drawing.Size(168, 6);
//
// aboutToolStripMenuItem
//
this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem";
- this.aboutToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
+ this.aboutToolStripMenuItem.Size = new System.Drawing.Size(171, 22);
this.aboutToolStripMenuItem.Text = "&About...";
//
// lblIsAdminMode
@@ -356,59 +379,6 @@ private void InitializeComponent()
this.lblIsAdminMode.TabIndex = 6;
this.lblIsAdminMode.Text = "Is running in Administrator mode: {0}";
//
- // kryptonCommandLinkVersion11
- //
- this.kryptonCommandLinkVersion11.Location = new System.Drawing.Point(851, 470);
- this.kryptonCommandLinkVersion11.Name = "kryptonCommandLinkVersion11";
- this.kryptonCommandLinkVersion11.Note = "";
- this.kryptonCommandLinkVersion11.Size = new System.Drawing.Size(303, 45);
- this.kryptonCommandLinkVersion11.TabIndex = 5;
- this.kryptonCommandLinkVersion11.Values.Text = "kryptonCommandLinkVersion11";
- //
- // kryptonCommandLinkVersion21
- //
- this.kryptonCommandLinkVersion21.Location = new System.Drawing.Point(851, 418);
- this.kryptonCommandLinkVersion21.Name = "kryptonCommandLinkVersion21";
- this.kryptonCommandLinkVersion21.Size = new System.Drawing.Size(303, 46);
- this.kryptonCommandLinkVersion21.TabIndex = 4;
- this.kryptonCommandLinkVersion21.Values.Text = "kryptonCommandLinkVersion21";
- //
- // kryptonWaterMarkTextBox1
- //
- this.kryptonWaterMarkTextBox1.Location = new System.Drawing.Point(872, 276);
- this.kryptonWaterMarkTextBox1.Name = "kryptonWaterMarkTextBox1";
- this.kryptonWaterMarkTextBox1.Size = new System.Drawing.Size(282, 23);
- this.kryptonWaterMarkTextBox1.TabIndex = 3;
- this.kryptonWaterMarkTextBox1.ToLower = false;
- this.kryptonWaterMarkTextBox1.ToUpper = false;
- this.kryptonWaterMarkTextBox1.WaterMarkColour = System.Drawing.Color.Gray;
- this.kryptonWaterMarkTextBox1.WaterMarkText = "Hi";
- this.kryptonWaterMarkTextBox1.WaterMarkTextEnabled = true;
- this.kryptonWaterMarkTextBox1.WaterMarkTypeface = null;
- //
- // kctb1
- //
- this.kctb1.CueText = "Hello world!";
- this.kctb1.Location = new System.Drawing.Point(872, 238);
- this.kctb1.Name = "kctb1";
- this.kctb1.Size = new System.Drawing.Size(282, 23);
- this.kctb1.TabIndex = 2;
- //
- // kbtnUACTest
- //
- this.kbtnUACTest.Location = new System.Drawing.Point(1019, 541);
- this.kbtnUACTest.Name = "kbtnUACTest";
- this.kbtnUACTest.Size = new System.Drawing.Size(135, 26);
- this.kbtnUACTest.TabIndex = 0;
- this.kbtnUACTest.Values.Image = ((System.Drawing.Image)(resources.GetObject("kbtnUACTest.Values.Image")));
- this.kbtnUACTest.Values.Text = "&Click Me";
- //
- // kryptonMostRecentlyUsedFileMenuItem1
- //
- this.kryptonMostRecentlyUsedFileMenuItem1.FileExtensions = "";
- this.kryptonMostRecentlyUsedFileMenuItem1.Index = -1;
- this.kryptonMostRecentlyUsedFileMenuItem1.Text = "";
- //
// rtbTextPad
//
this.rtbTextPad.Location = new System.Drawing.Point(16, 45);
@@ -427,26 +397,303 @@ private void InitializeComponent()
this.lblVersion.TabIndex = 8;
this.lblVersion.Text = "Version: {0}";
//
+ // kuacsbElevate
+ //
+ this.kuacsbElevate.Location = new System.Drawing.Point(633, 296);
+ this.kuacsbElevate.Name = "kuacsbElevate";
+ this.kuacsbElevate.Size = new System.Drawing.Size(135, 26);
+ this.kuacsbElevate.TabIndex = 0;
+ this.kuacsbElevate.Values.Image = ((System.Drawing.Image)(resources.GetObject("kuacsbElevate.Values.Image")));
+ this.kuacsbElevate.Values.Text = "Elevate";
+ //
+ // menuStrip2
+ //
+ this.menuStrip2.Font = new System.Drawing.Font("Segoe UI", 9F);
+ this.menuStrip2.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.fileToolStripMenuItem1,
+ this.editToolStripMenuItem1,
+ this.toolsToolStripMenuItem1,
+ this.helpToolStripMenuItem1});
+ this.menuStrip2.Location = new System.Drawing.Point(0, 0);
+ this.menuStrip2.Name = "menuStrip2";
+ this.menuStrip2.Size = new System.Drawing.Size(1166, 24);
+ this.menuStrip2.TabIndex = 1;
+ this.menuStrip2.Text = "menuStrip2";
+ //
+ // fileToolStripMenuItem1
+ //
+ this.fileToolStripMenuItem1.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.newToolStripMenuItem1,
+ this.openToolStripMenuItem1,
+ this.toolStripSeparator6,
+ this.saveToolStripMenuItem1,
+ this.saveAsToolStripMenuItem1,
+ this.recentDocumentsToolStripMenuItem,
+ this.toolStripSeparator7,
+ this.printToolStripMenuItem1,
+ this.printPreviewToolStripMenuItem1,
+ this.toolStripSeparator8,
+ this.exitToolStripMenuItem1});
+ this.fileToolStripMenuItem1.Name = "fileToolStripMenuItem1";
+ this.fileToolStripMenuItem1.Size = new System.Drawing.Size(37, 20);
+ this.fileToolStripMenuItem1.Text = "&File";
+ //
+ // newToolStripMenuItem1
+ //
+ this.newToolStripMenuItem1.Image = ((System.Drawing.Image)(resources.GetObject("newToolStripMenuItem1.Image")));
+ this.newToolStripMenuItem1.ImageTransparentColor = System.Drawing.Color.Magenta;
+ this.newToolStripMenuItem1.Name = "newToolStripMenuItem1";
+ this.newToolStripMenuItem1.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.N)));
+ this.newToolStripMenuItem1.Size = new System.Drawing.Size(146, 22);
+ this.newToolStripMenuItem1.Text = "&New";
+ //
+ // openToolStripMenuItem1
+ //
+ this.openToolStripMenuItem1.Image = ((System.Drawing.Image)(resources.GetObject("openToolStripMenuItem1.Image")));
+ this.openToolStripMenuItem1.ImageTransparentColor = System.Drawing.Color.Magenta;
+ this.openToolStripMenuItem1.Name = "openToolStripMenuItem1";
+ this.openToolStripMenuItem1.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O)));
+ this.openToolStripMenuItem1.Size = new System.Drawing.Size(146, 22);
+ this.openToolStripMenuItem1.Text = "&Open";
+ //
+ // toolStripSeparator6
+ //
+ this.toolStripSeparator6.Name = "toolStripSeparator6";
+ this.toolStripSeparator6.Size = new System.Drawing.Size(143, 6);
+ //
+ // saveToolStripMenuItem1
+ //
+ this.saveToolStripMenuItem1.Image = ((System.Drawing.Image)(resources.GetObject("saveToolStripMenuItem1.Image")));
+ this.saveToolStripMenuItem1.ImageTransparentColor = System.Drawing.Color.Magenta;
+ this.saveToolStripMenuItem1.Name = "saveToolStripMenuItem1";
+ this.saveToolStripMenuItem1.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S)));
+ this.saveToolStripMenuItem1.Size = new System.Drawing.Size(146, 22);
+ this.saveToolStripMenuItem1.Text = "&Save";
+ //
+ // saveAsToolStripMenuItem1
+ //
+ this.saveAsToolStripMenuItem1.Name = "saveAsToolStripMenuItem1";
+ this.saveAsToolStripMenuItem1.Size = new System.Drawing.Size(146, 22);
+ this.saveAsToolStripMenuItem1.Text = "Save &As";
+ //
+ // toolStripSeparator7
+ //
+ this.toolStripSeparator7.Name = "toolStripSeparator7";
+ this.toolStripSeparator7.Size = new System.Drawing.Size(143, 6);
+ //
+ // printToolStripMenuItem1
+ //
+ this.printToolStripMenuItem1.Image = ((System.Drawing.Image)(resources.GetObject("printToolStripMenuItem1.Image")));
+ this.printToolStripMenuItem1.ImageTransparentColor = System.Drawing.Color.Magenta;
+ this.printToolStripMenuItem1.Name = "printToolStripMenuItem1";
+ this.printToolStripMenuItem1.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.P)));
+ this.printToolStripMenuItem1.Size = new System.Drawing.Size(146, 22);
+ this.printToolStripMenuItem1.Text = "&Print";
+ //
+ // printPreviewToolStripMenuItem1
+ //
+ this.printPreviewToolStripMenuItem1.Image = ((System.Drawing.Image)(resources.GetObject("printPreviewToolStripMenuItem1.Image")));
+ this.printPreviewToolStripMenuItem1.ImageTransparentColor = System.Drawing.Color.Magenta;
+ this.printPreviewToolStripMenuItem1.Name = "printPreviewToolStripMenuItem1";
+ this.printPreviewToolStripMenuItem1.Size = new System.Drawing.Size(146, 22);
+ this.printPreviewToolStripMenuItem1.Text = "Print Pre&view";
+ //
+ // toolStripSeparator8
+ //
+ this.toolStripSeparator8.Name = "toolStripSeparator8";
+ this.toolStripSeparator8.Size = new System.Drawing.Size(143, 6);
+ //
+ // exitToolStripMenuItem1
+ //
+ this.exitToolStripMenuItem1.Name = "exitToolStripMenuItem1";
+ this.exitToolStripMenuItem1.Size = new System.Drawing.Size(146, 22);
+ this.exitToolStripMenuItem1.Text = "E&xit";
+ //
+ // editToolStripMenuItem1
+ //
+ this.editToolStripMenuItem1.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.undoToolStripMenuItem1,
+ this.redoToolStripMenuItem1,
+ this.toolStripSeparator9,
+ this.cutToolStripMenuItem1,
+ this.copyToolStripMenuItem1,
+ this.pasteToolStripMenuItem1,
+ this.toolStripSeparator10,
+ this.selectAllToolStripMenuItem1});
+ this.editToolStripMenuItem1.Name = "editToolStripMenuItem1";
+ this.editToolStripMenuItem1.Size = new System.Drawing.Size(39, 20);
+ this.editToolStripMenuItem1.Text = "&Edit";
+ //
+ // undoToolStripMenuItem1
+ //
+ this.undoToolStripMenuItem1.Name = "undoToolStripMenuItem1";
+ this.undoToolStripMenuItem1.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Z)));
+ this.undoToolStripMenuItem1.Size = new System.Drawing.Size(144, 22);
+ this.undoToolStripMenuItem1.Text = "&Undo";
+ //
+ // redoToolStripMenuItem1
+ //
+ this.redoToolStripMenuItem1.Name = "redoToolStripMenuItem1";
+ this.redoToolStripMenuItem1.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Y)));
+ this.redoToolStripMenuItem1.Size = new System.Drawing.Size(144, 22);
+ this.redoToolStripMenuItem1.Text = "&Redo";
+ //
+ // toolStripSeparator9
+ //
+ this.toolStripSeparator9.Name = "toolStripSeparator9";
+ this.toolStripSeparator9.Size = new System.Drawing.Size(141, 6);
+ //
+ // cutToolStripMenuItem1
+ //
+ this.cutToolStripMenuItem1.Image = ((System.Drawing.Image)(resources.GetObject("cutToolStripMenuItem1.Image")));
+ this.cutToolStripMenuItem1.ImageTransparentColor = System.Drawing.Color.Magenta;
+ this.cutToolStripMenuItem1.Name = "cutToolStripMenuItem1";
+ this.cutToolStripMenuItem1.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.X)));
+ this.cutToolStripMenuItem1.Size = new System.Drawing.Size(144, 22);
+ this.cutToolStripMenuItem1.Text = "Cu&t";
+ //
+ // copyToolStripMenuItem1
+ //
+ this.copyToolStripMenuItem1.Image = ((System.Drawing.Image)(resources.GetObject("copyToolStripMenuItem1.Image")));
+ this.copyToolStripMenuItem1.ImageTransparentColor = System.Drawing.Color.Magenta;
+ this.copyToolStripMenuItem1.Name = "copyToolStripMenuItem1";
+ this.copyToolStripMenuItem1.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.C)));
+ this.copyToolStripMenuItem1.Size = new System.Drawing.Size(144, 22);
+ this.copyToolStripMenuItem1.Text = "&Copy";
+ //
+ // pasteToolStripMenuItem1
+ //
+ this.pasteToolStripMenuItem1.Image = ((System.Drawing.Image)(resources.GetObject("pasteToolStripMenuItem1.Image")));
+ this.pasteToolStripMenuItem1.ImageTransparentColor = System.Drawing.Color.Magenta;
+ this.pasteToolStripMenuItem1.Name = "pasteToolStripMenuItem1";
+ this.pasteToolStripMenuItem1.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.V)));
+ this.pasteToolStripMenuItem1.Size = new System.Drawing.Size(144, 22);
+ this.pasteToolStripMenuItem1.Text = "&Paste";
+ //
+ // toolStripSeparator10
+ //
+ this.toolStripSeparator10.Name = "toolStripSeparator10";
+ this.toolStripSeparator10.Size = new System.Drawing.Size(141, 6);
+ //
+ // selectAllToolStripMenuItem1
+ //
+ this.selectAllToolStripMenuItem1.Name = "selectAllToolStripMenuItem1";
+ this.selectAllToolStripMenuItem1.Size = new System.Drawing.Size(144, 22);
+ this.selectAllToolStripMenuItem1.Text = "Select &All";
+ //
+ // toolsToolStripMenuItem1
+ //
+ this.toolsToolStripMenuItem1.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.customizeToolStripMenuItem1,
+ this.optionsToolStripMenuItem1});
+ this.toolsToolStripMenuItem1.Name = "toolsToolStripMenuItem1";
+ this.toolsToolStripMenuItem1.Size = new System.Drawing.Size(47, 20);
+ this.toolsToolStripMenuItem1.Text = "&Tools";
+ //
+ // customizeToolStripMenuItem1
+ //
+ this.customizeToolStripMenuItem1.Name = "customizeToolStripMenuItem1";
+ this.customizeToolStripMenuItem1.Size = new System.Drawing.Size(130, 22);
+ this.customizeToolStripMenuItem1.Text = "&Customize";
+ //
+ // optionsToolStripMenuItem1
+ //
+ this.optionsToolStripMenuItem1.Name = "optionsToolStripMenuItem1";
+ this.optionsToolStripMenuItem1.Size = new System.Drawing.Size(130, 22);
+ this.optionsToolStripMenuItem1.Text = "&Options";
+ //
+ // helpToolStripMenuItem1
+ //
+ this.helpToolStripMenuItem1.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.contentsToolStripMenuItem1,
+ this.indexToolStripMenuItem1,
+ this.searchToolStripMenuItem1,
+ this.toolStripSeparator11,
+ this.aboutToolStripMenuItem1,
+ this.checkForUpdatesToolStripMenuItem1});
+ this.helpToolStripMenuItem1.Name = "helpToolStripMenuItem1";
+ this.helpToolStripMenuItem1.Size = new System.Drawing.Size(44, 20);
+ this.helpToolStripMenuItem1.Text = "&Help";
+ //
+ // contentsToolStripMenuItem1
+ //
+ this.contentsToolStripMenuItem1.Name = "contentsToolStripMenuItem1";
+ this.contentsToolStripMenuItem1.Size = new System.Drawing.Size(180, 22);
+ this.contentsToolStripMenuItem1.Text = "&Contents";
+ //
+ // indexToolStripMenuItem1
+ //
+ this.indexToolStripMenuItem1.Name = "indexToolStripMenuItem1";
+ this.indexToolStripMenuItem1.Size = new System.Drawing.Size(180, 22);
+ this.indexToolStripMenuItem1.Text = "&Index";
+ //
+ // searchToolStripMenuItem1
+ //
+ this.searchToolStripMenuItem1.Name = "searchToolStripMenuItem1";
+ this.searchToolStripMenuItem1.Size = new System.Drawing.Size(180, 22);
+ this.searchToolStripMenuItem1.Text = "&Search";
+ //
+ // toolStripSeparator11
+ //
+ this.toolStripSeparator11.Name = "toolStripSeparator11";
+ this.toolStripSeparator11.Size = new System.Drawing.Size(177, 6);
+ //
+ // aboutToolStripMenuItem1
+ //
+ this.aboutToolStripMenuItem1.Name = "aboutToolStripMenuItem1";
+ this.aboutToolStripMenuItem1.Size = new System.Drawing.Size(180, 22);
+ this.aboutToolStripMenuItem1.Text = "&About...";
+ //
+ // checkForUpdatesToolStripMenuItem1
+ //
+ this.checkForUpdatesToolStripMenuItem1.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.testsToolStripMenuItem});
+ this.checkForUpdatesToolStripMenuItem1.Name = "checkForUpdatesToolStripMenuItem1";
+ this.checkForUpdatesToolStripMenuItem1.Size = new System.Drawing.Size(180, 22);
+ this.checkForUpdatesToolStripMenuItem1.Text = "&Check for Updates";
+ //
+ // testsToolStripMenuItem
+ //
+ this.testsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.advancedToolStripMenuItem,
+ this.basicToolStripMenuItem});
+ this.testsToolStripMenuItem.Name = "testsToolStripMenuItem";
+ this.testsToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
+ this.testsToolStripMenuItem.Text = "Tes&ts";
+ //
+ // advancedToolStripMenuItem
+ //
+ this.advancedToolStripMenuItem.Name = "advancedToolStripMenuItem";
+ this.advancedToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
+ this.advancedToolStripMenuItem.Text = "Ad&vanced";
+ //
+ // basicToolStripMenuItem
+ //
+ this.basicToolStripMenuItem.Name = "basicToolStripMenuItem";
+ this.basicToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
+ this.basicToolStripMenuItem.Text = "&Basic";
+ //
+ // recentDocumentsToolStripMenuItem
+ //
+ this.recentDocumentsToolStripMenuItem.Name = "recentDocumentsToolStripMenuItem";
+ this.recentDocumentsToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
+ this.recentDocumentsToolStripMenuItem.Text = "Re¢ Documents";
+ //
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1166, 579);
- this.Controls.Add(this.lblVersion);
- this.Controls.Add(this.rtbTextPad);
- this.Controls.Add(this.lblIsAdminMode);
- this.Controls.Add(this.kryptonCommandLinkVersion11);
- this.Controls.Add(this.kryptonCommandLinkVersion21);
- this.Controls.Add(this.kryptonWaterMarkTextBox1);
- this.Controls.Add(this.kctb1);
- this.Controls.Add(this.kbtnUACTest);
- this.Controls.Add(this.menuStrip1);
+ this.Controls.Add(this.kuacsbElevate);
+ this.Controls.Add(this.menuStrip2);
this.MainMenuStrip = this.menuStrip1;
this.Name = "Form1";
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
+ this.menuStrip2.ResumeLayout(false);
+ this.menuStrip2.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
@@ -485,20 +732,51 @@ private void InitializeComponent()
private System.Windows.Forms.ToolStripMenuItem searchToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator5;
private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem;
- private ExtendedControls.ExtendedToolkit.Controls.KryptonCueTextBox kctb1;
- private ExtendedControls.ExtendedToolkit.Controls.KryptonWaterMarkTextBox kryptonWaterMarkTextBox1;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem1;
- private ExtendedControls.ExtendedToolkit.ToolstripControls.ToolStripMenuItemUACSheld tsmiUACTest;
- private ExtendedControls.ExtendedToolkit.Controls.KryptonCommandLinkVersion2 kryptonCommandLinkVersion21;
- private ExtendedControls.ExtendedToolkit.Controls.KryptonCommandLinkVersion1 kryptonCommandLinkVersion11;
private System.Windows.Forms.Label lblIsAdminMode;
- private ExtendedControls.ExtendedToolkit.ToolstripControls.KryptonMostRecentlyUsedFileMenuItem kryptonMostRecentlyUsedFileMenuItem1;
private System.Windows.Forms.RichTextBox rtbTextPad;
private System.Windows.Forms.ToolStripMenuItem recentFilesToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem2;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem3;
private System.Windows.Forms.ToolStripMenuItem checkForUpdatesToolStripMenuItem;
private System.Windows.Forms.Label lblVersion;
+ private ExtendedControls.ExtendedToolkit.Controls.KryptonUACShieldButton kuacsbElevate;
+ private ComponentFactory.Krypton.Toolkit.KryptonManager kryptonManager1;
+ private System.Windows.Forms.MenuStrip menuStrip2;
+ private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem1;
+ private System.Windows.Forms.ToolStripMenuItem newToolStripMenuItem1;
+ private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem1;
+ private System.Windows.Forms.ToolStripSeparator toolStripSeparator6;
+ private System.Windows.Forms.ToolStripMenuItem saveToolStripMenuItem1;
+ private System.Windows.Forms.ToolStripMenuItem saveAsToolStripMenuItem1;
+ private System.Windows.Forms.ToolStripSeparator toolStripSeparator7;
+ private System.Windows.Forms.ToolStripMenuItem printToolStripMenuItem1;
+ private System.Windows.Forms.ToolStripMenuItem printPreviewToolStripMenuItem1;
+ private System.Windows.Forms.ToolStripSeparator toolStripSeparator8;
+ private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem1;
+ private System.Windows.Forms.ToolStripMenuItem editToolStripMenuItem1;
+ private System.Windows.Forms.ToolStripMenuItem undoToolStripMenuItem1;
+ private System.Windows.Forms.ToolStripMenuItem redoToolStripMenuItem1;
+ private System.Windows.Forms.ToolStripSeparator toolStripSeparator9;
+ private System.Windows.Forms.ToolStripMenuItem cutToolStripMenuItem1;
+ private System.Windows.Forms.ToolStripMenuItem copyToolStripMenuItem1;
+ private System.Windows.Forms.ToolStripMenuItem pasteToolStripMenuItem1;
+ private System.Windows.Forms.ToolStripSeparator toolStripSeparator10;
+ private System.Windows.Forms.ToolStripMenuItem selectAllToolStripMenuItem1;
+ private System.Windows.Forms.ToolStripMenuItem toolsToolStripMenuItem1;
+ private System.Windows.Forms.ToolStripMenuItem customizeToolStripMenuItem1;
+ private System.Windows.Forms.ToolStripMenuItem optionsToolStripMenuItem1;
+ private System.Windows.Forms.ToolStripMenuItem helpToolStripMenuItem1;
+ private System.Windows.Forms.ToolStripMenuItem contentsToolStripMenuItem1;
+ private System.Windows.Forms.ToolStripMenuItem indexToolStripMenuItem1;
+ private System.Windows.Forms.ToolStripMenuItem searchToolStripMenuItem1;
+ private System.Windows.Forms.ToolStripSeparator toolStripSeparator11;
+ private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem1;
+ private System.Windows.Forms.ToolStripMenuItem checkForUpdatesToolStripMenuItem1;
+ private System.Windows.Forms.ToolStripMenuItem testsToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem advancedToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem basicToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem recentDocumentsToolStripMenuItem;
}
}
diff --git a/Source/Krypton Toolkit Suite Extended/Playground/Form1.cs b/Source/Krypton Toolkit Suite Extended/Playground/Form1.cs
index d3df6159..958c364a 100644
--- a/Source/Krypton Toolkit Suite Extended/Playground/Form1.cs
+++ b/Source/Krypton Toolkit Suite Extended/Playground/Form1.cs
@@ -12,7 +12,7 @@
namespace Playground
{
- public partial class Form1 : Form, IUpdatable
+ public partial class Form1 : KryptonForm, IUpdatable
{
UtilityMethods utilityMethods = new UtilityMethods();
@@ -38,11 +38,11 @@ public Form1()
private void Form1_Load(object sender, EventArgs e)
{
- mostRecentlyUsedFileManager = new MostRecentlyUsedFileManager(recentFilesToolStripMenuItem, "Playground", MyOwnRecentFileGotClicked_Handler, MyOwnRecentFilesGotCleared_Handler);
+ mostRecentlyUsedFileManager = new MostRecentlyUsedFileManager(recentDocumentsToolStripMenuItem, "Playground", MyOwnRecentFileGotClicked_Handler, MyOwnRecentFilesGotCleared_Handler);
- kbtnUACTest.ProcessName = Process.GetCurrentProcess().ProcessName;
+ //kbtnUACTest.ProcessName = Process.GetCurrentProcess().ProcessName;
- tsmiUACTest.ProcessName = Process.GetCurrentProcess().ProcessName;
+ //tsmiUACTest.ProcessName = Process.GetCurrentProcess().ProcessName;
if (ServerXMLFileURL != null)
{
@@ -56,9 +56,9 @@ private void Form1_Load(object sender, EventArgs e)
lblIsAdminMode.Text = $"Is running in Administrator mode: { utilityMethods.GetHasElevateProcessWithAdministrativeRights().ToString() }";
- kctb1.CueText = "Hello";
+ //kctb1.CueText = "Hello";
- kryptonCommandLinkVersion11.Note = "Hello";
+ //kryptonCommandLinkVersion11.Note = "Hello";
lblVersion.Text = $"Version: { currentVersion.ToString() }";
}
@@ -121,12 +121,5 @@ private void openToolStripMenuItem_Click(object sender, EventArgs e)
OpenFile(openedFile);
}
-
- private void checkForUpdatesToolStripMenuItem_Click(object sender, EventArgs e)
- {
- StartupForm startupForm = new StartupForm("https://www.dropbox.com/s/mwyexz1baqt0y4b/Update.xml?dl=0", currentVersion, false);
-
- startupForm.Show();
- }
}
}
diff --git a/Source/Krypton Toolkit Suite Extended/Playground/Form1.resx b/Source/Krypton Toolkit Suite Extended/Playground/Form1.resx
index f5d28982..eff3a759 100644
--- a/Source/Krypton Toolkit Suite Extended/Playground/Form1.resx
+++ b/Source/Krypton Toolkit Suite Extended/Playground/Form1.resx
@@ -190,19 +190,6 @@
xdaCarWKj0KRXmE2+UklJEJZZ/RCPTPdWvBdLOP1rYD41QNcgRiVkKJQ1mjGsa2VNxeQb2OWDC7sh47p
ddQLeoyOTSFiVAAFvVhChsmv2k6Uvd3Icx1UolMNiDdpl4nhLiohW/xb0tMph2JwCJxjAz9A30JI8zYA
tAAAAABJRU5ErkJggg==
-
-
-
-
- iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
- wwAADsMBx2+oZAAAAYRJREFUOE+NkztPwlAUx8/gakIYWFwYHB1w8FUQCEpI1KiTYpSHQVQisviYjZsJ
- k4OJMT6ILhgTFheDiongc4AP4HdgcO/xnPZWaG81/JN/Qu49v1972wJ2iUQiQWqFiqL82yO2/w4Nuann
- DA3MrqMrWcDaSRB30uOGiPfcYrwVWuQr1HnIPxXFnsQxQvYDYeMd1Scf1Yt3hwGMz4UNEc9WBK4JsHfx
- AJ0r1wibBAoYMizwolpR9D6OYOPCh5f7AU0kcF0AuU8JhsybCVYfhvXeD9kIbGBYEwILrJYHZYEzVZRg
- WH21hRtniixwJQoSDGkSWGBu7cgrCUr57THpgTEIqReE5RpCkpqoIsSr2Dezy4KSwDVBko1fxVHpzFa4
- e+FGuzozAtdDC/VMLCyduR2G2DMqk3GG6wJrhRY91GZ+K/QL83nbYXHrTZ4VmDmGZC8bwu9bISC4a6mM
- /dO5/2EjhoQ/28apgs7oFfon5juDjdCgg2r9NzrEduchiN+O+WmbAvADQWOC4qBCLEQAAAAASUVORK5C
- YII=
@@ -248,7 +235,7 @@
PdXm80/AfDokTVu+8DfPXv9XCcIPTvjvLQ8YoakAAAAASUVORK5CYII=
-
+
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
wwAADsMBx2+oZAAAAYRJREFUOE+NkztPwlAUx8/gakIYWFwYHB1w8FUQCEpI1KiTYpSHQVQisviYjZsJ
@@ -259,6 +246,126 @@
e+FGuzozAtdDC/VMLCyduR2G2DMqk3GG6wJrhRY91GZ+K/QL83nbYXHrTZ4VmDmGZC8bwu9bISC4a6mM
/dO5/2EjhoQ/28apgs7oFfon5juDjdCgg2r9NzrEduchiN+O+WmbAvADQWOC4qBCLEQAAAAASUVORK5C
YII=
+
+
+
+ 132, 17
+
+
+ 281, 17
+
+
+
+ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAERSURBVDhPrZDbSgJRGIXnpewd6jXsjSQvIrwoI0RQMChU
+ 0iiDPCGiE3ZCRkvR8VzTeBhnyR5/ccaZNnPhB4t9sdf6Ln5hb8QeathNJFVFKF5C8DqL4ksDVHWGDf7j
+ LHyPg6NjviSaFqlu5yQYR+KpupaIkrMknCxT3Y7v/NYYb0ITK1c3BarbWWhLQ7IR0cTKReyZ6lZ0XYei
+ ztHpK4bAc+h1FgQijzSxMptrGIxVSO0xX3AaStFki7bUMVFmaMm/eJMGfIH/MkGzLep0AXn4h/r3CJV3
+ mS9gn2bY4UY/UzQ7E9TqfeTFtnuB+XAfzSHKr11kSl/uBebDiZ89ZCst3OUkdwL28sIVsE83ock+EIQV
+ 2Mz2wxeg6/UAAAAASUVORK5CYII=
+
+
+
+
+ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAJHSURBVDhPxZBdSNNhFMb/F110ZZEVhVBgeeHNICiiuggp
+ olAUyyxI0oSaH1QYC3N+tKnp5ubm1JUua5uuqdNKMwr7kApFItTUkWZqVhSVYmao5Nevvy7UoYR3HXh4
+ 4XCe33nOKyy3lAY7l9RWMo0O/raWXxEyo5spVYTNvOGyfIRPfW+ptOkXqaPl6T83hcRmExSdgzAz3NVm
+ YWyoYla/B+1M9JtxWLPpaH22JORIjI6gKAMB0jyEimIdo4OlbuaprwVMOOMovammpDADc34qppwUrmnl
+ 5Kni3aFlFg2j3y1z5mnRTJccnNIltQhwq0jFry+mOXNtpWZWDx1Z1NhV3C3JwGFOw25SYjVe5oYhiUKd
+ HKMmwQUrMWUw/CF3NnZvvYKqUh1TvUroS3fXe7HXkwidMngTS2t5KLbregSzMY2f3Wr4qKW6LJvGR1rX
+ 0MLor8OhKYTJBn/GHvvxrliCTBrsOqXIoOBHh5K+hmSq7FqmexTQHuUytkaKxuNMNgYyVneA4Qd7GKjc
+ hjLaRzxH7gIU6JIZaEvgtk1D8wsxSWecCDgNzWFMvwxm/PkhRmr3Mli1nW9lvjRdWc0Jf+/5jzRmyWmv
+ S+GOLQu6U6BFjPvqKOP1AYw88WOoZif9DgmfLVtxaj1RSLdwNvrkPCA3M54KqxrnvRia9MKcGrUrqFOt
+ 5H7qKsqT1mGO9+Lqhc2ELdw+U/r0i+gVZ8hMiCDx3DHORwZyKnQ/hw/uYt9uCTskPvh6e7Fp41rWr/Fg
+ g6eHO+A/lyD8ARfG3mk9fv1YAAAAAElFTkSuQmCC
+
+
+
+
+ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIySURBVDhPrZLfS5NRGMfff6H7boIuuq2pMZyL1eAt11CW
+ DcOKsB9vpFmaLtNExco0av6CbIVLJ61Wk3BSkT/AFCkRZSpZmrmiJQ41xSaCwdfznL15XEUX0Reem5f3
+ 8znnec4j/Zc8fxYGla91CS3eRTx0z6OpMYS7jmnU1X6B/VYA18snUVoyjsKCt8jLHcH5c36ouCQR2NUJ
+ 1Nas4G9ZXlmFKbULh1Kf8lJxSfI+WeCCyopv6q+/h+DQ/DJ2WV5Ao1FgPegRAveDOS4oLfmq/h6dn/DH
+ 4AJizD4UXJrCAUuzEDgbZrjgou2DiohshIcnQtgme5GTPYbkJKcQ1N8OckHW2REVi+RXuM8fxGaDG4oy
+ ALPZIQQ11Z+5QDk1oKJ/hjv7P2FTfCMOH3mFxMQ6IbhROYWOdrCnBI4dfwPr0V4+bRoY9UzXppMjcDdS
+ rC8hy3YhuFI2gTYf2A4Aza4f7N2/o/zaLB8qDYx6zszwr8P7k1thNFYIweXCMXgeAfedq2xxwjClZUeV
+ Jd2GtDNFETiJwfs8MBjKhMCWN8pgoLoqzE8miH1GjE7G4PsZjE7OQsm9ij2mFg7rdrug1xcJAa2l4w7W
+ r00Cgk/n38S7wBwC04u4UGxHrMHF4CbEJtyDLj5fCDIzhljfSxzeavRgyw4Zj9t64GvvQ0d3P3pfD2Kv
+ 2QqNvgFxDN6urYdWmyMElJMnevh60obRktA701PRtGlg1DOdSkXwzrisaMG/RZLWAE60OMW5fNhvAAAA
+ AElFTkSuQmCC
+
+
+
+
+ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIpSURBVDhPtZL/T1JRGMb5p1itrVZbbRpqZbawnBENV1I0
+ jGlByTSyJTXJwq2oKZQb1KAv6JCYWSxvBrkkZUq4CeQEiRABFeLL072Xa0zRra31bO8v57zP5znnPYf1
+ X+TxhWF6O7VtGYcnwbSWijKPOLzYrPSvLPwLS3huGUMlT7o9wGD9grVUBj+icdid03S9tDmgNxNwTgVQ
+ J+rA8XNtWwM+uuZATMwxmQVRycuJFNyzIRitDlScugKzjSgFRGJJaIwEsrk8AsHIhnSL/Ssck37UNipQ
+ I5DjtuYV7uksRYhr2kebhx2eP6nrycFIEh5fBA/1Nvru8q5+PDaOovK0rABwfwugWzcErfkzHhjsePL6
+ E7q1VrTdNUDcrgGvSYlDZHN5XTNOnL8BVe8AJAoNDtZfLgDu9L1BPJmikzcrk81hlRwodZJwdBXziwnI
+ OrVoaOkiT8C8hKLHBPO7CbywOaE1jeC+bhAd6meQdvZC1KoG/5IS3MZ2HObLUHZSggvkWq3wOvbWiAqA
+ VpWeyStVfCUNf3AZ4zNhfHCFMEDMgye+hYr6FrDLzxQAUuVTpr0ocn74mchg5vsKRt1RcHp2Qv9+kZ78
+ UcE17KkWFgHNN/uQzgBkGKLJPBZiecyGchjzrmFwPIF++xJUbDbUQzEacIArLpopSRSP4CUN1Obf1Abz
+ uqob5KjiXwWH/GVl5HPt5zZh37GL2H1EiF1VZ7GDI6CNW5r/TSzWbwHYL0mKJ5czAAAAAElFTkSuQmCC
+
+
+
+
+ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGCSURBVDhPnZK9S0JRGMb9F1xb2gqaq6mhwCGDtvYIIyLI
+ cJOE1paoIYpMKUjFRDH87lpoakGlIZF9DA2hZJEQhJXl1xPn3HPV29WQfvBwOfA+P95zuDJ39A6/4wyl
+ YOOSMHvOcHGThuwvSKEVRvsR+pQqWD3R1pK98DUbl7Jm5hA8SfESd6S5xH5wycalrO4E0D8yWQuriLH6
+ E2xcSqlcoRJBxCpiTO5TNi4m/ZgDF4nDsOulsfujyGRzUsmWM8YqdcggKbveS3A88bEkslRye58RSzZt
+ IVarY/FFaPmlwp+fUaESYRNW5Vm3BPmpBpZNvppACDmTLbS6FbGAPFAj5OGI4PALOK/yZfIlAlk4j7n5
+ xdaCarWKj0KRXmE2+UklJEJZZ/RCPTPdWvBdLOP1rYD41QNcgRiVkKJQ1mjGsa2VNxeQb2OWDC7sh47p
+ ddQLeoyOTSFiVAAFvVhChsmv2k6Uvd3Icx1UolMNiDdpl4nhLiohW/xb0tMph2JwCJxjAz9A30JI8zYA
+ tAAAAABJRU5ErkJggg==
+
+
+
+
+ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGDSURBVDhPrZFNSwJRGIX9NYGbFoUlFElY1EJQKEYhCJsi
+ LaVsERnRF5iCaSZJO1toCDVGFkgoFpWQWWRR2aIvUxm1BKN1wSnHCFw4TOCzue+9nPNw4eVVnav4Izzb
+ QfxeGZ5TWaxT/rK3irzmC7CsusvC1G4IkbNLboIiDieF4GGUKeTeClDpppF8eeEu2PIfwfrzizSdw3Hk
+ EnKlFpkMzV2wH77AosOFTV8A+vkl9CiHuJeLJNNZjM8tYWB0FkTvMAwmy/8ERTR6CwjlGAi1Ccence6C
+ 1NsXzN4PKIxJLLgeIJ2MoXvmFraNBKK3eXZRIveJPvs7FIYniEkXZENOdE+GIZ2Ko10TwLK7tJmKmL0F
+ EEYarYM+NMnt0C1sQzpx/lcSEnZ2gcKY/gs0dlmZuWvmjjmpwA1qxVp2AWFIMAF/OAGBzMjMI7ZrtJCb
+ 4Df3o4Zfxy7QrdxDRFKol5khkpR2H4qmIOzUQNBGwrsXYxccnNOQqNbQ0KGGZ+eEPVwdeLxvqqrf4wGh
+ TNAAAAAASUVORK5CYII=
+
+
+
+
+ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAHkSURBVDhPvZHfS1NhHIf3p5QypLr2D4goMwoMCi/qIugH
+ Xe1Cr7qKDIMkZixwNhfWLGWbnuki0kXKzLU023KubBNPJrbRdOzocm6e2dPOO21mMS+CHvjcvOf9PF++
+ 79H9M+7RT2iRRsIi9sEAXe43yAvf2LpSHq28G9uAnytNT4jMLewtcQ2Ht2pF8ps/aOt+gccX5lxD694S
+ +1BQFD1RkN5DSFa4Z3uONKbgHE3h8KZ4OJTC1J8UiSzmfhd2uf1CoJHbyKOsZokl0kKwm+aeJaov+wjO
+ rpQkVqdXfOz0bWAcVLghfaXxkUz3y2VxvpMGSwL3uMKh+gHezSSLEnNhX23vtYzKUirDfGyFj/Iy1mdx
+ UWqR8iKhwtQLxjgH659y4EwvVXWPiwJt3/Ws+muywRrlqvkDdx3zQrCN8l1ldnEd3/QqFmkS/akHJYGS
+ zjLzOUEwEsMf+sLI2zmaOou/93pPGoM5zvk7UU7fnBKxSBPoT7SXBNW1F/9Io2lKCNTCeomUyrS8xnBA
+ wfUqyf1eP5U1ptJD/o1LzeNCsHPydtqdr6k4aiwvOHvNSya3ibU/QIdrEkvfhJislc32MfYfuV1eUGPw
+ FF7bIVJVZ0N/soPK421UHGstlFvYd/hWecF/Qqf7CR0A5wwgSQA2AAAAAElFTkSuQmCC
+
+
+
+
+ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAJSSURBVDhPtZJrSJNRGMdf6IN9KbpQn/pUEH2JIoLqQ0Zh
+ FqYZRmJG1iKmUqKyLB2pqSm6vC1Nm5GXoeatEsVJ0RASR3eNzegikRq5lrV3857Fr/d9ddlICoL+8OfA
+ Oef/e57zcIT/os7WLMw302muSGJ2689qqi7A44q8IzjtNYzarzHQm8tZtT8FmRqu6LToMxN+B8qhCbGR
+ KVcDE85ajKUaxoaryEuL4UVXIudPB5Ko2oy98xjDptXERuz3hsgAOTzlqqMk6yjdllzE90UM9Wp5azlB
+ S1kwkeG+1CSv4mmBQPThfd6Ahqq8GYB4A11yBKmaMLQxoZyLDkGjDiZOFUhUuB+FsWsUQFiArzegtlzH
+ pFjPpMPA2GA2jucx2KqWK7ZWLqO7dBGP9D5KWLbfto3eAKMhi3FHBeP9GYy9PMXos4OIrYvJrzSRbWjm
+ wuV6EnVG4tLLiEzSExGf4w0oL05nZEDPaK+akceBuO9v4uPtFUrYo6npbzhdE/QPOQmNSiPouHYOUpaf
+ gvgqA/dDf9wd63G1r2SgUlAqyyq/1anYUGfG2mdXwne7bOwJUc1AinOS+NxzBpd5HWLbUhyNPvRdF5S2
+ v05/54tbqvzBifWNHUvPOwLC4/CXwrv2HsB3+w6EwosJOB5ESeElfGpayGD1AmwlArHSm+W2PR1clToo
+ MrbT0mFTVtlbN6xFuJQar3wQz5Q9VksD+7XyPctrJdx4p5s605M5gKz8lJPSDwtGFbKboJ1blAN52vKb
+ PdXm80/AfDokTVu+8DfPXv9XCcIPTvjvLQ8YoakAAAAASUVORK5CYII=
\ No newline at end of file
diff --git a/Source/Krypton Toolkit Suite Extended/Playground/Playground.csproj b/Source/Krypton Toolkit Suite Extended/Playground/Playground.csproj
index 3dca516f..3c381af8 100644
--- a/Source/Krypton Toolkit Suite Extended/Playground/Playground.csproj
+++ b/Source/Krypton Toolkit Suite Extended/Playground/Playground.csproj
@@ -33,10 +33,12 @@
4
-
+
+ False
A:\Developer DLLs\Krypton DLLs\Versions\4.7\ComponentFactory.Krypton.Design.dll
-
+
+ False
A:\Developer DLLs\Krypton DLLs\Versions\4.7\ComponentFactory.Krypton.Toolkit.dll
diff --git a/Source/Krypton Toolkit Suite Extended/Playground/Properties/AssemblyInfo.cs b/Source/Krypton Toolkit Suite Extended/Playground/Properties/AssemblyInfo.cs
index 4afc2521..65225251 100644
--- a/Source/Krypton Toolkit Suite Extended/Playground/Properties/AssemblyInfo.cs
+++ b/Source/Krypton Toolkit Suite Extended/Playground/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.52.0")]
-[assembly: AssemblyFileVersion("1.0.52.0")]
+[assembly: AssemblyVersion("1.0.59.0")]
+[assembly: AssemblyFileVersion("1.0.59.0")]