Come da titolo vorrei modificare le proprietà x e y dei controlli di un form
ho usato questo
dim txt as Control
FOR EACH txt IN ME.Controls
Object.Class(txt).x = Object.Class(txt).x * percentuale
NEXT
ma mi riporta errore poichè non conosce la proprietà x in class
dove sbaglio?
grazie
Quindi dovrebbe essere così?
dim txt as Control
FOR EACH txt IN ME.Controls
txt.x = txt.x * percentuale
NEXT
al momento non ho gambas sottomano ..
ok
volevo ridimensionare automaticamente tutti gli oggetti di un form quando ridimensiono il form stesso
se ne è già parlato, ma volevo provarci io
comunque questa sera do un occhio
VBox e HBox sinceramente non li ho ben capiti
EDIT:
lo so che non è la strada giusta ma mi è venuta fuori una cosa simile
' Gambas class file
PUBLIC x_old AS Integer
PUBLIC y_old AS Integer
PUBLIC x_new AS Integer
PUBLIC y_new AS Integer
PUBLIC x_percent AS Single
PUBLIC y_percent AS Single
PUBLIC SUB Form_Open()
x_old = ME.Width
y_old = ME.Height
END
PUBLIC SUB Form_Resize()
DIM txt AS control
x_new = ME.Width
y_new = ME.Height
x_percent = x_new / x_old
y_percent = y_new / y_old
x_old = x_new
y_old = y_new
FOR EACH txt IN ME.Controls
IF txt.name <> "FMain" THEN
txt.x = txt.x * x_percent
txt.y = txt.y * y_percent
txt.width = txt.width * x_percent
txt.height = txt.height * y_percent
ENDIF
NEXT
END