Topic: proportional increase of tablegrids
I improved this solution that I found here on the forum, which increases or decreases the size of several tablegrids in the same form, whenever the screen resolution is changed (MVD 5.6). As already said in the forum, MVD presents problems with expanding the size of several tablegrids in the same form.
In the image, there is a table containing different screen resolutions and the respective adjustment factors, which will be applied to the width and height of a tablegrid, to increase or reduce its size, depending on the chosen resolution.
//*** armazena altura e largura atual da tela
form1.Edit_altura_tela.value := screen.height;
form1.Edit_largura_tela.value := screen.Width;
//*** localiza em tabela altura e largura atual da tela e traz fatores de ajuste em caso de resize
form1.Edit_fator_altura.value := sqlexecute('select altura_fator from monitorsizes where tela_altura = "'+form1.edit_altura_tela.text+'"');
form1.Edit_fator_largura.value := sqlexecute('select largura_fator from monitorsizes where tela_largura = "'+form1.edit_largura_tela.text+'"');
//*** se altura ou largura não for encontra na tabela, avisa e fecha formulário
if (form1.Edit_fator_altura.value <= 0) or (form1.Edit_fator_largura.value <= 0) then begin
showmessage('Tamanho de largura e altera de tela não encontrado - reinicie'); form1.close; end;
//*** converte fatores em percentuais
form1.Edit_fator_altura.value := form1.Edit_fator_altura.value / 100;
form1.Edit_fator_largura.value := form1.Edit_fator_largura.value / 100;
................
//ajusta tamanho e posição dos tablegris com base nos fatores e adicionando espaços (variaáveis)
form1.TableGrid_1.Width := round(form1.TableGrid_1.width * form1.Edit_fator_largura.value);
form1.TableGrid_1.Height := round(form1.TableGrid_1.Height * form1.Edit_fator_altura.value);
form1.TableGrid_2.Width := round(form1.TableGrid_2.width * form1.Edit_fator_largura.value);
form1.TableGrid_2.Height := round(form1.TableGrid_2.Height * form1.Edit_fator_altura.value);
form1.TableGrid_3.Width := round(form1.TableGrid_3.width * form1.Edit_fator_largura.value);
form1.TableGrid_3.Height := round(form1.TableGrid_4.Height * form1.Edit_fator_altura.value);
form1.TableGrid_4.Width := round(form1.TableGrid_4.width * form1.Edit_fator_largura.value);
form1.TableGrid_4.Height := round(form1.TableGrid_4.Height * form1.Edit_fator_altura.value);