Wacom Signature SDK 重新设计按钮样式
Wacom Signature SDK restyle buttons
我正在使用 Wacom STU 530 signature tab with the Signature SDK v3.20.4., the documentation seems to only be furnished when buying the SDK, so I won't be able to give a link here, but you can find some code samples here。
我的问题是关于重新设置签名板上显示的按钮的样式,我找不到具体方法。一些代码:
/* We have this controller which was placed in a windows form
* It's that object that will mainly communicate with the Wacom tab
* It's already initialized, I'm showing this to just to show the type & name */
AxWizCtl WizCtl;
bool success = WizCtl.PadConnect()
if(isSuccess) {
WizCtl.Font = new Font("Arial", 20, FontStyle.Bold);
WizCtl.AddObject(ObjectType.ObjectButton, id, x, y, text, null);
/*
* And now what? I can only change the font and dimensions.
* How could I change things like the border or the color?
* I don't even know how I can access the newly created object
*/
WizCtl.Display();
}
而且我知道这一定是可能的,这个 SDK 有这个方法 CaptureResult res = SigCtl.CtlCapture("who", "why");
(SigCtl
是一个 AxSigCtl
对象)可以显示带有彩色按钮的预定义表单,但是我想建立自己的。
(这里的按钮是蓝色的,而用 AddObject
创建的按钮是白色的)
此外,与字体更改不同,这不起作用:
AxWizCtl WizCtl;
bool success = WizCtl.PadConnect()
if(isSuccess) {
WizCtl.Font = new Font("Arial", 20, FontStyle.Bold);
WizCtl.BorderColor = Color.DarkOrange;
WizCtl.BackColor = Color.HotPink;
WizCtl.BorderWidth = 3;
WizCtl.AddObject(ObjectType.ObjectButton, id, x, y, text, null);
WizCtl.Display();
}
联系 Wacom 支持后,我得到了答复:
AxWizCtl WizCtl;
bool success = WizCtl.PadConnect()
if(isSuccess) {
WizCtl.Font = new Font("Arial", 20, FontStyle.Bold);
WizCtl.SetProperty("ObjectForegroundColor", ConvertColor(Color.DarkOrange)); //Affects text and border colors
WizCtl.SetProperty("ObjectBackgroundColor", ConvertColor(Color.Pink)); //Affects backgroud color
WizCtl.AddObject(ObjectType.ObjectButton, id, x, y, text, null);
WizCtl.Display();
}
//Needed as the color format is a string like this : "0,0.165,1"
//The order being red, green and blue and the values between 0 and 1
private string ConvertColor (Color color) {
string r = ((float)(color.R / 255f)).ToString("0.000");
string g = ((float)(color.G / 255f)).ToString("0.000");
string b = ((float)(color.B / 255f)).ToString("0.000");
return String.Format("{0},{1},{2}", r.Replace(',', '.'), g.Replace(',', '.'), b.Replace(',', '.'));
}
就像字体一样,它会影响所有后续创建的元素,所以不要忘记重新设置它们。
我正在使用 Wacom STU 530 signature tab with the Signature SDK v3.20.4., the documentation seems to only be furnished when buying the SDK, so I won't be able to give a link here, but you can find some code samples here。
我的问题是关于重新设置签名板上显示的按钮的样式,我找不到具体方法。一些代码:
/* We have this controller which was placed in a windows form
* It's that object that will mainly communicate with the Wacom tab
* It's already initialized, I'm showing this to just to show the type & name */
AxWizCtl WizCtl;
bool success = WizCtl.PadConnect()
if(isSuccess) {
WizCtl.Font = new Font("Arial", 20, FontStyle.Bold);
WizCtl.AddObject(ObjectType.ObjectButton, id, x, y, text, null);
/*
* And now what? I can only change the font and dimensions.
* How could I change things like the border or the color?
* I don't even know how I can access the newly created object
*/
WizCtl.Display();
}
而且我知道这一定是可能的,这个 SDK 有这个方法 CaptureResult res = SigCtl.CtlCapture("who", "why");
(SigCtl
是一个 AxSigCtl
对象)可以显示带有彩色按钮的预定义表单,但是我想建立自己的。
AddObject
创建的按钮是白色的)
此外,与字体更改不同,这不起作用:
AxWizCtl WizCtl;
bool success = WizCtl.PadConnect()
if(isSuccess) {
WizCtl.Font = new Font("Arial", 20, FontStyle.Bold);
WizCtl.BorderColor = Color.DarkOrange;
WizCtl.BackColor = Color.HotPink;
WizCtl.BorderWidth = 3;
WizCtl.AddObject(ObjectType.ObjectButton, id, x, y, text, null);
WizCtl.Display();
}
联系 Wacom 支持后,我得到了答复:
AxWizCtl WizCtl;
bool success = WizCtl.PadConnect()
if(isSuccess) {
WizCtl.Font = new Font("Arial", 20, FontStyle.Bold);
WizCtl.SetProperty("ObjectForegroundColor", ConvertColor(Color.DarkOrange)); //Affects text and border colors
WizCtl.SetProperty("ObjectBackgroundColor", ConvertColor(Color.Pink)); //Affects backgroud color
WizCtl.AddObject(ObjectType.ObjectButton, id, x, y, text, null);
WizCtl.Display();
}
//Needed as the color format is a string like this : "0,0.165,1"
//The order being red, green and blue and the values between 0 and 1
private string ConvertColor (Color color) {
string r = ((float)(color.R / 255f)).ToString("0.000");
string g = ((float)(color.G / 255f)).ToString("0.000");
string b = ((float)(color.B / 255f)).ToString("0.000");
return String.Format("{0},{1},{2}", r.Replace(',', '.'), g.Replace(',', '.'), b.Replace(',', '.'));
}
就像字体一样,它会影响所有后续创建的元素,所以不要忘记重新设置它们。