仍在和WPF一起玩弄,并在我学习的同时学习.现在尝试构建一个动态的控件分组(主要是按钮,但可能包括CheckBoxes和其他).
我不知道最好的方法是什么,所以我尝试创建ItemsControl样式,然后将项目添加到WrapPanel内的ItemsPresenter中.很快意识到这些项目不会换行,因为它们实际上不在WrapPanel中,除非我把它作为ItemsHost.像这样:
<Style x:Key="ButtonPanelGroup" TargetType="{x:Type ItemsControl}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ItemsControl}">
<Border CornerRadius="5"
BorderBrush="{StaticResource DarkColorBrush}"
BorderThickness="1"
Margin="5">
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<WrapPanel IsItemsHost="True" FlowDirection="LeftToRight">
<ItemsPresenter />
</WrapPanel>
<ContentPresenter ContentSource="Name" Grid.Row="1" />
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
Run Code Online (Sandbox Code Playgroud)
请注意,这是一项正在进行的工作,我仍然需要实现许多样式效果.我在这里用它:
<UniformGrid Rows="1">
<ItemsControl Name="Group1" Style="{StaticResource ButtonPanelGroup}">
<Button>Button1</Button>
<Button>Button2</Button>
<CheckBox>TickBox</CheckBox>
</ItemsControl>
<ItemsControl Name="Group2" Style="{StaticResource ButtonPanelGroup}">
<Button>Button3</Button>
<Button>Button4</Button>
<Button>Button5</Button>
</ItemsControl>
<ItemsControl Name="Group3" Style="{StaticResource ButtonPanelGroup}">
<Button>Button6</Button>
<Button>Button7</Button>
<Button>Button8</Button>
</ItemsControl>
</UniformGrid>
Run Code Online (Sandbox Code Playgroud)
另请注意,它仍然是一项正在进行中的工作,因为UniformGrid不会成为这里的方式,并且边距可能是一种痛苦(是否有任何重叠的边距?)所以输入会受到赞赏.
现在到了真正的问题.这不起作用我收到错误:
'ItemsPresenter'对象无法添加到'WrapPanel'.无法显式修改用作ItemsControl的ItemsPanel的Panel的Children集合.ItemsControl为Panel生成子元素.对象'System.Windows.Controls.ItemsPresenter'出错.
那么做这样的事情的最佳方法是什么(希望能够将按钮和其他控件扔进ItemControl并且排队真的很棒).将控件放入某种集合并迭代会更好吗?
我希望能很好地完成它,但我的WPF技能仍然缺乏.是否有任何WPF书籍超出了基础知识,并展示专业人士将如何真正做到这一点?
我不确定我是否为这篇文章设置了正确的标题 - 所以有可能已经找到了我正在寻找的帖子,如果是这样的话可以随意关闭它并重定向我 - 我想要做什么这是:
当一个JFrame用户不能点击gui中的任何其他位置时,除非该窗口关闭,否则当"自定义代码"窗口打开并且不是在netbeans中时,希望甚至抛出那个恼人的"DING"错误声音消息让它在关闭之前做任何事情.
提前致谢!
在没有指定接口的情况下在Windsor中注册组件被认为是不好的形式吗?即
container.Register(Component.For<MyClass>().LifeStyle.Transient);
Run Code Online (Sandbox Code Playgroud)
而不是......
container.Register(Component.For<IMyClass>().ImplementedBy<MyClass>().LifeStyle.Transient);
Run Code Online (Sandbox Code Playgroud)
我理解编码到接口而不是具体实现的好处,但是我们发现我们现在有很多接口,其中许多接口都是实际上只有一个实现的类.
我想知道是否有人遇到以下问题,并对如何解决它有任何想法:我通过Interop将数据从C#应用程序(.NET 3.5)导出到Excel(2003).其中一列存储了一个看似数字的字符串值.也就是说它是一个以0开头的数字,例如000123
我需要存储完整的号码,因为它可能是序列号或类似的东西.Excel并不热衷于此,所以我认为我可以通过将目标单元格设置为常规来绕过它.当我导出到Excel时,我发现123存储而不是000123.
我已经在调试中运行了应用程序,并从我发现的监视列表(对于"范围范围":
range.NumberFormat = "General"`
this.Rows[iGridRow].Cells[iGridCol].Value = "000123" '/* (datagrid is not truncating it)*/
range.Value2 = 123.0
Run Code Online (Sandbox Code Playgroud)
即使我在此之前设置了数字格式,它似乎也被作为数字处理:
range.NumberFormat = sNumberFormat;
range = (Range)sheet.Cells[iExcelRow, iExcelCol];
range.Value2 = this.Rows[iGridRow].Cells[iGridCol].Value.ToString();
Run Code Online (Sandbox Code Playgroud)
有人可以帮忙吗?
我希望这是微不足道的,我只是没有在教程中找到它.我正在编写'监督'c代码的python代码,也就是我用python中的ctypes运行c代码.现在我想"捕获"c'printfs'来处理c代码输出的数据.知道怎么会这样做吗?
谢谢
我已经读过这篇文章,但我是RoR的新手,所以我在理解它时遇到了一些麻烦.我正在使用表单来创建新的请求记录,并且我需要发送的所有变量都已存在.这是我需要发送的数据(这是一个do循环):
:user_id => w[:requesteeID]
:requesteeName => current_user.name
:requesteeEmail => current_user.email
:info => e
Run Code Online (Sandbox Code Playgroud)
这是我的表单,到目前为止工作,但只为所有内容发送NULL值:
<% form_for(:request, :url => requests_path) do |f| %>
<div class="actions">
<%= f.submit e %>
</div>
<% end %>
Run Code Online (Sandbox Code Playgroud)
如何使用hidden_fields发送我已有的数据?谢谢阅读.
我现在已经在虚拟机中编译了8个多小时,现在还没有完成.
终端仍在打印东西,所以我知道它还在编译.
主机系统是一个2.10Ghz的Intel Core2Duo,带有4GB RAM,而guest虚拟机是一个PowerPC虚拟机(QEMU)上的Linux,内存为1GB.
我知道动态指令翻译可以减慢一些事情,但即便如此,Glibc不应该花费超过3个小时左右?
有什么不对或者我应该继续让它一夜之间做到这一点吗?
我正在尝试打印我正在制作的游戏中玩家的动作历史.在每轮结束时,每个玩家都在正方向或负方向上移动了一些数量,并将其记录为运动矢量中的int.最终我想要为每个玩家绘制移动方向与时间的关系,但是我无法从2d向量中提取数据.
所以我尝试的第一件事就是迭代并打印所有元素,但是这不能编译:
void output_movement(const std::vector< std::vector<int> > & movement){
std::vector< std::vector<int> >::iterator row;
std::vector<int>::iterator col;
for (row = movement.begin(); row != movement.end(); ++row) {
for (col = row->begin(); col != row->end(); ++col) {
std::cout << **col;
}
}
}
Run Code Online (Sandbox Code Playgroud)
编译器提供此错误消息,我不太明白:
hg_competition.cpp:45: error: no match for ‘operator=’ in ‘row = ((const std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >*)money_movement)->std::vector<_Tp, _Alloc>::begin [with _Tp = std::vector<int, std::allocator<int> >, _Alloc = std::allocator<std::vector<int, std::allocator<int> > >]()’
/usr/include/c++/4.4/bits/stl_iterator.h:669: note: candidates are: __gnu_cxx::__normal_iterator<std::vector<int, std::allocator<int> >*, std::vector<std::vector<int, std::allocator<int> …Run Code Online (Sandbox Code Playgroud) 是否有任何用于此目的的软件包,一个下载链接?
编辑:现在让 VBO 工作,所以这个问题对我来说没用,我可以接受答案,如果有的话。
我定义我的函数等时,我不能在emacs + slime + sbcl上使用自动缩进功能.
我的.emacs文件配置是这样的:
(setq inferior-lisp-program
"D:/emacs/sbcl_1.0.37/sbcl.exe"
lisp-indent-function 'common-lisp-indent-function
slime-complete-symbol-function 'slime-fuzzy-complete-symbol
slime-startup-animation nil
slime-enable-evaluate-in-emacs t
slime-log-events t
slime-outline-mode-in-events-buffer nil
slime-repl-return-behaviour :send-only-if-after-complete
slime-autodoc-use-multiline-p t
slime-highlight-compiler-notes t)
(add-to-list 'load-path
"d:/emacs/site-lisp/slime") ; your SLIME directory
(require 'slime)
(slime-setup)
Run Code Online (Sandbox Code Playgroud)
有人能帮我吗?