作为一个让自己摆脱困境的爱好项目,我想构建一个小程序员计时器设备.它基本上会接受一个程序,它是一个时间列表,然后从每次倒计时.
我想使用C或Java微控制器.我过去曾使用BASIC制作一个小型自主机器人,所以这次我想要一些不同的东西.
你会推荐什么微控制器和显示器?我希望保持简单,所以程序将通过计算机加载到内存中(串口正常,但USB会使它更容易)
我在XAML中有一个WPF ListView/GridView规范.第一列使用CellTemplate指定图标,其他列使用DisplayMemberBinding填充自己.图标列是20宽,图标16但它们被边距/填充/东西截断.我无法确定它的位置.
这是必需品(我删除了一些列,因为它们是相同的):
<ListView.ItemContainerStyle>
<Style TargetType="{x:Type ListViewItem}">
<Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" />
<Setter Property="FontWeight" Value="Normal" />
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="FontWeight" Value="Bold" />
</Trigger>
</Style.Triggers>
</Style>
</ListView.ItemContainerStyle>
<ListView.Resources>
<DataTemplate x:Key="image">
<Image Width="16" Height="16" Margin="0,0,0,0"
HorizontalAlignment="Center"
Source="{Binding Path=ObjectType,
Converter={StaticResource imageConverter} }" />
</DataTemplate>
</ListView.Resources>
<ListView.View>
<GridView>
<GridViewColumn Width="20"
CellTemplate="{StaticResource image}"/>
<GridViewColumn Width="120" Header="Name"
DisplayMemberBinding="{Binding Path=Name}"/>
</GridView>
</ListView.View>
Run Code Online (Sandbox Code Playgroud)
ImageConverter只是将ObjectType转换为图像,因此每种类型的项都有自己的图标.
众所周知,我们可以使用"user32.dll"中的"LockWorkStation()"这样的api来锁定窗口.但是如何解锁呢?
例如,如果我首先运行应用程序,我希望应用程序在30秒后自行解锁窗口.怎么做?换句话说,如果自动登录,windows将从regedit读取用户名和密码,然后使用api登录.现在我需要api.它必须存在,但似乎不公开.
我可以获得应用程序Windows的用户名和密码.
看来WBF中有一些Api.但是你知道,资源太少了.我不想发送键盘消息来解决问题,因为这是最糟糕的方法.
我正在使用Google Maps API来获取2个英国邮政编码之间的距离.
var yourPostcode = $("#YourPostcode").val();
var restaurantPostcode = $("#Postcode").val();
var point1 = GetPointFromPostcode(yourPostcode);
var point2 = GetPointFromPostcode(restaurantPostcode);
var distance = point1.distanceFrom(point2, 3959).toFixed(1);
Run Code Online (Sandbox Code Playgroud)
但是,GetPoint函数异步调用Google API,因此在计算时间距离时,第1点和第2点尚未设置(我相信这是发生了什么?)
我还在每个语句之后发出警报来检查变量的值,并且这样做我得到了正确的值,等待我点击确定必须给它足够的时间来获得结果吗?虽然它不再这样做了:(
这是获取点功能
function GetPointFromPostcode(postcode) {
var point;
localSearch.execute(postcode + ", UK");
if (localSearch.results[0]) {
var resultLat = localSearch.results[0].lat;
var resultLng = localSearch.results[0].lng;
point = new GLatLng(resultLat, resultLng);
} else {
$(".PostcodeError").append("Postcode Invalid");
}
return point;
}
Run Code Online (Sandbox Code Playgroud)
我知道我可以在本地搜索时设置回调,以便在结果返回时调用,但问题是这里有2次搜索.
我想要的是在BOTH搜索返回结果后才调用计算距离线.
你知道怎么做吗?
谢谢
我正在尝试这样做......
<Style
x:Key="MyBorderStyle"
TargetType="Border">
<Setter
Property="BorderBrush"
Value="{StaticResource MyBorderBrush}" />
<Setter
Property="Background"
Value="{StaticResource MyBackgroundBrush}" />
<Setter
Property="Padding"
Value="{TemplateBinding Padding}" />
</Style>
Run Code Online (Sandbox Code Playgroud)
...但我收到错误: 'Padding' member is not valid because it does not have a qualifying type name.
我如何提供"合格类型名称"?
注意:我试图这样做的原因是,我想在一系列类似的ControlTemplates中包含相同的Border.
谢谢.
编辑:
好吧,我试过这个......
<Setter
Property="Padding"
Value="{TemplateBinding GridViewColumnHeader.Padding}" />
Run Code Online (Sandbox Code Playgroud)
......它实际编译了,但是当我运行应用程序时,我得到了XamlParseException
:
Cannot convert the value in attribute 'Value' to object of type ''.
我想,也许有资格Padding
与GridViewColumnHeader
(这是我想用这种风格与控件模板)的工作,但没有骰子.
编辑2:
那么,根据文档TemplateBinding
,它说:
将控件模板中的属性值链接为模板化控件上某些其他公开属性的值.
所以听起来我正在尝试做的事情显然是不可能的.我真的希望能够为我的控件模板中的某些控件创建可重用的样式,但我想模板绑定不能包含在这些样式中.
如何使用C#为sql server表添加列?
例如,我想在C#代码中执行以下sql:
alter table [Product] add
[ProductId] int default 0 NOT NULL
Run Code Online (Sandbox Code Playgroud) 我正在制作一个可以拖动的自定义控件,它是半透明的。我需要它,以便在它移动(mousemove事件)时,如果它与控件相交,则其父级将成为该控件。我试图让它遍历所有控件和if control.bounds.intersectswith me.clientrectangle then me.parent = control type
事物,但是没有用。任何帮助,将不胜感激谢谢。