Visual CSharp 1002005 A Developers Notebook [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Visual CSharp 1002005 A Developers Notebook [Electronic resources] - نسخه متنی

Jesse Liberty

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
توضیحات
افزودن یادداشت جدید







3.5. Create Split Windows


The new
SplitContainer control makes creating split windows in Windows Forms a snap.
The two panels can be side by side or one on top of the other, and
you can nest splitters one within another to further divide the form.


3.5.1. How do I do that?


Create a new Windows application, name it
SplitWindows, and drag a
SplitContainer control onto the form. Notice that
its default orientation is to split vertically. Click the smart tag,
and choose Horizontal Splitter Orientation.

Now you have two panels, top and bottom. Drag a second
SplitContainer control into the bottom panel.
Click in the bottom-left panel and set the background color to blue.
Click in the bottom-right panel and set the background color to red.
Then set the upper panel to green.

Run the application. The three panels are clearly visible, and when
you pass your cursor over the divisions, the cursor changes to the
splitter cursor, as shown in Figure 3-19.
(I've surrounded the cursor with a white box to make
it easy to find.)


Figure 3-19. The splitter windows


When you create a
SplitContainer
control, its Dock property is automatically set to
DockStyle.Fill. You can undo this to specify how
much space you want your splitter to take up or you can prefill a
portion of the form with a panel, and the splitter will take the
remaining room.

If you undock the splitter, you can move it about within the form
using the grab handles, as shown in Figure 3-20.


Figure 3-20. Moving the splitter



3.5.2. What about...


...restricting the size of the SplitContainer
control?

You can set the
Panel1MinSize or
Panel2MinSize properties to set the minimum size
of each panel. You can even stop resizing altogether by setting the
IsSplitterFixed property to TRue.

Normally, when you resize the window each panel is resized
proportionally. You can override that behavior, however, by setting
the FixedPanel property of one of the panels to
true. In that case, that panel will hold its size
when the form is resized, and the other panels will adjust
accordingly.


3.5.3. Where can I learn more?


For more information, see the MSDN article titled
"Split
Containers."


/ 71