本文整理汇总了C#中ImageFileType.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# ImageFileType.ToString方法的具体用法?C# ImageFileType.ToString怎么用?C# ImageFileType.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageFileType
的用法示例。
在下文中一共展示了ImageFileType.ToString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Capture
public static void Capture( GraphicsDevice device, string filePath = null, ImageFileType format = ImageFileType.Png )
{
if( filePath == null )
{
if( !Directory.Exists( defaultFolder ) )
{
Directory.CreateDirectory( defaultFolder );
}
filePath = Path.Combine( defaultFolder, defaultName + "_" + ( FileCount( defaultFolder ) + 1 ).ToString() + "." + format.ToString().ToLower() );
}
device.BackBuffer.Save( filePath, format );
}
示例2: SearchGalleryAdvancedRequest
/// <exception cref="ArgumentNullException">
/// Thrown when a null reference is passed to a method that does not accept it as a
/// valid argument.
/// </exception>
internal string SearchGalleryAdvancedRequest(string url,
string qAll = null, string qAny = null,
string qExactly = null, string qNot = null,
ImageFileType? fileType = null, ImageSize? imageSize = null)
{
if (string.IsNullOrWhiteSpace(url))
throw new ArgumentNullException(nameof(url));
if (string.IsNullOrWhiteSpace(qAll) &&
string.IsNullOrWhiteSpace(qAny) &&
string.IsNullOrWhiteSpace(qExactly) &&
string.IsNullOrWhiteSpace(qNot))
throw new ArgumentNullException(null,
"At least one search parameter must be provided (All | Any | Exactly | Not).");
var query = new StringBuilder();
if (!string.IsNullOrWhiteSpace(qAll))
query.Append($"&q_all={WebUtility.UrlEncode(qAll)}");
if (!string.IsNullOrWhiteSpace(qAny))
query.Append($"&q_any={WebUtility.UrlEncode(qAny)}");
if (!string.IsNullOrWhiteSpace(qExactly))
query.Append($"&q_exactly={WebUtility.UrlEncode(qExactly)}");
if (!string.IsNullOrWhiteSpace(qNot))
query.Append($"&q_not={WebUtility.UrlEncode(qNot)}");
if (fileType != null)
query.Append($"&q_type={WebUtility.UrlEncode(fileType.ToString().ToLower())}");
if (imageSize != null)
query.Append($"&q_size_px={WebUtility.UrlEncode(imageSize.ToString().ToLower())}");
return $"{url}?{query}".Replace("?&", "?");
}