Util
정적 클래스이며 확장 메서드를 포함한 기능성 메서드가 정의된 클래스
Extension Methods
ChangeImageOpacity
Image image의 불투명한 정도가 변경된 새 인스턴스를 반환float opacity: 1F (= 100%)
public static Image ChangeImageOpacity(this Image image, float opacity);ConvertByteArrayToImage
이진 이미지 데이터를 Image 타입 인스턴스로 변환
public static Image ConvertByteArrayToImage(this byte[] byteArray);ConvertImageToByteArray
Image 타입 인스턴스를 이진 이미지 데이터로 변환
public static byte[] ConvertImageToByteArray(this Image image);FindNodeIdByFieldValue
TreeList의 fieldName에 해당하는 컬럼에서 value와 동일한 값의 첫번째로 찾은 Node의 Id를 반환
public static int FindNodeIdByFieldValue(this TreeList tree, string fieldName, object value);FindRowHandleByDataRow
GridControl에 바인딩된 DataTable의 DataRow를 참조하여 GridView의 RowHandle을 반환
public static int FindRowHandleByDataRow(this GridView gridView, DataRow row);GetSelectedDataRows
각 TreeList, GridView 에서 선택된 행(또는 노드)의 DataRow 들을 반환
public static DataRow[] GetSelectedDataRows(this TreeList treeList);
public static DataRow[] GetSelectedDataRows(this GridView gridView);IsFloat
값(
value)이 소수 타입(Single, Double, Decimal)인지 여부를 반환
public static bool IsFloat(this ValueType value);int intValue = 12;
float floatValue = 12.345F;
double doubleValue = 12.345D;
decimal decimalValue = 12.345M;
intValue.IsFloat(); // false
floatValue.IsFloat(); // true
doubleValue.IsFloat(); // true
decimalValue.IsFloat(); // trueIsInteger
값(
value)이 정수 타입(Byte, SByte, Int16, Int32, Int64, UInt16, UInt32, UInt64)인지 여부를 반환
public static bool IsInteger(this ValueType value);int intValue = 12;
float floatValue = 12.345F;
double doubleValue = 12.345D;
decimal decimalValue = 12.345M;
intValue.IsInteger(); // true
floatValue.IsInteger(); // false
doubleValue.IsInteger(); // false
decimalValue.IsInteger(); // falseIsNumeric
값(
value)이 숫자 타입(Single, Double, Decimal, Byte, SByte, Int16, Int32, Int64, UInt16, UInt32, UInt64)인지 여부를 반환
public static bool IsNumeric(this ValueType value);int intValue = 12;
float floatValue = 12.345F;
double doubleValue = 12.345D;
decimal decimalValue = 12.345M;
intValue.IsNumeric(); // true
floatValue.IsNumeric(); // true
doubleValue.IsNumeric(); // true
decimalValue.IsNumeric(); // trueIsNumericType
타입(
type)이 숫자 타입(Single, Double, Decimal, Byte, SByte, Int16, Int32, Int64, UInt16, UInt32, UInt64)인지 여부를 반환
public static bool IsNumericType(this Type type);string stringValue = "ABC";
int intValue = 12;
float floatValue = 12.345F;
double doubleValue = 12.345D;
decimal decimalValue = 12.345M;
stringValue.GetType().IsNumericType(); // false
intValue.GetType().IsNumericType(); // true
floatValue.GetType().IsNumericType(); // true
doubleValue.GetType().IsNumericType(); // true
decimalValue.GetType().IsNumericType(); // trueKeyCodeToUnicode
public static string KeyCodeToUnicode(this Keys key);Left
public static string Left(this string target, int length);Right
public static string Right(this string target, int length);LoadDocument
public static void LoadDocument(this SpreadsheetControl spreadsheetControl, IWorkbook document);MoveDownRow
public static void MoveDownRow(this GridView gridView);MoveUpRow
public static void MoveUpRow(this GridView gridView);ToClrType
public static Type ToClrType(this SqlDbType sqlType);ToSqlDbType
public static SqlDbType ToSqlDbType(this Type clrType);ExpandToFirstNode
public static void ExpandToFirstNode(this TreeListNode node);GetTempDirectory
현재 응용 프로그램이 실행된 디렉토리에 하위 디렉토리(temp)를 생성하고 그 경로를 반환
public static string GetTempDirectory();ClearTempDirectory
현재 응용 프로그램이 실행된 디렉토리에 하위 디렉토리(temp) 내 모든 파일을 제거
public static void ClearTempDirectory();GetNextFileName
중복 되지 않은 파일명을 반환
ex) Parameter Value( "C:\A.txt" ) → Return Value ( "C:\A (1).txt" )
public static string GetNextFileName(string fileName);ValidateUri
public static bool ValidateUri(this string uriString);GetValue
DataRow의 특정 컬럼의 값을 반환
string columnName 에 해당하는 컬럼이 존재하지 않을 경우 null 을 반환
public static object GetValue(this DataRow dataRow, string columnName);SetValue
DataRow의 특정 컬럼에 값을 할당
string columnName에 해당하는 컬럼이 존재하지 않을 경우 false 반환
public static bool SetValue(this DataRow dataRow, string columnName, object value);MoveToLastPosition
MemoEdit 의 마지막에 입력된 텍스트로 커서를 이동
public static void MoveToLastPosition(this MemoEdit memoEdit);AppendUri
public static Uri AppendUri(this Uri uri, params string[] paths);GetGroupRowCount
public static int GetGroupRowCount(this GridView view);GetPivotData
PivotGridControl 의 화면에 보이는 표를 DataTable로 반환
public static DataTable GetPivotData(this PivotGridControl pivotGridControl);FindByTag
열거형 개체의 요소가 Tag 속성을 지닌 타입일 경우 해당 속성의 값과 파라미터(
object tag)의 값을 비교하여 첫 번째로 일치하는 개체를 반환GroupControl.CustomHeaderButtons, RepositoryItemButtonEdit.Buttons 등 (예시 참고)
public static T FindByTag<T>(this IEnumerable<T> collection, object tag);// GroupControl의 버튼 중 Tag 속성에 값이 "upload"인 버튼을 비활성화
IBaseButton button = grpList.CustomHeaderButtons.FindByTag("upload");
if (button != null)
{
button.Properties.Enabled = false;
}
// RepositoryItemButtonEdit의 버튼 중 Tag 속성에 값이 "popup"인 버튼을 비활성화
EditorButton button = repositoryButtonEdit.Buttons.FindByTag("popup");
if (button != null)
{
button.Enabled = false;
}General Static Methods
AddEnterKeyDownAction
public static void AddEnterKeyDownAction(object targetControl, Action action);ConvertColorToInt
public static uint ConvertColorToInt(Color colorValue);ConvertIntToColor
public static Color ConvertIntToColor(uint colorValue);ConvertExcelToDataTable
Spreadsheet 파일을 읽고 DataTable 자료형으로 결과를 반환
Parameters
string path: Spreadsheet 파일의 경로int rowIndexOfColumns: DataTable의 DataColumn을 정의할 엑셀 파일의 행 순서 (0 이면 엑셀 파일의 첫번째 행)
public static DataTable ConvertExcelToDataTable(IWorkbook document, int rowIndexOfColumns, uint worksheetIndex = 0);
public static DataTable ConvertExcelToDataTable(string path, int rowIndexOfColumns, uint worksheetIndex = 0);
public static DataTable ConvertExcelToDataTable(byte[] buffer, DocumentFormat format, int rowIndexOfColumns, uint worksheetIndex = 0);
public static DataTable ConvertExcelToDataTable(Stream stream, DocumentFormat format, int rowIndexOfColumns, uint worksheetIndex = 0);FindControlAtCursor
public static Control FindControlAtCursor(Form form);FindControlAtPoint
public static Control FindControlAtPoint(Control container, Point pos);GetClientPCName
public static string GetClientPCName();GetIPAddress
public static string GetIPAddress();GetMacAddress
public static string GetMacAddress();GetPublicIPAddress
public static string GetPublicIPAddress();GetDistanceFromColors
public static int GetDistanceFromColors(Color current, Color match);InitDataSource
public static DataTable InitDataSource(object control);IsDirectory
public static bool IsDirectory(string path);IsRecognisedImageFile
public static bool IsRecognisedImageFile(string fileName);GetValue
public static object GetValue(object component, string propertyName);ResolveValue
public static object ResolveValue(object component, string path, object replacementValue);SetPropertyValue
public static bool SetPropertyValue(object component, string path, object value);LoadImage
public static Image LoadImage(string path);GetSalt
public static byte[] GetSalt(int maximumSaltLength);Tree_KeyDown
public static void Tree_KeyDown(object sender, KeyEventArgs e);ConvertDataTableToExcel
public static IWorkbook ConvertDataTableToExcel(DataTable dataTable);GetBestFontSize
Control 개체 사이즈에 맞는 문자열의 크기를 반환
public static float GetBestFontSize(Control control, string text, int margin, float minSize, float maxSize);CopyGridRows
원본 GridContrl(
sourceGrid)의 시작, 끝 행 위치에 해당하는 행을 참조하여 대상 GridControl(destGrid)의 복사 위치(destIndex)에 새로운 행을 추가
public static void CopyGridRows(GridControl sourceGrid, int startIndex, int endIndex, GridControl destGrid, int destIndex);GetDefaultPrinter
시스템에 설정된 기본 프린터 이름을 반환
public static string GetDefaultPrinter();GetPrinters
시스템에 등록된 모든 프린터 이름을 문자열 배열로 반환
public static string[] GetPrinters();SetDefaultPrinter
파라미터의 프린터 이름으로 기본 프린터 설정
public static bool SetDefaultPrinter(string name);Last updated
Was this helpful?