我的WPF 4.0应用程序中有一个宽度为600和高度为80的TextBlock.我想截断文本,并追加......到了最后,在运行时.
我怎么处理它?
我在Stackpanel里面有两个网格.第一个网格名为GridX.最初在网格内部有一个文本框的2D数组(RowDefs/ColumnDefs).XAML中的TextBox定义是
<TextBox x:Name="A1" Grid.Row="4" Grid.Column="5" TextAlignment="Center" />
Run Code Online (Sandbox Code Playgroud)
我希望以与GridX的一部分相同的位置以编程方式添加TextBlock.
效果必须是这样的
<TextBlock Grid.Row="4" Grid.Column="5"
HorizontalAlignment="Left" VerticalAlignment="Top" Text="10" FontSize="8"/>
Run Code Online (Sandbox Code Playgroud)
如何添加这个.我试过这个:
TextBlock tblock = new TextBlock();
GridX.SetColumn(tblock, cIndex);
GridX.SetRow(tblock, rIndex);
Run Code Online (Sandbox Code Playgroud)
但失败了.
我再试一次:
int rIndex = Grid.GetRow(txtBox);
int cIndex = Grid.GetColumn(txtBox);
TextBlock tblock = new TextBlock();
tblock.VerticalAlignment = VerticalAlignment.Top;
tblock.HorizontalAlignment = HorizontalAlignment.Left;
tblock.FontSize = 8;
tblock.Text = rc[i, j - 1];
Grid.SetColumn(tblock, cIndex);
Grid.SetRow(tblock, rIndex);
txtBox.MaxLength = 1;
Run Code Online (Sandbox Code Playgroud)
现在问题是TextBlock不可见.TextBox隐藏它.你能帮我吗
编辑:使用key = lambda解决并了解我实际在做什么.
有像gemodel一样
class A(GeoModel,search.SearchableModel):
Run Code Online (Sandbox Code Playgroud)
我正在尝试按日期使用db.GeoPt来存储谷歌地图坐标与GAE和我可以映射和匹配的地理模型.但订单(" - 修改")不起作用.没有踪影.欢迎所有想法.应该排序的代码是
a = A.proximity_fetch(A.all().filter("modified >",
timeline).filter("published =", True).filter("modified <=",
bookmark ).order("-modified") ,db.GeoPt(lat, lon),max_results=PAGESIZE
+1, max_distance=m)
Run Code Online (Sandbox Code Playgroud)
除订单外,所有参数似乎都有效(" - 修改")
尝试使用lambda排序的建议方法我得到消息"TypeError:lambda()只需1个参数(给定2个)"
a = A.proximity_fetch(A.all().filter("modified >", timeline).filter("published =", True).filter("modified <=", bookmark ).order("-modified") ,db.GeoPt(lat, lon),max_results=40, max_distance=m)
a = sorted(a, lambda x: x.modified, reverse=True)
Run Code Online (Sandbox Code Playgroud) 在学习匿名方法时,我在互联网上找到了以下示例:
namespace AnonymousMethods
{
public class MyClass
{
public delegate void MyDelegate(string message); //delegate accepting method with string parameter
public event MyDelegate MyEvent;
public void RaiseMyEvent(string msg)
{
if (MyEvent != null) MyEvent(msg);
}
}
class Caller
{
static void Main(string[] args)
{
MyClass myClass1 = new MyClass();
// here the confusion
myClass1.MyEvent += delegate
{
Console.WriteLine("we don't make use of your message in the first handler");
};
myClass1.MyEvent += delegate(string message)
{
Console.WriteLine("your message is: {0}", message);
};
Console.WriteLine("Enter …Run Code Online (Sandbox Code Playgroud) 我真的需要帮助,因为我失去了纠正问题的希望.
我正在使用Office Communications Server 64位库.我在项目中使用了3个dll,Microsoft.Rtc.Collaboration.dll,Microsoft.Rtc.Internal.Media.dll和SIPEPS.dll.我不确定Microsoft.Rtc.Collaboration,但Internal.Media和SIPEPS都是x64.在GAC程序集列表中,Rtc.Collaboration显示处理器Arhitecture下的MSIL,其他显示AMD64.
我的项目编译没有错误与这些引用,但在运行时我收到错误:
无法加载文件或程序集"Microsoft.Rtc.Internal.Media"或其依赖项之一.尝试加载格式不正确的程序.
我尝试使用CPU设置为任何CPU来编译项目,但没有任何变化.在x64和x86设置下,我收到此错误.
任何帮助表示赞赏.
更新:下面是程序集绑定日志.
=== Pre-bind state information ===
LOG: User = CONTOSO\elodie
LOG: DisplayName = Microsoft.Rtc.Internal.Media
(Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: Microsoft.Rtc.Internal.Media | Domain ID: 9
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the …Run Code Online (Sandbox Code Playgroud) 引自 Perl::Critic::Policy::InputOutput::ProhibitExplicitStdin
Perl有一个有用的魔术文件句柄,叫做*ARGV,用于检查命令行,如果有任何参数,则打开并将其作为文件读取.如果没有参数,*ARGV的行为类似于*STDIN.如果要创建从STDIN读取的程序,则此行为几乎总是您想要的.这通常用以下两种等效形式之一编写:
Run Code Online (Sandbox Code Playgroud)while (<ARGV>) { # ... do something with each input line ... } # or, equivalently: while (<>) { # ... do something with each input line ... }
<STDIN>?我觉得<STDIN>我的代码的意图比使用<>或更清楚<ARGV>.
我的代码流是这样的
my @inp = <STDIN>;
my $len = $inp[0];
...
for(my $i = 0; $i < ($len + 0); $i++) {
my @temp = split (' ', $inp[$i]);
...
}
Run Code Online (Sandbox Code Playgroud) 天哪.
有人可以解释这两个字节反转函数实现的逻辑差异.
例1:
uint32_t byte_reverse_32(uint32_t num) {
static union bytes {
uint8_t b[4];
uint32_t n;
} bytes;
bytes.n = num;
uint32_t ret = 0;
ret |= bytes.b[0] << 24;
ret |= bytes.b[1] << 16;
ret |= bytes.b[2] << 8;
ret |= bytes.b[3];
return ret;
}
Run Code Online (Sandbox Code Playgroud)
例2:
uint32_t byte_reverse_32(uint32_t num) {
static union bytes {
uint8_t b[4];
uint32_t n;
} bytes;
bytes.n = num;
uint32_t ret = 0;
ret |= (bytes.b[0] << 24) || (bytes.b[1] << 16) || (bytes.b[2] << 8) …Run Code Online (Sandbox Code Playgroud) 我正在尝试编写一个计算字符串中所有字符的程序.我原本拥有它,但后来意识到我无法计算空间.我不明白为什么这不起作用.
for(m=0; z[m] != 0; m++) {
if(z[m] != ' ') {
charcount ++;
}
}
Run Code Online (Sandbox Code Playgroud)
任何协助赞赏.
编辑*如果像这样扫描输入(字符串),它会有所不同吗?是的,一切都已初始化.我已经尝试打印z [m]评估的内容并且它不是"m"处字符串的实际值,我认为这是问题所在.
for(j=0; j<7; j++){
printf("Enter a string:\n");
scanf("%s", z);
for(m=0; z[m] != 0; m++){
if(z[m] != ' '){
charcount ++;
}
}
Run Code Online (Sandbox Code Playgroud) 如何在JavaScript中从Hex字符串转换为字符串ASCII?
例如:
32343630将是2460
c ×2
c# ×2
wpf ×2
.net ×1
64-bit ×1
character ×1
coding-style ×1
count ×1
endianness ×1
entry-point ×1
gridview ×1
javascript ×1
perl ×1
python ×1
windows ×1