[Correction] Do you want MSFLEXGRID controls to edit? ? ?

zhaozj2021-02-08  215

Is the content of each cell grid in the MSFlexGrid control, but we can pass some small skills

It is easy to implement this editing function to extend the application of MSFlexGrid (this is a very common function in practical applications).

You only need to make the function of editing the MSFlexGrid control data by pressing the following.

In the form, put a text box text1, and a MSFLEXGRID control FlexGrid1

Add to the following code

Private sub flow_load ()

TEXT1.MOVE-10000, -10000, 1, 1

End Sub

Private sub msflexgrid1_entercell ()

MSFLEXGRID1.CellbackColor = VBBLUE

MSFLEXGRID1.CellForeColor = VBWHITE

TEXT1.TEXT = MSFLEXGRID1.TEXT

TEXT1.SELSTART = 0

TEXT1.SELLENGTH = LEN (Text1.Text)

End Sub

Private Sub MsflexGrid1_leavecell ()

MSFLEXGRID1.CellbackColor = VBWHITE

MSFLEXGRID1.CellForeColor = VBBLUE

End Sub

Private sub msflexgrid1_mousedown (Button As Integer, Shift As Integer, x as single, y as single)

Text1.setfocus

End Sub

Private sub text1_change ()

MsflexGrid1.text = text1.text

End Sub

Private sub text1_keydown (Keycode As Integer)

Select Case Keycode

Case VBKEYEFT, VBKEYRIGHT, VBKEYUP, VBKEYDOWN

Keycode = 0

End SELECT

End Sub

OK, such an editable MSFLEXGRID control is complete, simple!!

http://ngsoft.shangdu.net

转载请注明原文地址:https://www.9cbs.com/read-2616.html

New Post(0)