我想检查C#Windows窗体应用程序中的Insert键的状态.这是最小的代码(不起作用;带有两个RadioButtons的表单):
using System;
using System.Windows.Forms;
using System.Windows.Input;
// Also added PresentationCore and WindowsBase refereneces
namespace InsertModeDemo1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
if (Keyboard.IsKeyToggled(Key.Insert))
radioButtonInsert.Checked = true;
else
radioButtonOverstrike.Checked = true;
}
}
}
Run Code Online (Sandbox Code Playgroud) 我正在将一个程序从 Pascal 翻译成 C。我已经很多年没有使用 C 语言了。这是相关的代码片段:
typedef struct querec *queptr;
struct querec {
char item;
queptr next;
};
struct queue {
queptr front,
rear;
};
struct queue qnum[5];
char item;
const char remove(struct queue *q)
{
queptr p;
char remove_result;
p = q->front;
remove_result = p->item;
q->front = p->next;
if (q->front == NULL)
q->rear = NULL;
return remove_result;
}
main()
{
...
item = remove(&qnum[3]);
}
Run Code Online (Sandbox Code Playgroud)
它不会在 Visual Studio 2015 中编译,报告以下内容:
Warning C4133 'function': incompatible types - from 'queue *' …Run Code Online (Sandbox Code Playgroud)