例37:爱好选择

  1. 建立一个新的EXE工程,放两个单选,两个复选框如图33。

图33

  1. 输入代码:

    Sub Form1_Check1_BN_Clicked(hWndForm As hWnd, hWndControl As hWnd)

    复制代码
    Text1.Text = ""
    
    If Check1.Value Then
    
          Text1.Text="你喜欢"  & Check1.Caption
    
    End If
    
    If Check2.Value Then
    
       Text1.Text= Text1.Text & "你喜欢" & Check2.Caption
    
    End If

    End Sub

    Sub Form1_Check2_BN_Clicked(hWndForm As hWnd, hWndControl As hWnd)

    复制代码
    Text1.Text = ""
    
     If Check2.Value Then
    
          Text1.Text="你喜欢"  & Check2.Caption
    
    End If
    
    If Check1.Value Then
    
       Text1.Text=Text1.Text & "你喜欢" & Check1.Caption
    
    End If

    End Sub

    Sub Form1_genda1_BN_Clicked(hWndForm As hWnd, hWndControl As hWnd)

    复制代码
    If genda1.Value Then
    
       Text1.Text="你的性别为" & genda1.Caption
    
    End If

    End Sub

    Sub Form1_genda2_BN_Clicked(hWndForm As hWnd, hWndControl As hWnd)

    复制代码
       If genda2.Value Then
    
       Text1.Text="你的性别为" & genda2.Caption
    
    End If

    End Sub

相关推荐
lecepin42 分钟前
AI Coding 资讯 2025-09-17
前端·javascript·面试
IT_陈寒44 分钟前
React 18实战:7个被低估的Hooks技巧让你的开发效率提升50%
前端·人工智能·后端
树上有只程序猿1 小时前
终于有人把数据库讲明白了
前端
猩兵哥哥1 小时前
前端面向对象设计原则运用 - 策略模式
前端·javascript·vue.js
司宸1 小时前
Prompt设计实战指南:三大模板与进阶技巧
前端
RoyLin1 小时前
TypeScript设计模式:抽象工厂模式
前端·后端·typescript
华仔啊2 小时前
Vue3+CSS 实现的 3D 卡片动画,让你的网页瞬间高大上
前端·css
江城开朗的豌豆2 小时前
解密React虚拟DOM:我的高效渲染秘诀 🚀
前端·javascript·react.js