Cov txheej txheem:

Yuav Ua Li Cas Los Ua Ke Trackbar Rau Hauv Visual Basic: 3 Kauj Ruam
Yuav Ua Li Cas Los Ua Ke Trackbar Rau Hauv Visual Basic: 3 Kauj Ruam

Video: Yuav Ua Li Cas Los Ua Ke Trackbar Rau Hauv Visual Basic: 3 Kauj Ruam

Video: Yuav Ua Li Cas Los Ua Ke Trackbar Rau Hauv Visual Basic: 3 Kauj Ruam
Video: yuav tuag los ua cas 2024, Hlis ntuj nqeg
Anonim
Yuav ua li cas koom ua ke Trackbar rau hauv Visual Basic
Yuav ua li cas koom ua ke Trackbar rau hauv Visual Basic

OK, yog li qhov no yooj yim tab sis cov pib muaj noidea kiag li yuav ua li cas. Trackbars tuaj yeem yog cov cuab yeej muaj txiaj ntsig. Los ntawm kev txiav txim siab pob peev los xaiv seb muaj pes tsawg lub foob pob hluav taws kom tawg, siv cov trackbars yooj yim heev.

NCO TSEG: Puas muaj leej twg paub yuav ua li cas nce tus naj npawb ntawm cov chaw ntawm tus trackbar? Kuv tsuas tuaj yeem tau txais 11…

Kauj Ruam 1: Npaj Koj Daim Ntawv Npaj

Npaj Koj Daim Ntawv Npaj
Npaj Koj Daim Ntawv Npaj

Qhov no yooj yim zoo nkauj. Ua thaum koj xav kom koj qhov program zoo li. Kuv tsis ua dab tsi tshwj xeeb. Kuv yuav ua qee yam uas hloov xim ntawm lub thawv ntawv. == Tsis txhob hnov qab ntxiv lub trackbar !!! == Yog, ntau tus neeg tsis nco qab qhov ntawd

Kauj ruam 2: Code

Code!
Code!

Yog li koj, tau ua tiav koj li kev siv tus neeg siv, tam sim no yog dab tsi? Code ntawm chav kawm !! Ob npaug nias lub trackbar. 2 kab ntawm cov cai yuav tsum tshwm sim. Tej yam zoo li:

Tus kheej Sub TrackBar1_Scroll (ByVal xa raws li System. Object, ByVal e Raws li System. EventArgs) Ua Haujlwm TrackBar1. Scroll End SubTam sim no peb kawm txog qhov muaj nqis. Ntawm kab kab no peb tsuas tuaj yeem tau txais 11 qhov tseem ceeb, 0-10. Tus nqi 0 yog sab laug heev thaum tus nqi 10 yog txoj cai heev. Tau qhov ntawd? Cia peb txav mus ntxiv.

Txhawm rau ua lub neej yooj yim dua txhua cov ntawv hauv cov kauj ruam no txij tam sim no mus yuav yog tus qauv

Hauv nruab nrab ntawm ob kab ntawm cov cai hauv: Yog TrackBar1. Value = placceavaluenumberhere ThenEnd Ifreplacing placeavaluenumberhere nrog tus lej tus lej ntawm qhov chaw koj xav kom nws nyob. Tam sim no nyob nruab nrab ntawm 4 kab ntawm tus lej yam koj xav ua. Hauv qhov no: TextBox1. BackColor = Color. BlackOnce koj & aposre ua qhov ntawd rov rau txhua qhov chaw. Thaum kuv ua tiav nws zoo li qhov no: Private Sub TrackBar1_Scroll (ByVal xa raws li System. Object, ByVal e Raws li System. EventArgs) Ua haujlwm TrackBar1. Scroll Yog TrackBar1. Value = 0 Tom qab ntawv TextBox1. BackColor = Color. Black kawg Yog TrackBar1. Tus nqi = 1 Tom qab ntawv TextBox1. BackColor = Color. White End Yog Tias TrackBar1. Value = 2 Ces TextBox1. BackColor = Color. Red End Yog Tias TrackBar1. Value = 3 Then TextBox1. BackColor = Color. Blue End Yog Tias TrackBar1. Value = 4 Tom qab ntawv TextBox1. BackColor = Color. Yellow End Yog Tias TrackBar1. Value = 5 Ces TextBox1. BackColor = Color. Purple End Yog Tias TrackBar1. Value = 6 Then TextBox1. BackColor = Color. Green End Yog Tias TrackBar1. Value = 7 Ces TextBox1. BackColor = Color. Orange End If TrackBar1. Value = 8 Then TextBox1. BackColor = Color. Brown End If TrackBar1. Value = 9 Then TextBox1. BackColor = Color. White End If TrackBar1. Value = 10 Then TextBox1. BackColor = Color. White End Yog End Sub

Kauj ruam 3: Ua tiav

Ua tiav!
Ua tiav!

Zoo, kuv yog lawm. Yog tias koj tsis tau ua tiav koj txoj haujlwm, tom qab ntawd mus txuas ntxiv. Auj, thiab hmoov zoo! Thiab yog tias koj xav tsis thoob, cov cai rau rov pib dua thiab kaw yog:

Private Sub Button2_Click (ByVal sender As System. Object, ByVal e As System. EventArgs) Handles Button2. Click End End Sub Private Sub Button1_Click (ByVal sender As System. Object, ByVal e As System. EventArgs) Handles Button1. Click TrackBar1. Value = 0 End Sub

Pom zoo: