Win10 Build 9926 introduces a new version of the modern calculator, which uses a newly designed UI that is generally more flat, and that complements the WIN10.
Can't you use the modern calculator without upgrading to WIN10?
NO ... Second day at home is also bored, did not go to the so-called relatives, since bored, just imitate Win10 write a calculator bar.
Windows Calculator is not generally powerful, today only completed the simple standard mode (the standard mode is not complete), mainly to experience the modern design style.
Draw out all the material.
Due to the limitations of VB, the use of command buttons is not beautiful, so, all the buttons are picture, and use the image display.
2 control groups and n image spaces, two text controls are used here.
Function:
· Simple calculation
· Minimization of
· Window movement
Material:
After fixing the position of each key:
On the source code, because the use of pinyin variable name, or relatively understand:
Option Explicit ' Copyright (c) 2015, Yantai University School of Computer ' all right reserved. ' Shao ' file: Project 1.vbp ' completion date: February 20, 2015 ' version number: V1.0dim SHU1 as S Ingle, Shu2 as single, suanfu1 as StringDim shu3 as Stringprivate Declare Function SendMessage Lib "user32" Alias "Sendmes Sagea "(ByVal hwnd as Long, _byval wmsg as Long, ByVal WParam as Long, lParam as any) as Longprivate Declare Function rele Asecapture Lib "User32" () as Longprivate const WM_SYSCOMMAND = &h112private Const Sc_move = &hf010&private Co NST htcaptio = 2Private Sub dengyu_click () shu2 = Val (text1.text) Select Case suanfu1case "+" Text1.Text = shu1 + shu2case "- "Text1.Text = shu1-shu2case" * "Text1.Text = SHU1 * shu2case"/"If shu2 = 0 Thentext1.text =" Divisor cannot be zero "' MsgBox ' denominator cannot be zero!", 1 + 32 + 0, "error" in the block diagram shown elsetext1.text = shu1/shu2end IfEnd Selectshuruk.text = "" "End subprivate Sub Dian_click () Text1 . Text = Text1.Text + "." If (InStr (Text1.Text, ".") = 1) Then ' first digit cannot be a decimal Text1.Text = "" End ifif InStr (Text1.Text, ".") < Len (Text1.Text) Then ' anti-Two decimal points Text1.Text = Left (Text1.Text, Len (Text1.Text)-1) End IfEnd SubPrivate Sub End_click () EndEnd SubPrivate Sub Labe L1_click () If me.windowstate = 0 Then me.windowstate = 1End IfEnd SubPrivate Sub labformtitle_mousedown (Button as Integer, Shift as Integer, X as single, Y as single) ReleaseCapture ' Wm_sys send a mobile form command to the form call SendMessage (Me.hwnd, wm_syscom Mand, Sc_move + htcaptio, 0) ' sc_move+ htcaptio ' means left-click to move the form End SubPrivate Sub fuhao_click () If left (Text1.Text, 1) <> "- "Thentext1.text ="-"& Text1.TextElseText1.Text = Right (Text1.Text, Len (Text1.Text)-1) End IfEnd SubPrivate Sub Gen Hao_click () Text1.Text = SQR (text1.text) End subprivate Sub qingchu_click () Text1.Text = "" ' Clears Shuruk. Text = "" End subprivate Sub Shuzi_click (Index as Integer) ' Text1.Text = "" Select Case indexcase 0text1.text = Text1.Text + ' 0 ' case 1text1.text = text1.text + ' 1 ' case 2text1.text = Text1.Text + ' 2 ' case 3text1.text = text1.text + ' 3 ' case 4text1.te XT = Text1.Text + "4" Case 5text1.text = text1.tExt + ' 5 ' case 6text1.text = text1.text + ' 6 ' case 7text1.text = text1.text + ' 7 ' case 8text1.text = text1.text + ' 8 ' case 9Te XT1. Text = Text1.Text + "9" End SelectEnd subprivate Sub suanfu_click (Index as Integer) shu1 = Val (text1.text) shu3 = CStr (SHU1) S Elect case Indexcase 0SUANFU1 = ' + ' case 1suanfu1 = '-' Case 2suanfu1 = ' * ' Case 3suanfu1 = '/' End Selectshuruk.text = Shu3 + Suanfu1text1.text = "" End subprivate Sub Tuige_click () If Text1.Text = "" thenexit subend Iftext1.text = left (Text1.Text, Len (Text1.Text)-1) End SubPrivate Sub Xianshi_click () End Sub
Run:
Download: Modern Calculator
@ Mayuko
Modern calculator-Experience WINDOWS10 's calculator in advance