CatLab Studio
article thumbnail

1. AutoHotkey 오토핫키 화면 내 사각형 영역 표시 라이브러리

화면에 원하는 영역을 사각형의 형태로 텍스트와 함께 시각적으로 보이게 해주는 라이브러리입니다.

다용도로 사용이 용이할것 같아서 제작해보았습니다

 

- v1.1 업데이트

  • 다중 객체 오류 수정

- v2.0 업데이트 (24.03.19)

  • 객체 제거 오류 수정
  • 텍스트 영역 정확도 수정
  • 커스텀 기능 추가

예시 이미지

 

TextRectangle Lib.zip
0.02MB

<bash />
;================================================================================== ; 파일명 : TextRectangle.ahk ; 설명 : 화면 특정 영역 표시 라이브러리 ; 버전: v2.0 ; 라이센스: CC BY-SA 3.0 (https://creativecommons.org/licenses/by-sa/3.0/deed.ko) ; 설치방법: #Include TextRectangle.ahk ; 제작자: https://catlab.tistory.com/ (fty816@gmail.com) ;================================================================================== #Include Gdip_All.ahk class TextRectangle { ;================================================================================== ; 객체생성 : ; TextRectangle := new TextRectangle() ; 영역표시 : ; TextRectangle.Show(X, Y, W, H, [BorderWidth], [BorderColor], [Text], [TextColor], [Font], [FontSize]) ; 영역제거 : ; TextRectangle.Hide() ; 객체제거 : ; TextRectangle := ;================================================================================== __New() { Random, RanVar this.RanVar := RanVar this.Width := A_ScreenWidth, this.Height := A_ScreenHeight Gui,Rec%RanVar%: -Caption +E0x80000 +LastFound +AlwaysOnTop +ToolWindow +OwnDialogs Gui,Rec%RanVar%: Show, NA this.pToken := Gdip_Startup() this.HWND := WinExist() this.hbm := CreateDIBSection(this.Width, this.Height) this.hdc := CreateCompatibleDC() this.obm := SelectObject(this.hdc, this.hbm) this.G := Gdip_GraphicsFromHDC(this.hdc) Gdip_SetSmoothingMode(this.G, 4) } Show(X, Y, W, H, BorderWidth := 3, BorderColor:="000000", Text:="", TextColor:="FFFFFF", Font := "Segoe UI", FontSize := 20) { TextOptions := "S" FontSize " Bold" returnRc := Gdip_TextToGraphics(this.G, Text, TextOptions, Font, "", "", true) this.GetTextRecSize(returnRc, recW, recH) this.Brush := Gdip_BrushCreateSolid("0xFF" BorderColor) this.Pen := Gdip_CreatePen("0xFF" BorderColor, BorderWidth) Gdip_DrawRectangle(this.G, this.Pen, X, Y, W, H) Gdip_FillRectangle(this.G, this.Brush, X-1, Y-recH, recW, recH) TextOptions := "X" X "Y" Y-recH "CFF" TextColor "S" FontSize " Bold" Gdip_TextToGraphics(this.G, Text, TextOptions, Font) UpdateLayeredWindow(this.HWND, this.hdc, 0, 0, this.Width, this.Height) } GetTextRecSize(result, ByRef recW, ByRef recH) { returnRcs := StrSplit(result, "|") recW := Round(returnRcs[3]) recH := Round(returnRcs[4]) } Hide() { Gdip_DeleteBrush(this.Brush) Gdip_DeletePen(this.Pen) Gdip_GraphicsClear(this.G) UpdateLayeredWindow(this.HWND, this.hdc, 0, 0, this.Width, this.Height) } __Delete() { RanVar := this.RanVar Gui,Rec%RanVar%: Destroy Gdip_DeleteGraphics(this.G) Gdip_DeleteBrush(this.Brush) Gdip_DeletePen(this.Pen) SelectObject(this.hdc, this.obm) DeleteObject(this.hbm) DeleteDC(this.hdc) Gdip_Shutdown(this.pToken) } }
profile

CatLab Studio

@CatLab

포스팅이 좋았다면 "좋아요❤️" 또는 "구독👍🏻" 해주세요!