Lm th? no ? thay ?i mau nn cho m?t h?nh th?c ph? huynh MDI, Visual Basic .net ho?c trong Visual Basic 2005

D?ch tiu ? D?ch tiu ?
ID c?a bi: 319417 - Xem s?n ph?m m bi ny p d?ng vo.
Bung t?t c? | Thu g?n t?t c?

? Trang ny

TM T?T

Bi vi?t b?c ny ch?ng t? lm th? no ? l?p tr?nh c th? thay ?i mau nn cho m?t h?nh th?c ph? huynh nhi?u ti li?u giao di?n (MDI) b?ng cch s? d?ng Visual Basic .net ho?c Visual Basic 2005.

Khi b?n s? d?ng m?t h?nh th?c Windows nh l m?t h?nh th?c ph? huynh MDI, cc n?n ?ng d?ng mu thi?t l?p ? Windows Control Panel, khng thu?c tnh c?a h?nh th?c BackgroundColor , xc ?nh mau nn c?a bi?u m?u. Cc b?c sau y ch?ng minh lm th? no ? l?p tr?nh c th? thay ?i mau nn c?a h?nh th?c ph? huynh MDI ?n mu s?c khc.

T?o m?t ?ng d?ng Windows m?u b?ng cch s? d?ng Visual Basic .net ho?c Visual Basic 2005

  1. T?o m?t ?ng d?ng m?i Visual Basic .net ho?c Visual Basic 2005 Windows. Form1 ?c t?o ra theo m?c ?nh.

    Lu ? M? nn ?c thay ?i trong Visual Basic 2005. N?u b?n t?o ra m?t biu mu mi tn l Form1 vo nm 2005 Visual Basic, b?n c m?t t?p tin Form1.vb cho m? c?a b?n v m?t t?p tin Form1.Designer.vb c ch?a cc ph?n t? ?ng t?o ra. Cc h?nh th?c Windows nh thi?t k? s? d?ng cc t? kha m?t ph?n ? th?c hi?n Form1 phn chia thnh hai t?p tin ring bi?t. Hnh vi ny ngn c?n cc nh thi?t k? pht ra m? ?c xen k? v?i m? c?a b?n.

    ? bi?t thm chi ti?t v? m?i c?i ti?n ngn ng? Visual Basic 2005, gh thm Web site sau c?a Microsoft:
    http://MSDN.Microsoft.com/en-US/Library/ms379584 (vs.80) .aspx
    ? bi?t thm chi ti?t v? cc l?p h?c ph?n v cc nh thi?t k? h?nh th?c Windows, gh thm Web site sau c?a Microsoft:
    http://MSDN.Microsoft.com/en-US/Library/ms171843.aspx
  2. B?m vo cc h?nh th?c, v sau , vo tr?nh n View , ch?n C?a s? Properties ? xem thu?c tnh c?a cc h?nh th?c.
  3. Thi?t l?p cc ti s?n BackColor ? mu s?c m b?n mu?n (v d? nh robot).
  4. Thi?t l?p cc ti s?n IsMDIContainer ? ng s? th?t. Lu ? r?ng mau nn c?a cc h?nh th?c ? thay ?i mu s?c mu n?n ?ng d?ng ?c thi?t l?p ? trong Panel iu khin.
  5. Thi?t l?p cc ti s?n WindowState ? Maximized.
  6. B?m p vo bi?u m?u ? xem c?a s? m? c?a n.
  7. Dn o?n m? sau vo b? B? x? l bi?n c? t?i cc h?nh th?c:
    Dim ctl As Control
    Dim ctlMDI As MdiClient
    
    ' Loop through all of the form's controls looking
    ' for the control of type MdiClient.
    For Each ctl In Me.Controls
        Try
            ' Attempt to cast the control to type MdiClient.
            ctlMDI = CType(ctl, MdiClient)
    
            ' Set the BackColor of the MdiClient control.
            ctlMDI.BackColor = Me.BackColor
    
        Catch exc As InvalidCastException
            ' Catch and ignore the error if casting failed.
        End Try
    Next
    
    ' Display a child form to show this is still an MDI application.
    Dim frm As New Form2()
    frm.MdiParent = Me
    frm.Show()
    					
  8. Trn tr?nh n d? n , nh?p Thm Windows m?u.
  9. Ch?p nh?n tn m?c ?nh Form2.vb, v sau nh?n Open.
  10. Nh?n F5 ? ch?y cc ?ng d?ng.
Lu ? r?ng cc h?nh th?c ph? huynh MDI t?i v c m?t n?n mu xanh nh sng.

THAM KH?O

MdiClient l?p
B?t ?ng s?n Control.BackColor

Thu?c tnh

ID c?a bi: 319417 - L?n xem xt sau cng: 05 Thang Bay 2012 - Xem xt l?i: 3.0
p d?ng
  • Microsoft Visual Basic .NET 2002 Standard Edition
  • Microsoft Visual Basic .NET 2003 Standard Edition
  • Microsoft Visual Basic 2005
T? kha:
kbvs2005swept kbvs2005applies kbhowtomaster kbmt KB319417 KbMtvi
My d?ch
QUAN TRONG: Bi vi?t ny ?c d?ch b?ng ph?n m?m d?ch my c?a Microsoft ch? khng ph?i do con ng?i d?ch. Microsoft cung c?p cc bi vi?t do con ng?i d?ch v c? cc bi vi?t do my d?ch ? b?n c th? truy c?p vo t?t c? cc bi vi?t trong C s? Ki?n th?c c?a chng ti b?ng ngn ng? c?a b?n. Tuy nhin, bi vi?t do my d?ch khng ph?i lc no c?ng hon h?o. Lo?i bi vi?t ny c th? ch?a cc sai st v? t? v?ng, c php ho?c ng? php, gi?ng nh m?t ng?i n?c ngoi c th? m?c sai st khi ni ngn ng? c?a b?n. Microsoft khng ch?u trch nhi?m v? b?t k? s? thi?u chnh xc, sai st ho?c thi?t h?i no do vi?c d?ch sai n?i dung ho?c do ho?t ?ng s? d?ng c?a khch hng gy ra. Microsoft c?ng th?ng xuyn c?p nh?t ph?n m?m d?ch my ny.
Nh?p chu?t vo y ? xem b?n ti?ng Anh c?a bi vi?t ny: 319417

Cung cp Phan hi

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com