<!DOCTYPE html>
<html style = 'height: 100%;'>
<head>
<title>test manual height calculations</title>
</head>
<script type = 'text/javascript'>
window.onresize = fixHeighs;
function endsWith(str, suffix)
{
if (!str)
return false;
return str.indexOf(suffix, str.length - suffix.length) !== -1;
}
function fixHeighs(start_elem)
{
if (start_elem && start_elem.target) // if this is event, then make var null
start_elem = null;
var curr_elem = start_elem ? start_elem : document.body; // determine what element we should check now
var neededHeight = curr_elem.getAttribute("data-neededHeight"); // get data-neededHeight attribute
if …Run Code Online (Sandbox Code Playgroud) <input type='text' onchange="reportAnswer(1, this.value);" onkeyup="this.onchange();" onpaste="this.onchange();" oncut="this.onchange();" onclear = "this.onchange();" />

如何捕捉这种变化?这是IE11。
PS我添加了onclear处理程序,因为没有想法该怎么做。
例如,我有一个主线程,创建了很多类等.我有一个网络部分,即在单独的线程中等待客户端数据.这个"服务员"应该从主线程中创建的类中运行一些函数,这个函数应该在主线程中执行.
我怎么能这样做?如果我SomeClass::SomeMethod(some_args);从服务员这样调用所需的方法,当然,它们在辅助线程中执行.
会有这样的事情:
SomeClass::Invoke(function_pointer);所以,function_pointer指向的函数会在主线程中执行吗?我需要一个关于Windows操作系统的建议.
我有这个父类:
enum UI_STATE
{
UI_STATE_SPLASH_SCREEN,
UI_STATE_LOGIN_SCREEN,
UI_STATE_CHARACTER_CREATION_SCREEN,
UI_STATE_CHARACTER_CHOOSE_SCREEN,
UI_STATE_LOADING_SCREEN,
UI_STATE_GAMEPLAY,
UI_STATE_EXIT_REQUESTED,
UI_STATE_UNKNOWN
};
[event_source(native)]
class UserInterface
{
protected:
MyGUI::Gui *mGUI;
public:
static UserInterface *Instance;
UI_STATE UI_CURRENT_STATE;
public:
UserInterface()
{
MyGUI::OgrePlatform* mPlatform = new MyGUI::OgrePlatform();
mPlatform->initialise(BaseObjects::mWindow, BaseObjects::mSceneMgr);
mGUI = new MyGUI::Gui();
mGUI->initialise();
UI_CURRENT_STATE = UI_STATE_UNKNOWN;
}
~UserInterface()
{
mGUI->destroyAllChildWidget();
mGUI->shutdown();
delete mGUI;
mGUI = NULL;
delete Instance;
Instance = NULL;
}
virtual void update();
virtual void GAMEPLAY_SCREEN_ShowTargetBox();
virtual void GAMEPLAY_SCREEN_HideTargetBox();
...//some other methods
}
UserInterface *UserInterface::Instance = NULL;
Run Code Online (Sandbox Code Playgroud)
还有两个子类,其中一个是覆盖这3个虚函数,第二个对这3个函数什么都不做.
孩子1:
#ifndef …Run Code Online (Sandbox Code Playgroud) public partial class TestConrol : UserControl
{
public TestConrol()
{
InitializeComponent();
}
public override string ToString()
{
return "asd";
}
}
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
TestConrol tc1 = new TestConrol();
comboBox1.Items.Add(tc1);
TestConrol tc2 = new TestConrol();
comboBox1.Items.Add(tc2);
}
}
Run Code Online (Sandbox Code Playgroud)
当表单加载时,我看到combobox有两个空名称的项目,而不是"asd":/
但如果我在公共类中重写ToString(),而不是从任何东西派生,这个工作:
public class TestClass
{
public override string ToString()
{
return "bla bla bla";
}
}
public partial class Form1 : Form
{
public Form1() …Run Code Online (Sandbox Code Playgroud) 我没有看到任何可用的字段。我尝试了这一切:
ColorDialog cd = new ColorDialog();
cd.AnyColor = true;
cd.AllowFullOpen = true;
cd.SolidColorOnly = false;
Run Code Online (Sandbox Code Playgroud)
但它可能还有其他作用。
如果使用 win 表单控件无法做到这一点,也许我可以在 WPFHost 元素中使用 WPF 颜色选择器?
正如msdn http://msdn.microsoft.com/en-us/library/aa288468(v=vs.71).aspx所说"平台调用服务(PInvoke)允许托管代码调用DLL中实现的非托管函数. "
我想从我在c ++中创建的DLL导入一些类
是否可能以及如何?
例如,我在DLL中有一些结构:
struct __declspec(dllexport) DLLVector3
{
float x, y, z;
};
struct __declspec(dllexport) DLLQuaternion
{
float x, y, z, w;
};
class __declspec(dllexport) DLLCharacter
{
public:
DLLVector3 position;
DLLQuaternion orientation;
DLLCharacter()
{
}
~DLLCharacter()
{
}
void setPosition(PxVec3 pos)
{
position.x = pos.x;
position.y = pos.y;
position.z = pos.z;
}
void setOrientation(PxQuat or)
{
orientation.x = or.x;
orientation.y = or.y;
orientation.z = or.z;
orientation.w = or.w;
}
};
struct __declspec(dllexport) PhysicalObject
{
DLLCharacter *character; …Run Code Online (Sandbox Code Playgroud) 有时我需要睡眠非整数毫秒,但无法找到一种方法.例如,如果我想睡半毫秒,我想这样做:
Thread.Sleep(0.5);
Run Code Online (Sandbox Code Playgroud)
但不能,因为Sleep只支持整数.
我有类TestClass已经ToString重写(它返回Name场).我有TestClass添加的实例,ListBox在某些时候我需要更改Name其中一个实例,然后我可以刷新它的文本ListBox?
using System;
using System.Windows.Forms;
namespace TestListBox
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
listBox1.Items.Add(new TestClass("asd"));
listBox1.Items.Add(new TestClass("dsa"));
listBox1.Items.Add(new TestClass("wqe"));
listBox1.Items.Add(new TestClass("ewq"));
}
private void button1_Click(object sender, EventArgs e)
{
((TestClass)listBox1.Items[0]).Name = "123";
listBox1.Refresh(); // doesn't help
listBox1.Update(); // same of course
}
}
public class TestClass
{
public string Name;
public TestClass(string …Run Code Online (Sandbox Code Playgroud) 我有一些 JSON 对象:
"opf": {
"type": "2014",
"code": "12247",
"full": "????????? ??????????? ????????",
"short": "???"
}
Run Code Online (Sandbox Code Playgroud)
我希望它将它反序列化到我的班级中:
class SuggestionInfoDataOpf
{
public string code;
public string full;
public string short; //ERROR. Of course I can't declare this field
public string type;
}
Run Code Online (Sandbox Code Playgroud)
怎么办?.. 我想像这样反序列化它:Newtonsoft.Json.JsonConvert.DeserializeObject<SuggestionInfoDataOpf>(json_str);,但字段名称应该匹配。