我现在很乐意在IB中使用自动调整掩码,但有两种自动调整设置,我不清楚它们是如何区别的:
使用上下锚点设置1自动
调整大小http://dl.dropbox.com/u/11270323/stackoverflow/autosize-mask-0.png
仅使用uppper锚设置2自动
调整http://dl.dropbox.com/u/11270323/stackoverflow/autosize-mask-1.png
一些背景.使用这些设置的UIView子类是子子视图.设置1给了我想要的行为 - 子视图使用其父视图扩展/收缩 - 而设置2以非显而易见的方式略有不同.
这两种设置之间的预期布局差异是什么?
谢谢,
道格
我的观点有错误的维度.我正在运行景观,但视图报告纵向尺寸"查看宽度= 768.000000高度= 1024.000000"任何想法如何解决?我玩过我试过的自转器
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft|| interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
Run Code Online (Sandbox Code Playgroud)
和
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return YES;
}
Run Code Online (Sandbox Code Playgroud)
它在视图上看起来很好,但尺寸确实与我的应用程序混乱.
有没有办法避免它?
如果我的文字是"Blablabla"并且它不适合广场,我不希望有类似的东西:
Blabla-
bla
我希望"Blablabla"的字体更小.有没有办法控制自动调整TextView是否会分割单词?
以下是该问题的一个示例:
那里有最小的文本大小1sp,所以很明显这个词可以适应减小的文本大小.
我有一个winform,我在那个表单中放置了一个列表框.当我最大化winform时,列表框的大小保持不变.
但我不想这样.我想自动调整大小.
这有什么默认属性吗?
谢谢你,Nagu
我正在使用WinForms在C#中创建GUI .
我试图将programaticaly创建的面板放在另一个下面.由于这些面板的内容可能会根据其内容而有所不同,我正在使用WinForms执行正确的大小调整.Panel.AutoSize
问题是:如果我在填充后立即使用Panel.Height(或Panel.Size.Height)Panel,则返回的值始终是我的默认值.调整大小确实发生了,正如我在启动应用程序时所看到的那样,但我只是不知道何时.
这是我正在做的简化版本:
this.SuspendLayout();
int yPos = 0;
foreach (String entry in entries)
{
Panel panel = new Panel();
panel.SuspendLayout();
panel.AutoSize = true;
panel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowOnly;
panel.BackColor = System.Drawing.SystemColors.Window; // Allows to see that the panel is resized for dispay
panel.Location = new System.Drawing.Point(0, yPos);
panel.Size = new System.Drawing.Size(this.Width, 0);
this.Controls.Add(panel);
Label label = new Label();
label.AutoSize = true;
label.Location = new System.Drawing.Point(0, 0);
label.MaximumSize = new …Run Code Online (Sandbox Code Playgroud) 我正在尝试设置iOS 8自动调整大小单元UICollectionViewController:
我使用StoryBoards创建了一个基本设计,并设计了一个UICollectionViewCell,其标签约束到单元格的边界.然后,我将该单元格的标签链接到Cell的类,以便能够以编程方式访问它.
没有指定estimatedItemSize,一切正常(当然除了自动调整大小).
当我指定estimatedItemSize这种方式时:
- (void)viewDidLoad {
[super viewDidLoad];
UICollectionViewFlowLayout *layout = (UICollectionViewFlowLayout *)self.collectionViewLayout;
layout.estimatedItemSize = CGSizeMake(100.0f, 30.0f);
}
Run Code Online (Sandbox Code Playgroud)
应用程序崩溃时出现以下错误消息:
the behavior of the UICollectionViewFlowLayout is not defined because:
the item width must be less than the width of the UICollectionView minus the section insets left and right values.
Please check the values return by the delegate.
Run Code Online (Sandbox Code Playgroud)
我想,我estimatedItemSize在错误的地方设置,或者,如果我已经在故事板中设置了指定的项目大小,那么它与估计的大小有某种冲突.
在下面的XAML中,按钮将拉伸以适合窗口的宽度,包括在调整窗口大小时.但是,TextBlock和蓝色框居中.你将如何改变它:1)TextBlock在Button内,但左边是实际的Button宽度(即在Window的左侧)2)Canvas在Button内部,但是右对齐实际按钮宽度(即窗口右侧)
似乎"HorizontalAlignment = Stretch"在这种情况下不起作用,并且,当使用自动调整大小时,Button内的网格只会增长到其内容所需的最小宽度.
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Name="Window"
Title="test"
Width="640" Height="480">
<Grid x:Name="LayoutRoot">
<Button Height="30">
<Grid HorizontalAlignment="Stretch">
<TextBlock Text="Sample Text" HorizontalAlignment="Stretch" TextAlignment="Left"></TextBlock>
<Canvas Width="40" Background="AliceBlue" HorizontalAlignment="Right"></Canvas>
</Grid>
</Button>
</Grid>
</Window>
Run Code Online (Sandbox Code Playgroud) 如何设置 WPF 控件来填充其父级容器中的可用空间,但不展开父级?
以下代码片段描述了我正在尝试的布局。我愿Grid伸以容纳Expander,我愿ListBox唯以填满Grid。我希望当太小而无法显示所有sListBox时,出现 的滚动条。GridListBoxItem
<ScrollViewer>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
</Grid.RowDefinitions>
<ListBox Grid.Row="0" Grid.Column="0" />
<Expander Grid.Row="0" Grid.Column="1" Header="Expander" />
</Grid>
</ScrollViewer>
Run Code Online (Sandbox Code Playgroud)
目前发生的情况是,Grid拉伸以适合整个ListBox,并且ScrollViewer出现了外部的垂直滚动条。我只希望当滚动条Expander变得太大而无法在屏幕上显示时出现。
我制作了一个 winform,其中包含一个 tabControl (3 个选项卡,也许以后会更多)。
在我的两个选项卡中,我有一个 listBoxView。
问题是,当我单击 fullSize 按钮时,tabControl 不会更改其大小。这就是一个可怕的窗户。
如何根据 winforms 边框大小定义 tabControl 的动态大小,以及基于 tabControl 大小的 listBoxView 的动态大小?
TabControl 必须适应表单大小,然后 tabControl 中的页面必须适应 tabControl 大小,然后,页面中的 listBox 必须适应其页面大小。
表格如下:
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1313, 614);
this.Controls.Add(this.tabControl1);
this.tabControl1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.tabPage1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.dgCSV)).EndInit();
this.tabPage2.ResumeLayout(false);
this.tabPage2.PerformLayout();
this.ResumeLayout(false);
Run Code Online (Sandbox Code Playgroud)
以及 tabControl 及其页面之一:
//
// tabControl1
//
this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Controls.Add(this.tabPage3);
this.tabControl1.Location = new System.Drawing.Point(13, 13);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(1288, 589); …Run Code Online (Sandbox Code Playgroud) 这可能有点延伸,但是有可能使用pythonwin或任何其他模块可以使用python脚本在MS Excel(或使用VBA的任何其他MS Office产品)中创建VBA.
这个想法来自于蟒蛇openpyxl模块无法进行列自动宽度.我在脚本中创建了一个工作簿,最终将其保存到光盘中.每张纸都有相当多的纸张,有很多列.我开始思考......如果我只是使用python将一个VBA脚本(保存在记事本中的某个地方)导入到excel中的VBA编辑器中,然后使用pythonwin从python运行该脚本.
就像是:
Workbooks.worksheets.Columns("A:Z").EntireColumn.Autofit
Run Code Online (Sandbox Code Playgroud)
在您发表评论之前,是的,我已经看到了很多关于如何解决openpyxl中自动调整列的pythonic示例,但我看到了一些有趣的机会,可以利用从VBA中获得的功能,可能在python中不可用.
无论如何,我在互联网上挖了一下,我没有看到任何表明我可以的东西,所以我想我会问.
干杯,迈克