Кнопки рестайлинга Wacom Signature SDK
Я использую вкладку для подписи Wacom STU 530 с Signature SDK v3.20.4., Документация, кажется, предоставляется только при покупке SDK, поэтому я не смогу дать ссылку здесь, но вы можете найти некоторый код Образцы здесь.
Моя проблема заключается в рестайлинге кнопок, отображаемых на панели для подписи, я не могу найти как. Некоторый код:
/* 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();
}
1 ответ
После обращения в службу поддержки 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(',', '.'));
}
Как и шрифты, он влияет на все последующие созданные элементы, поэтому не забудьте сбросить их.