Posto niko ne odgovara red je da ja odgovorim. Malo sam se namucio. Evo.Uradio sam da moze i da se upisuje i tekst, brojevi slova u celije i da se brise sa backspace i da se u fiksni red, fiksna kolona ispisuje braon bojom za aktivnu celiju, kao u excellu. Dalje dopuni sam.
'Autor: Rajko Kuzmanovic
Option Explicit
Public red As Integer
Public kolona As Integer
Public redmemo As Integer
Public kolonamemo As Integer
Private Sub Form_Load()
Dim n As Integer
MSHFlexGrid1.Cols = 10
MSHFlexGrid1.Rows = 10
MSHFlexGrid1.BackColorFixed = RGB(239, 235, 222) 'Fiksne redove ispisuje bojom kao u excellu
For n = 1 To MSHFlexGrid1.Cols - 1
MSHFlexGrid1.TextMatrix(0, n) = Chr(Asc("A") + n - 1)
Next n
For n = 1 To MSHFlexGrid1.Rows - 1
MSHFlexGrid1.TextMatrix(n, 0) = n
Next n
End Sub
Private Sub MSHFlexGrid1_Click()
red = MSHFlexGrid1.Row
kolona = MSHFlexGrid1.Col
'Brisanje prethodno obelezenih bocnih fiksnih kolona
If redmemo > 0 And kolonamemo > 0 Then
MSHFlexGrid1.Col = 0
MSHFlexGrid1.Row = redmemo
MSHFlexGrid1.CellBackColor = RGB(239, 235, 222)
MSHFlexGrid1.Col = kolonamemo
MSHFlexGrid1.Row = 0
MSHFlexGrid1.CellBackColor = RGB(239, 235, 222)
End If
'MSHFlexGrid1.BackColorFixed = RGB(239, 235, 222) 'Brise fiksne redove belom bojom
MSHFlexGrid1.Row = red
MSHFlexGrid1.Col = kolona
'Obelezavanje bocnih fiksnih kolona
MSHFlexGrid1.Col = 0
MSHFlexGrid1.Row = red
MSHFlexGrid1.CellBackColor = RGB(255, 192, 111)
MSHFlexGrid1.Col = kolona
MSHFlexGrid1.Row = 0
MSHFlexGrid1.CellBackColor = RGB(255, 192, 111)
MSHFlexGrid1.Row = red
redmemo = red
kolonamemo = kolona
End Sub
Private Sub MSHFlexGrid1_KeyPress(KeyAscii As Integer)
If KeyAscii = 8 Then
If Len(MSHFlexGrid1.Text) > 0 Then
MSHFlexGrid1.Text = Left(MSHFlexGrid1.Text, Len(MSHFlexGrid1.Text) - 1)
End If
End If
If KeyAscii > 31 Then
MSHFlexGrid1.Text = MSHFlexGrid1.Text & Chr(KeyAscii)
End If
End Sub
https://www.mycity.rs/must-login.png
|