object Form1: TForm1
  Left = 192
  Top = 114
  Width = 696
  Height = 480
  Caption = 'Form1'
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = False
  PixelsPerInch = 96
  TextHeight = 13
  object Panel1: TPanel
    Left = 0
    Top = 0
    Width = 185
    Height = 446
    Align = alLeft
    Caption = 'Panel1'
    TabOrder = 0
    object ComboBox62: TComboBox
      Left = 56
      Top = 360
      Width = 145
      Height = 21
      ItemHeight = 13
      TabOrder = 0
      Text = 'ComboBox62'
      OnChange = ComboBox62Change
    end
  end
  object Panel2: TPanel
    Left = 185
    Top = 0
    Width = 503
    Height = 446
    Align = alClient
    Caption = 'Panel2'
    TabOrder = 1
    object mygroupbox: TGroupBox
      Left = 1
      Top = 1
      Width = 501
      Height = 368
      Align = alTop
      Caption = 'mygroupbox'
      TabOrder = 0
    end
    object Button1: TButton
      Left = 200
      Top = 384
      Width = 75
      Height = 25
      Caption = 'Button1'
      TabOrder = 1
      OnClick = Button1Click
    end
  end
end--------------------------------------------------------------------------------
unit Unit1;interfaceuses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls;type
  TForm1 = class(TForm)
    Panel1: TPanel;
    Panel2: TPanel;
    mygroupbox: TGroupBox;
    Button1: TButton;
    ComboBox62: TComboBox;
    procedure Button1Click(Sender: TObject);
    procedure ComboBox62Change(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;var
  Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
var
  v_height:integer;
  nc_label:tlabel;
  nc_combobox1:tcombobox;
begin
    nc_label:=tlabel.Create(self);
    nc_label.Parent:=mygroupbox;
    nc_label.Caption:='v_cap';
    nc_label.top:=mygroupbox.Top+1*v_height+24;
    nc_label.left:=mygroupbox.left+24;
    nc_label.width:=150;
    nc_label.Height:=13;
    nc_label.Visible:=true;    nc_combobox1:=tcombobox.Create(self);
    nc_combobox1.Parent:=mygroupbox;
    nc_combobox1.Top:=mygroupbox.Top+1*v_height+16;
    nc_combobox1.left:=mygroupbox.left+216;
    nc_combobox1.width:=49;
    nc_combobox1.Height:=21;
    nc_combobox1.Items.Append('0');
    nc_combobox1.Items.Append('1');
    nc_combobox1.Items.Append('2');
    nc_combobox1.Items.Append('3');
    nc_combobox1.Items.Append('4');
    nc_combobox1.Items.Append('5');
    nc_combobox1.OnChange:=ComboBox62Change;
    nc_combobox1.Visible:=true;end;procedure TForm1.ComboBox62Change(Sender: TObject);
begin
//
end;end.

解决方案 »

  1.   

    感觉是你坐标定义的问题v_height没有初始化值,那么在delphi下 就是随机16位整数 很有可能超过你的屏幕
      

  2.   

      nc_label:=tlabel.Create(self);
      nc_label.Parent:=mygroupbox;  ????
      nc_label.Caption:='v_cap';
      nc_label.top:=mygroupbox.Top+1*v_height+24; ???
      nc_label.left:=mygroupbox.left+24;既然父是mygroupbox,为什么label的top/left是父top/left呢?
      

  3.   

    应该就是v_height的问题,改v_height=1,就可以了
      

  4.   

    nc_label.top:=1*v_height+24; 
      

  5.   

    看看v_height的值,是不是太大了,被覆盖了!