如何在Windows CE模拟器上创建可点击的按钮?
基本上我已经为类似手机的设备创建了一个模拟器。我还创建了一个带有按钮的皮肤。我只是想知道如何真正让按钮执行与程序相关的操作,但是我会非常高兴,因为皮肤上会出现一些指示,表明发生了一些事情。我尝试过使用 msdn 教程,但没有成功。
这是我的 XML:
<?xml version="1.0" encoding="UTF-8"?>
<skin>
<view titleBar="SalusSdk" displayWidth="480" displayHeight="272" displayPosX="147" displayPosY="103" displayDepth="16" mappingImage="Up.png" normalImage="DefaultSkin.png" downImage="Down.png">
<button
toolTip="Power"
onPressAndHold="0x75"
mappingColor="0x00FF00"
/>
...
<button
toolTip="Soft Key 1"
onClick="0x3B"
mappingColor="0x330033"
/>
...
<button
toolTip="Up"
onPressAndHold="0x48"
mappingColor="0x00FFCC"
KeyEvent="Up"
/>
<button
toolTip="Down"
onPressAndHold="0x50"
mappingColor="0x0000FF"
KeyEvent="Down"
/>
</view>
</skin>
Basically I have created a emulator for a phone like device. I have also created a skin with buttons on it. I was just wondering how to actually make the buttons do something i.e. in relation to the program however I would be more than happy for there just to be some indication on the skin that something has happened. I have tried using the msdn tutorials but I have had no success.
Here is my XML:
<?xml version="1.0" encoding="UTF-8"?>
<skin>
<view titleBar="SalusSdk" displayWidth="480" displayHeight="272" displayPosX="147" displayPosY="103" displayDepth="16" mappingImage="Up.png" normalImage="DefaultSkin.png" downImage="Down.png">
<button
toolTip="Power"
onPressAndHold="0x75"
mappingColor="0x00FF00"
/>
...
<button
toolTip="Soft Key 1"
onClick="0x3B"
mappingColor="0x330033"
/>
...
<button
toolTip="Up"
onPressAndHold="0x48"
mappingColor="0x00FFCC"
KeyEvent="Up"
/>
<button
toolTip="Down"
onPressAndHold="0x50"
mappingColor="0x0000FF"
KeyEvent="Down"
/>
</view>
</skin>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我没看出有什么异常。我正在回顾几年前所做的一个,所以如果解释有点粗略,请给我一些宽限。
因此,normalImage 应该只是您设备的图片。
您的mappingImage 需要仅包含您想要作为按钮的颜色区域,每个按钮的颜色与skin.xml 文件中相应元素中的mappingColor 值相匹配 - 下面是我的skin.xml 文件中的几个按钮。
downImage 应该在您的mappingImage 的按钮周围区域包含艺术作品,并具有您想要的任何效果 - 例如,使其颜色更深一些。
假设您已将模拟器配置为接受所有皮肤文件,它应该生成将发送到具有焦点的窗口的击键。如果您需要模拟更全局的功能,例如打开主屏幕,则必须在应用程序中挂钩键盘事件并做出相应响应 - 代码项目网站有许多 WM/CE 的示例。
I don't see anything out of sorts. I'm looking back on one I did several years ago so give me some slack if the explanation is a little sketchy.
So the normalImage should just be a picture of your device.
Your mappingImage needs to contain only the areas colored in you want to be buttons, with each button colored in with a color matching the mappingColor value in the corresponding element in the skin.xml file - below are a couple buttons from my skin.xml file.
The downImage should contain art just in the area around the buttons from your mappingImage with any effect your want - make it several shades darker for example.
Assuming you've configured your emulator to accept all your skin files, it should generate keystrokes that will be sent to the window with focus. If you need to simulate a more global feature, such as opening a home screen, you'll have to hook the keyboard events in your app and respond accordingly - Code Project site has many examples of this for WM/CE.