p 209 Label Command 1 Command 2 Command
기능 설명 (p. 209) ± 화면 구성 Label Command 1 Command 2 Command 3 명령버튼을 만드는 순서에 따라 Tab을 눌렀을 때, 선택되는 순서가 결정된다. 관련속성 : Tab. Index Rich. Text. Box 1 Command 4 Command 1에서 부터 Command 6까지의 Tab. Index를 살펴볼것 Command 5 Common. Dialog 2021 -12 -11 Command 6 수원과학대 컴퓨터정보과 4
객체 만들기(p. 210) ± 객체 (이름) 지정 Label 1 Command 2 Command 3 (이름) = RTBox Command 4 Command 5 (이름) = com. Dlg 2021 -12 -11 수원과학대 컴퓨터정보과 Command 6 10
추가 기능 - 1 Private Sub Command 1_Click() Dim 확장자 As String RTBox. Text = "" Image 1. Picture = Load. Picture() Label 1. Caption = "" Com. Dlg. Filter = "모든파일|*. *|텍스트파일|*. txt; *. frm" Com. Dlg. Filter. Index = 2 Com. Dlg. Show. Open 확장자 = LCase(Right(Com. Dlg. File. Name, 3)) If (확장자 = "txt" Or 확장자 = "frm") Then RTBox. Load. File Com. Dlg. File. Name Label 1. Caption = Com. Dlg. File. Name Else Msg. Box "확장자가 frm 또는 txt 파일만 열 수 있습니다. ", _ vb. Information + vb. OKOnly, "열수없는 파일" End If End Sub 2021 -12 -11 수원과학대 컴퓨터정보과 21
Dim 확장자 As String 추가기능 - 2 RTBox. Text = "" Image 1. Picture = Load. Picture() Label 1. Caption = "" Com. Dlg. Filter = "모든파일|*. *|텍스트파일|*. txt; *. frm|그림파일 |*. bmp; *. jpg; *. wmf" Com. Dlg. Filter. Index = 2 Com. Dlg. Show. Open 확장자 = LCase(Right(Com. Dlg. File. Name, 3)) If (확장자 = "txt" Or 확장자 = "frm") Then RTBox. Load. File Com. Dlg. File. Name Label 1. Caption = Com. Dlg. File. Name Else. If (확장자 = "bmp" Or 확장자 = "jpg" Or 확장자 = "wmf") Then Image 1. Picture = Load. Picture(Com. Dlg. File. Name) Label 1. Caption = Com. Dlg. File. Name Else Msg. Box "텍스트 파일(txt/frm) 또는 그림파일(bmp/jpg/wmf)만 열 수 있습니 다. ", vb. Information + vb. OKOnly, "열 수 없는 파일" 2021 -12 -11 수원과학대 컴퓨터정보과 23 End If
추가기능 - 3 Private Sub Command 3_Click() On Error Go. To CLR_ERR ‘ 공통대화상자의 취소 버튼을 에러 처리하여 정상수행되지 않게 함 Com. Dlg. Cancel. Error = True Com. Dlg. Show. Color Form 1. Back. Color = Com. Dlg. Color Com. Dlg. Cancel. Error = False CLR_ERR: If Err. Number <> 0 And Err. Number <> 32755 Then Msg. Box "에러번호 : " & Err. Number & vb. Cr. Lf & _ "에러내용 : " & Err. Description, vb. Critical + vb. OKOnly, _ "에러발생" End If 2021 -12 -11 End Sub 수원과학대 컴퓨터정보과 25
추가기능 - 4 ± 컨트롤배열 ® Command 7(0) ~ Command 7(3) 생성 ® Command 8(0) ~ Command 8(3) 생성 ® 이벤트프로시져에 Index를 넘겨준다. Private Sub Command 7_Click(Index As Integer) RTBox. Back. Color = Command 7(Index). Back. Color End Sub Private Sub Command 8_Click(Index As Integer) RTBox. Sel. Color = Command 8(Index). Back. Color End Sub 2021 -12 -11 수원과학대 컴퓨터정보과 27
추가기능 - 5 ± 종료버튼 Private Sub Command 6_Click() Dim ans As Integer ans = Msg. Box("정말 종료하시겠습니까? ", vb. Question + vb. Yes. No, _ "종료확인") If ans = vb. Yes Then End If End Sub 2021 -12 -11 수원과학대 컴퓨터정보과 28
- Slides: 28