C# 클래스 ACAT.Lib.Core.Utility.Windows

Contains numerous functions for window manipulation, window sizing, window positioning, etc. Has cross-thread invoke-required functions for most of the commonly used windows functions
파일 보기 프로젝트 열기: brlima94/acat-localization 1 사용 예제들

공개 메소드들

메소드 설명
Activate ( Form form ) : void

Activates the specified form

ActivateForm ( Form form ) : void

Activates the specified form

ActivateWindow ( IntPtr handle ) : bool

Shows the specified window and brings it to top

ClickOnWindow ( Control control ) : void

Simulates a mouse click on the specified control

CloseAsync ( Form form ) : void

Closes the form asynchronously in a different thread

CloseForm ( Form form ) : void

Closes the specified form This is just a helper function that takes care of cross-thread invokations that would result in .NET exceptions.

DockWithScanner ( Form form, Form scanner, WindowPosition scannerPosition ) : void

Docks the form to the scanner form in the relative position specified

FadeIn ( Form form ) : void

Fades in the specified form

FadeOut ( Form form ) : void

Gradually fades out the form

FindControlAtCursor ( Form form ) : Control

Finds the control under the cursor

FindControlAtPoint ( Control container, Point pos ) : Control

Finds which control of a window is at the specified point

GetCaretPosition ( TextBoxBase textBox ) : int

Returns the caret position in a text box. This is just a helper function that takes care of cross-thread invokations that would result in .NET exceptions.

GetForegroundWindow ( ) : IntPtr

Returns the currently active fg window

GetOSVersion ( ) : WindowsVersion

Returns the OS version

GetOpacity ( Form form ) : double

Gets the transparency of a form This is just a helper function that takes care of cross-thread invokations that would result in .NET exceptions.

GetScannerPosition ( Form form ) : WindowPosition

Gets the position of the specified form. which corner is the scanner at?

GetSelectedText ( TextBoxBase control ) : String

Returns selected text in the text box

GetText ( Control control ) : String

Returns the text value of the control. This is just a helper function that takes care of cross-thread invokations that would result in .NET exceptions.

GetText ( IntPtr hWnd ) : string

Gets text from the speficied window

GetTrackBarValueInt ( TrackBar trackBar ) : int

Returns trackbar value Takes care of cross-thread invokations that would result in .NET exceptions

GetVisible ( Control control ) : bool

Gets the visibility of a control. This is just a helper function that takes care of cross-thread invokations that would result in .NET exceptions.

GetWindowTitle ( IntPtr hwnd ) : String

Returns the window title of the specified window

HideTaskbar ( ) : void

Hide windows taskbar

IsDesktopWindow ( IntPtr handle ) : bool

returns if the specified handle is the desktop window

IsMaximized ( IntPtr handle ) : bool

Checks if window is maximized or not

IsMinimized ( IntPtr handle ) : bool

Checks if window is minimzied or not

IsObscuredByNonACATWindows ( IntPtr windowHandle ) : bool

Checks if any part of the specified window is obscured by a window belonging to a process other than ours

IsObscuredWindow ( IntPtr windowHandle ) : bool

Checks if any part of the specified window is obscured by another window. The other window could be one of this application's windows

MaximizeWindow ( IntPtr handle ) : void

Maximizes the window

MinimizeWindow ( IntPtr handle ) : void

Minimizes a window

PostMessage ( IntPtr hWnd, UInt32 Msg, Int32 wParam, UInt32 lParam ) : bool

Windows PostMessage()

RestoreWindow ( IntPtr handle ) : void

Restores the window from the maximized position

SendMessage ( IntPtr hWnd, int Msg, int wparam, int lparam ) : IntPtr

Windows SendMessage()

SetActiveWindow ( IntPtr hwnd ) : void

Sets the window as the active window

SetBackgroundColor ( Control control, Color color ) : void

Sets the background color of the widget. Takes care of cross-thread invokations that would result in .NET exceptions

SetCaretPosition ( TextBoxBase textBox, int position ) : void

Sets the caret position in a text box. This is just a helper function that takes care of cross-thread invokations that would result in .NET exceptions.

SetFocus ( Control control ) : bool

Sets focus to the control

SetFocusToDesktop ( ) : void

Sets current focus to the desktop window

SetForegroundColor ( Control control, Color color ) : void

Sets the foreground color of the widget. Takes care of cross-thread invokations that would result in .NET exceptions

SetForegroundWindow ( IntPtr hwnd ) : bool

Sets the fg window to the specified window

SetForegroundWindowSizePercent ( WindowPosition scannerPosition, int percent ) : void

Sets the width of the foreground window to a certain percentage of the display monitor width.

SetFormStyles ( CreateParams createParams ) : CreateParams

Sets the form style to not activate and also composited for better viewing experience

SetImage ( PictureBox box, Image image ) : void

Sets the image in a picturebox and invalidates the picture box This is just a helper function that takes care of cross-thread invokations that would result in .NET exceptions.

SetOpacity ( Form form, double arg ) : void

Sets the transparency of a form This is just a helper function that takes care of cross-thread invokations that would result in .NET exceptions.

SetRegion ( Control control, Region region ) : void

Set region for a control

SetText ( Control control, String text ) : void

Sets the text for the control. This is just a helper function that takes care of cross-thread invokations that would result in .NET exceptions.

SetTopMost ( Form form, bool topMost = true ) : void

Sets topmost to true

SetTrackBarValue ( TrackBar trackBar, int positionValue ) : void

Sets value of a tackbar as an integer Takes care of cross-thread invokations that would result in .NET exceptions

SetVisible ( Control control, bool visible ) : void

Sets the visibility of the control This is just a helper function that takes care of cross-thread invokations that would result in .NET exceptions.

SetWindowPosition ( Form form, IntPtr insertAfter, WindowPosition position ) : void

Set the window position

SetWindowPosition ( Form form, WindowPosition position ) : void

Set the window position

SetWindowPositionAndNotify ( Form form, IntPtr insertAfter, WindowPosition position ) : void

Set window pos to the specified position and notify when window position has changed

SetWindowPositionAndNotify ( Form form, WindowPosition position ) : void

Set window pos to the specified position and notify when window position has changed

SetWindowSizePercent ( IntPtr handle, WindowPosition scannerPosition, int percent ) : void

Partial maximize. Sets the window width to a percent of the display width.

Show ( Form parent, Form child ) : void

Shows the child window, assigns parent as the owner This is just a helper function that takes care of cross-thread invokations that would result in .NET exceptions.

ShowDialog ( Form parent, Form child ) : void

Shows the child window as a dialog of the parent window This is just a helper function that takes care of cross-thread invokations that would result in .NET exceptions.

ShowForm ( Form form ) : void

Shows the specified form This is just a helper function that takes care of cross-thread invokations that would result in .NET exceptions.

ShowInTaskbar ( Form control, bool show ) : void

Show or hide the specified form in the Windows taskbar

ShowInactiveTopmost ( Form parentForm, Form form ) : void

Show the window as topmost without activating it. Sets the form's parent to parentForm

ShowTaskbar ( ) : void

Show windows taskbar

ShowWindowBorder ( Form form, bool show, String title = "" ) : void

If show is set to true, shows the window borders and title

ShowWindowWithoutActivation ( Form form ) : void

Shows a window without setting focus to it

ShowWithoutActivation ( Form parent, Form child ) : void

Sets the child's owner to parent and shows it without setting focus to it

ToggleFgWindowMaximizeAndPartialMaximize ( WindowPosition scannerPosition, int percent ) : void

Toggles size of the fg window between maximized to partially maximized

TurnOffDPIAwareness ( ) : void

In Win8 and Win10, there are undesirable side-effects where the scanners are scaled imporperly. Turn off DPI awareness to fix this

UnselectText ( TextBoxBase control ) : void

Unselect text in textbox

비공개 메소드들

메소드 설명
DeleteObject ( [ hObject ) : bool
SetProcessDpiAwareness ( _Process_DPI_Awareness value ) : int
closeFormThreadProc ( Form form ) : void

Thread proc for CloseAsync()

fadeInProc ( Form form ) : void

Threadproc for fade-in

fadeOutProc ( Form form ) : void

Thread proc for fading out

메소드 상세

Activate() 공개 정적인 메소드

Activates the specified form
public static Activate ( Form form ) : void
form System.Windows.Forms.Form form to activate
리턴 void

ActivateForm() 공개 정적인 메소드

Activates the specified form
public static ActivateForm ( Form form ) : void
form System.Windows.Forms.Form form to activate
리턴 void

ActivateWindow() 공개 정적인 메소드

Shows the specified window and brings it to top
public static ActivateWindow ( IntPtr handle ) : bool
handle System.IntPtr window handle
리턴 bool

ClickOnWindow() 공개 정적인 메소드

Simulates a mouse click on the specified control
public static ClickOnWindow ( Control control ) : void
control System.Windows.Forms.Control the control
리턴 void

CloseAsync() 공개 정적인 메소드

Closes the form asynchronously in a different thread
public static CloseAsync ( Form form ) : void
form System.Windows.Forms.Form form to close
리턴 void

CloseForm() 공개 정적인 메소드

Closes the specified form This is just a helper function that takes care of cross-thread invokations that would result in .NET exceptions.
public static CloseForm ( Form form ) : void
form System.Windows.Forms.Form Form to close
리턴 void

DockWithScanner() 공개 정적인 메소드

Docks the form to the scanner form in the relative position specified
public static DockWithScanner ( Form form, Form scanner, WindowPosition scannerPosition ) : void
form System.Windows.Forms.Form form to dock
scanner System.Windows.Forms.Form scanner form to dock to
scannerPosition WindowPosition relative position
리턴 void

FadeIn() 공개 정적인 메소드

Fades in the specified form
public static FadeIn ( Form form ) : void
form System.Windows.Forms.Form form to fade in
리턴 void

FadeOut() 공개 정적인 메소드

Gradually fades out the form
public static FadeOut ( Form form ) : void
form System.Windows.Forms.Form form to fade out
리턴 void

FindControlAtCursor() 공개 정적인 메소드

Finds the control under the cursor
public static FindControlAtCursor ( Form form ) : Control
form System.Windows.Forms.Form form under the cursor
리턴 System.Windows.Forms.Control

FindControlAtPoint() 공개 정적인 메소드

Finds which control of a window is at the specified point
public static FindControlAtPoint ( Control container, Point pos ) : Control
container System.Windows.Forms.Control the container window
pos Point point to examine
리턴 System.Windows.Forms.Control

GetCaretPosition() 공개 정적인 메소드

Returns the caret position in a text box. This is just a helper function that takes care of cross-thread invokations that would result in .NET exceptions.
public static GetCaretPosition ( TextBoxBase textBox ) : int
textBox System.Windows.Forms.TextBoxBase
리턴 int

GetForegroundWindow() 공개 정적인 메소드

Returns the currently active fg window
public static GetForegroundWindow ( ) : IntPtr
리턴 System.IntPtr

GetOSVersion() 공개 정적인 메소드

Returns the OS version
public static GetOSVersion ( ) : WindowsVersion
리턴 WindowsVersion

GetOpacity() 공개 정적인 메소드

Gets the transparency of a form This is just a helper function that takes care of cross-thread invokations that would result in .NET exceptions.
public static GetOpacity ( Form form ) : double
form System.Windows.Forms.Form Form object
리턴 double

GetScannerPosition() 공개 정적인 메소드

Gets the position of the specified form. which corner is the scanner at?
public static GetScannerPosition ( Form form ) : WindowPosition
form System.Windows.Forms.Form the scanner form
리턴 WindowPosition

GetSelectedText() 공개 정적인 메소드

Returns selected text in the text box
public static GetSelectedText ( TextBoxBase control ) : String
control System.Windows.Forms.TextBoxBase text box
리턴 String

GetText() 공개 정적인 메소드

Returns the text value of the control. This is just a helper function that takes care of cross-thread invokations that would result in .NET exceptions.
public static GetText ( Control control ) : String
control System.Windows.Forms.Control
리턴 String

GetText() 공개 정적인 메소드

Gets text from the speficied window
public static GetText ( IntPtr hWnd ) : string
hWnd System.IntPtr window handle
리턴 string

GetTrackBarValueInt() 공개 정적인 메소드

Returns trackbar value Takes care of cross-thread invokations that would result in .NET exceptions
public static GetTrackBarValueInt ( TrackBar trackBar ) : int
trackBar System.Windows.Forms.TrackBar the trackbar object
리턴 int

GetVisible() 공개 정적인 메소드

Gets the visibility of a control. This is just a helper function that takes care of cross-thread invokations that would result in .NET exceptions.
public static GetVisible ( Control control ) : bool
control System.Windows.Forms.Control
리턴 bool

GetWindowTitle() 공개 정적인 메소드

Returns the window title of the specified window
public static GetWindowTitle ( IntPtr hwnd ) : String
hwnd System.IntPtr handle to the window
리턴 String

HideTaskbar() 공개 정적인 메소드

Hide windows taskbar
public static HideTaskbar ( ) : void
리턴 void

IsDesktopWindow() 공개 정적인 메소드

returns if the specified handle is the desktop window
public static IsDesktopWindow ( IntPtr handle ) : bool
handle System.IntPtr
리턴 bool

IsMaximized() 공개 정적인 메소드

Checks if window is maximized or not
public static IsMaximized ( IntPtr handle ) : bool
handle System.IntPtr window handle
리턴 bool

IsMinimized() 공개 정적인 메소드

Checks if window is minimzied or not
public static IsMinimized ( IntPtr handle ) : bool
handle System.IntPtr window handle
리턴 bool

IsObscuredByNonACATWindows() 공개 정적인 메소드

Checks if any part of the specified window is obscured by a window belonging to a process other than ours
public static IsObscuredByNonACATWindows ( IntPtr windowHandle ) : bool
windowHandle System.IntPtr Window to check for
리턴 bool

IsObscuredWindow() 공개 정적인 메소드

Checks if any part of the specified window is obscured by another window. The other window could be one of this application's windows
public static IsObscuredWindow ( IntPtr windowHandle ) : bool
windowHandle System.IntPtr Window to check for
리턴 bool

MaximizeWindow() 공개 정적인 메소드

Maximizes the window
public static MaximizeWindow ( IntPtr handle ) : void
handle System.IntPtr window handle
리턴 void

MinimizeWindow() 공개 정적인 메소드

Minimizes a window
public static MinimizeWindow ( IntPtr handle ) : void
handle System.IntPtr window handle
리턴 void

PostMessage() 공개 정적인 메소드

Windows PostMessage()
public static PostMessage ( IntPtr hWnd, UInt32 Msg, Int32 wParam, UInt32 lParam ) : bool
hWnd System.IntPtr
Msg System.UInt32
wParam System.Int32
lParam System.UInt32
리턴 bool

RestoreWindow() 공개 정적인 메소드

Restores the window from the maximized position
public static RestoreWindow ( IntPtr handle ) : void
handle System.IntPtr window handle
리턴 void

SendMessage() 공개 정적인 메소드

Windows SendMessage()
public static SendMessage ( IntPtr hWnd, int Msg, int wparam, int lparam ) : IntPtr
hWnd System.IntPtr
Msg int
wparam int
lparam int
리턴 System.IntPtr

SetActiveWindow() 공개 정적인 메소드

Sets the window as the active window
public static SetActiveWindow ( IntPtr hwnd ) : void
hwnd System.IntPtr window handle
리턴 void

SetBackgroundColor() 공개 정적인 메소드

Sets the background color of the widget. Takes care of cross-thread invokations that would result in .NET exceptions
public static SetBackgroundColor ( Control control, Color color ) : void
control System.Windows.Forms.Control
color Color Color to set
리턴 void

SetCaretPosition() 공개 정적인 메소드

Sets the caret position in a text box. This is just a helper function that takes care of cross-thread invokations that would result in .NET exceptions.
public static SetCaretPosition ( TextBoxBase textBox, int position ) : void
textBox System.Windows.Forms.TextBoxBase
position int
리턴 void

SetFocus() 공개 정적인 메소드

Sets focus to the control
public static SetFocus ( Control control ) : bool
control System.Windows.Forms.Control control to set focus to
리턴 bool

SetFocusToDesktop() 공개 정적인 메소드

Sets current focus to the desktop window
public static SetFocusToDesktop ( ) : void
리턴 void

SetForegroundColor() 공개 정적인 메소드

Sets the foreground color of the widget. Takes care of cross-thread invokations that would result in .NET exceptions
public static SetForegroundColor ( Control control, Color color ) : void
control System.Windows.Forms.Control
color Color Color to set
리턴 void

SetForegroundWindow() 공개 정적인 메소드

Sets the fg window to the specified window
public static SetForegroundWindow ( IntPtr hwnd ) : bool
hwnd System.IntPtr window handle
리턴 bool

SetForegroundWindowSizePercent() 공개 정적인 메소드

Sets the width of the foreground window to a certain percentage of the display monitor width.
public static SetForegroundWindowSizePercent ( WindowPosition scannerPosition, int percent ) : void
scannerPosition WindowPosition where to position the window?
percent int the percent width
리턴 void

SetFormStyles() 공개 정적인 메소드

Sets the form style to not activate and also composited for better viewing experience
public static SetFormStyles ( CreateParams createParams ) : CreateParams
createParams System.Windows.Forms.CreateParams Windows create params
리턴 System.Windows.Forms.CreateParams

SetImage() 공개 정적인 메소드

Sets the image in a picturebox and invalidates the picture box This is just a helper function that takes care of cross-thread invokations that would result in .NET exceptions.
public static SetImage ( PictureBox box, Image image ) : void
box System.Windows.Forms.PictureBox
image Image
리턴 void

SetOpacity() 공개 정적인 메소드

Sets the transparency of a form This is just a helper function that takes care of cross-thread invokations that would result in .NET exceptions.
public static SetOpacity ( Form form, double arg ) : void
form System.Windows.Forms.Form Form object
arg double opacity value
리턴 void

SetRegion() 공개 정적인 메소드

Set region for a control
public static SetRegion ( Control control, Region region ) : void
control System.Windows.Forms.Control control to set region for
region System.Drawing.Region region to set
리턴 void

SetText() 공개 정적인 메소드

Sets the text for the control. This is just a helper function that takes care of cross-thread invokations that would result in .NET exceptions.
public static SetText ( Control control, String text ) : void
control System.Windows.Forms.Control
text String text to set
리턴 void

SetTopMost() 공개 정적인 메소드

Sets topmost to true
public static SetTopMost ( Form form, bool topMost = true ) : void
form System.Windows.Forms.Form which form?
topMost bool set to true for topmost, false otherwise
리턴 void

SetTrackBarValue() 공개 정적인 메소드

Sets value of a tackbar as an integer Takes care of cross-thread invokations that would result in .NET exceptions
public static SetTrackBarValue ( TrackBar trackBar, int positionValue ) : void
trackBar System.Windows.Forms.TrackBar
positionValue int
리턴 void

SetVisible() 공개 정적인 메소드

Sets the visibility of the control This is just a helper function that takes care of cross-thread invokations that would result in .NET exceptions.
public static SetVisible ( Control control, bool visible ) : void
control System.Windows.Forms.Control
visible bool
리턴 void

SetWindowPosition() 공개 정적인 메소드

Set the window position
public static SetWindowPosition ( Form form, IntPtr insertAfter, WindowPosition position ) : void
form System.Windows.Forms.Form form to reposition
insertAfter System.IntPtr insert after this window
position WindowPosition new position
리턴 void

SetWindowPosition() 공개 정적인 메소드

Set the window position
public static SetWindowPosition ( Form form, WindowPosition position ) : void
form System.Windows.Forms.Form form to reposition
position WindowPosition the new position
리턴 void

SetWindowPositionAndNotify() 공개 정적인 메소드

Set window pos to the specified position and notify when window position has changed
public static SetWindowPositionAndNotify ( Form form, IntPtr insertAfter, WindowPosition position ) : void
form System.Windows.Forms.Form The form
insertAfter System.IntPtr
position WindowPosition Where to set the position
리턴 void

SetWindowPositionAndNotify() 공개 정적인 메소드

Set window pos to the specified position and notify when window position has changed
public static SetWindowPositionAndNotify ( Form form, WindowPosition position ) : void
form System.Windows.Forms.Form The form
position WindowPosition Where to set the position
리턴 void

SetWindowSizePercent() 공개 정적인 메소드

Partial maximize. Sets the window width to a percent of the display width.
public static SetWindowSizePercent ( IntPtr handle, WindowPosition scannerPosition, int percent ) : void
handle System.IntPtr handle of the window
scannerPosition WindowPosition which corner should the window be positioned at?
percent int percentage of display monitor width
리턴 void

Show() 공개 정적인 메소드

Shows the child window, assigns parent as the owner This is just a helper function that takes care of cross-thread invokations that would result in .NET exceptions.
public static Show ( Form parent, Form child ) : void
parent System.Windows.Forms.Form
child System.Windows.Forms.Form
리턴 void

ShowDialog() 공개 정적인 메소드

Shows the child window as a dialog of the parent window This is just a helper function that takes care of cross-thread invokations that would result in .NET exceptions.
public static ShowDialog ( Form parent, Form child ) : void
parent System.Windows.Forms.Form
child System.Windows.Forms.Form
리턴 void

ShowForm() 공개 정적인 메소드

Shows the specified form This is just a helper function that takes care of cross-thread invokations that would result in .NET exceptions.
public static ShowForm ( Form form ) : void
form System.Windows.Forms.Form
리턴 void

ShowInTaskbar() 공개 정적인 메소드

Show or hide the specified form in the Windows taskbar
public static ShowInTaskbar ( Form control, bool show ) : void
control System.Windows.Forms.Form form
show bool set to true to show
리턴 void

ShowInactiveTopmost() 공개 정적인 메소드

Show the window as topmost without activating it. Sets the form's parent to parentForm
public static ShowInactiveTopmost ( Form parentForm, Form form ) : void
parentForm System.Windows.Forms.Form the parent of the form
form System.Windows.Forms.Form the form
리턴 void

ShowTaskbar() 공개 정적인 메소드

Show windows taskbar
public static ShowTaskbar ( ) : void
리턴 void

ShowWindowBorder() 공개 정적인 메소드

If show is set to true, shows the window borders and title
public static ShowWindowBorder ( Form form, bool show, String title = "" ) : void
form System.Windows.Forms.Form the target form
show bool true to show border/title
title String title to set
리턴 void

ShowWindowWithoutActivation() 공개 정적인 메소드

Shows a window without setting focus to it
public static ShowWindowWithoutActivation ( Form form ) : void
form System.Windows.Forms.Form the window form
리턴 void

ShowWithoutActivation() 공개 정적인 메소드

Sets the child's owner to parent and shows it without setting focus to it
public static ShowWithoutActivation ( Form parent, Form child ) : void
parent System.Windows.Forms.Form parent form
child System.Windows.Forms.Form child form
리턴 void

ToggleFgWindowMaximizeAndPartialMaximize() 공개 정적인 메소드

Toggles size of the fg window between maximized to partially maximized
public static ToggleFgWindowMaximizeAndPartialMaximize ( WindowPosition scannerPosition, int percent ) : void
scannerPosition WindowPosition where to position the window
percent int the partial maximize percentage
리턴 void

TurnOffDPIAwareness() 공개 정적인 메소드

In Win8 and Win10, there are undesirable side-effects where the scanners are scaled imporperly. Turn off DPI awareness to fix this
public static TurnOffDPIAwareness ( ) : void
리턴 void

UnselectText() 공개 정적인 메소드

Unselect text in textbox
public static UnselectText ( TextBoxBase control ) : void
control System.Windows.Forms.TextBoxBase the text box control
리턴 void