views:

67

answers:

1

I have started to use DevExpress LayoutControl a bit. It feels powerful but I don't get it as I want. I want to set a minwidth and minheight of components as you can't have a dialog real small and it still look good. At the same time I want to let the user have arbitrary big size and let the components have equal share of the width and height. And I don't want any scrollbars. How can I accomplish that ?

And one thing. I still use the old version 6.38 of Devexpress due to other circumstances. IS there many bugs fixed in the recent versions of the LayoutControl? Could it be this that stop me ?

/Roland

A: 

I don't think you can specify minimal height/width of controls in LayoutControl. You could of course use the standard constraints property, it will work, but will look ugly.

The question though is what exactly are you trying to achieve ? LayoutControl attempts to adjust it's controls sizes so that everything fits as well as possible. With many controls packed in too little space the scrollbars appear, but what else can happen ?

The key to setting up a nice resizable layout is to adjust the AlignHoriz and AlignVert properties of layout items/groups. Set these to ahClient/avClient for controls that are resizable, like say a Memo or a Grid. Also you generally want the the LayoutControls's AutoContentSizes to be [acsWidth,acsHeight]

And speaking of versions, I would recommend you upgrade to latest build and try the LayoutControl V2, which has some additional features compared to v1 such as support for splitters and tabs.

Here's an example of a simple form that resizes logically, you can paste it to an empty form:

object dxLayoutControl1: TdxLayoutControl
  Align = alClient
  AutoContentSizes = [acsWidth, acsHeight]
  object Edit1: TEdit
    BorderStyle = bsNone
  end
  object Button1: TButton
  end
  object Memo1: TMemo
    BorderStyle = bsNone
  end
  object dxLayoutControl1Group_Root: TdxLayoutGroup
    ShowCaption = False
    Hidden = True
    ShowBorder = False
    object dxLayoutControl1Group1: TdxLayoutGroup
      AutoAligns = [aaHorizontal]
      AlignVert = avClient
      object dxLayoutControl1Group2: TdxLayoutGroup
        ShowCaption = False
        Hidden = True
        LayoutDirection = ldHorizontal
        ShowBorder = False
        object dxLayoutControl1Item1: TdxLayoutItem
          AutoAligns = [aaVertical]
          AlignHorz = ahClient
          Control = Edit1
        end
        object dxLayoutControl1Item2: TdxLayoutItem
          ShowCaption = False
          Control = Button1
          ControlOptions.ShowBorder = False
        end
      end
      object dxLayoutControl1Item3: TdxLayoutItem
        AutoAligns = [aaHorizontal]
        AlignVert = avClient
        Control = Memo1
      end
    end
  end
end

Hope it helps

Daniel Maurić