non ho capito scusa... comunque mi sono dimenticato di dirvo che la structure è in un modulo...
vi posto il codice, ancora in fase di costruzione:
codice:
Structure Etichetta
Structure Linea
Dim PuntoIni As Point
Dim PuntoFine As Point
End Structure
Dim Testo As String
Dim Valore As String
Dim SizeTesto As SizeF
Dim SizeValore As SizeF
Dim PuntoTesto As Point
Dim PuntoValore As Point
Dim Sottolineato As Linea
Dim FontTesto As Font
Dim FontValore As Font
End Structure
Public arrEt As Etichetta()
Sub CreaArrEt(ByVal grp As Graphics, ByVal bmp As Bitmap)
Dim strTesto As String, arrTesto() As String, arrT() As String
Dim i As Int32, nArr As Int32, pntX As Int32, pntY As Int32, pntValX As Int32
Dim Controllo As TextBox
Dim fStyle As FontStyle, gpcUnit As GraphicsUnit = GraphicsUnit.Pixel
pntX = 5 : pntY = 5 : strTesto = "ARTICOLO,0,0;VARIANTE,0,0;TAGLIA,1,1;PREZZO,1,1" : arrTesto = strTesto.Split(";")
For i = 0 To arrTesto.GetUpperBound(0)
ReDim Preserve arrEt(nArr)
arrT = arrTesto(i).Split(",")
With arrEt(nArr)
.Testo = arrT(0) & ":"
Controllo = Form1.Controls("txt" & arrT(0))
.Valore = Controllo.Text
Controllo = Nothing
.FontTesto = New Font("Verdana", 10, FontStyle.Regular, GraphicsUnit.Pixel)
.SizeTesto = grp.MeasureString(arrEt(nArr).Testo, arrEt(nArr).FontTesto)
Select Case arrT(1)
Case "0"
fStyle = FontStyle.Regular
.FontValore = New Font("Verdana", 10, fStyle, gpcUnit)
Case "1"
fStyle = FontStyle.Bold
.FontValore = New Font("Verdana", 12, fStyle, gpcUnit)
End Select
.SizeValore = grp.MeasureString(.Valore, .FontValore)
.PuntoTesto = New Point(pntX, pntY)
pntValX = .SizeTesto.Width + .PuntoTesto.X + 5
.PuntoValore = New Point(pntValX, .PuntoTesto.Y)
.Sottolineato.PuntoIni = New Point(pntValX, .PuntoValore.Y - 2)
End With
nArr = nArr + 1
Next
End Sub
strtesto contiene:
- descrizione di ogni valore (il nome del controllo nel form è uguale);
- se è un campo importante: 0 - non lo è; 1 lo è;
- se il campo occupa tutta la riga o solo metà: 0 tutta la riga, 1 occupa metà riga.
Ovviamente, se è 1 il prossimo campo che ha 1 dovrà andare a riempire lo spazio vuoto. se non ce ne sono più di 1 l'ultimo campo impostato a 1 diventerà 0...
capito adesso che cosa voglio fare???
lo sò, sono contorto...