Jump to content
chicheater

[Resolvido] Dimenções diferentes com o mesmo Programa

Recommended Posts

chicheater

Eu estou a desenvolver um pequeno programa em VB 2010 express.

Problema:

Quando eu exprimento o meu programa num pc com outra resolução diferente

os botões, pictureboxes, labels, etc..., não ficam no mesmo sitio.

Possivel Solução:

Fixar os objectos em "quadrados" (alguma especie de colunas e linhas tipo uma tabela),

fazendo assim os objectos moverem-se comforme esses "quadrados".

Pergunta:

Existe alguma coisa assim??

Algum patch ou alguma coisa???

Outras Informações:

Já tentei com o anchor mas não funciona, os objectos continuam a mudar de sitio.

Desde já obrigado pela contribuição


When a person die a ghost will born

Share this post


Link to post
Share on other sites
chicheater

Epa nao da pa dares um exemplo é que eu nao tou a conceguir fazer isso,

já pus o panel  mas nao concegui fazer na mesma

desde já obrigado


When a person die a ghost will born

Share this post


Link to post
Share on other sites
Caça

Utiliza um SplitCountainers ou um TableLayoutPanel


Pedro Martins

Não respondo a duvidas por PM

Share this post


Link to post
Share on other sites
chicheater

Utiliza um SplitCountainers ou um TableLayoutPanel

Axo que isso vai dar ao mesmo que o Skulltrail disse, não??

e eu queria um exemplo(codigo ou algo do genero) para fazer isso


When a person die a ghost will born

Share this post


Link to post
Share on other sites
Skulltrail

Epa nao da pa dares um exemplo é que eu nao tou a conceguir fazer isso,

já pus o panel  mas nao concegui fazer na mesma

desde já obrigado

Public Class Form1
    Inherits System.Windows.Forms.Form

    Private components As System.ComponentModel.IContainer

    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub

    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.Panel1 = New System.Windows.Forms.Panel()
        Me.ComboBox1 = New System.Windows.Forms.ComboBox()
        Me.PictureBox1 = New System.Windows.Forms.PictureBox()
        Me.Button1 = New System.Windows.Forms.Button()
        Me.Label1 = New System.Windows.Forms.Label()
        Me.Panel1.SuspendLayout()
        CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.SuspendLayout()
        '
        'Panel1
        '
        Me.Panel1.Controls.Add(Me.ComboBox1)
        Me.Panel1.Controls.Add(Me.PictureBox1)
        Me.Panel1.Controls.Add(Me.Button1)
        Me.Panel1.Controls.Add(Me.Label1)
        Me.Panel1.Location = New System.Drawing.Point(5, 5)
        Me.Panel1.Name = "Panel1"
        Me.Panel1.Size = New System.Drawing.Size(300, 300)
        Me.Panel1.TabIndex = 0
        '
        'ComboBox1
        '
        Me.ComboBox1.FormattingEnabled = True
        Me.ComboBox1.Location = New System.Drawing.Point(60, 190)
        Me.ComboBox1.Name = "ComboBox1"
        Me.ComboBox1.Size = New System.Drawing.Size(165, 21)
        Me.ComboBox1.TabIndex = 3
        '
        'PictureBox1
        '
        Me.PictureBox1.BackColor = System.Drawing.SystemColors.ActiveCaption
        Me.PictureBox1.Location = New System.Drawing.Point(160, 95)
        Me.PictureBox1.Name = "PictureBox1"
        Me.PictureBox1.Size = New System.Drawing.Size(110, 80)
        Me.PictureBox1.TabIndex = 2
        Me.PictureBox1.TabStop = False
        '
        'Button1
        '
        Me.Button1.Location = New System.Drawing.Point(35, 110)
        Me.Button1.Name = "Button1"
        Me.Button1.Size = New System.Drawing.Size(75, 23)
        Me.Button1.TabIndex = 1
        Me.Button1.Text = "Button1"
        Me.Button1.UseVisualStyleBackColor = True
        '
        'Label1
        '
        Me.Label1.Font = New System.Drawing.Font("Microsoft Sans Serif", 27.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label1.Location = New System.Drawing.Point(95, 20)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(120, 45)
        Me.Label1.TabIndex = 0
        Me.Label1.Text = "Teste"
        '
        'Form1
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(784, 562)
        Me.Controls.Add(Me.Panel1)
        Me.Name = "Form1"
        Me.Text = "Form1"
        Me.Panel1.ResumeLayout(False)
        CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).EndInit()
        Me.ResumeLayout(False)

    End Sub

    Friend WithEvents Panel1 As System.Windows.Forms.Panel
    Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox
    Friend WithEvents Button1 As System.Windows.Forms.Button
    Friend WithEvents Label1 As System.Windows.Forms.Label

    Private LarguraForm, AlturaForm As Int32

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        With Me
            .CenterToScreen()
            .Text = "Teste"
            .MaximumSize = New System.Drawing.Size(800, 600)
            .MinimumSize = New System.Drawing.Size(800, 600)
            .FormBorderStyle = Windows.Forms.FormBorderStyle.FixedSingle
        End With

        With ComboBox1
            .Items.AddRange(New Object() {"800 * 600", "1280 * 720"})
            .Text = "800 * 600"
        End With

    End Sub

    Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged

        If Me.ComboBox1.Text = "800 * 600" Then
            With Me
                .CenterToScreen()
                .Width = 800
                .Height = 600
                .MaximumSize = New System.Drawing.Size(800, 600)
                .MinimumSize = New System.Drawing.Size(800, 600)
            End With
        ElseIf Me.ComboBox1.Text = "1280 * 720" Then
            With Me
                .CenterToScreen()
                .Width = 1280
                .Height = 720
                .MaximumSize = New System.Drawing.Size(1280, 720)
                .MinimumSize = New System.Drawing.Size(1280, 720)
            End With
        End If

    End Sub

    Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize

        Me.CenterToScreen()
        Panel1.Location = New System.Drawing.Point((Me.Width - 300) / 2, (Me.Height - 300) / 2)
        Me.Refresh()

    End Sub
End Class

Espero ter ajudado :)


"Sem o esforço da luta,será impossivel a alegria da vitória"João Gonçalo Silva

Share this post


Link to post
Share on other sites
chicheater

Muito Obrigado :)

vou testar já te digo alguma coisa :P


When a person die a ghost will born

Share this post


Link to post
Share on other sites
chicheater

Problema Resolvido obrigado a todos os que colaboraram :)


When a person die a ghost will born

Share this post


Link to post
Share on other sites
ribeiro55

A comunidade trata de entreajuda.

Convém que exponhas a solução que encontraste :)


Sérgio Ribeiro


"Great coders aren't born. They're compiled and released"
"Expert coders do not need a keyboard. They just throw magnets at the RAM chips"

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.