9 Answers, 1 is accepted
Thank you for your interest in RadControls for WinForms and in RadColorDialog in particular.
Yes, it is possible to change the language of the RadColorDialog by accessing the corresponding properties which enable you to define another titles of tab items and buttons in the RadColorDialog. Take a look at the following code snippet which demonstrates how to achieve this:
RadColorSelector colorSelector = this.radColorDialog1.ColorDialogForm.Controls[0] as RadColorSelector; |
colorSelector.SystemTabHeading = "System Tab Heading"; |
colorSelector.BasicTabHeading = "Basic Tab Heading"; |
colorSelector.WebTabHeading = "Web Tab Heading"; |
colorSelector.ProfessionalTabHeading = "Proffesional Tab Heading"; |
if (colorSelector != null) |
{ |
foreach (Control control in colorSelector.Controls) |
{ |
RadButton button = control as RadButton; |
if (button != null) |
{ |
switch (button.Text.ToLower()) |
{ |
case "ok": |
button.Text = "OK"; |
break; |
case "cancel": |
button.Text = "Cancel"; |
break; |
} |
} |
} |
} |
As you can see, the labels of the OK and Cancel buttons are not exposed as properties. This will be address in one of our next releases.
I hope this helps.
Do not hesitate to write back if you need further assistance.
All the best,
Deyan
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Hi Deyan,
Your reply really helped me on changing language of ColorDialog,while I still have a problem to change the caption/text of ColorDialog,even I used "dialogForm.Text='颜色对话框'". Following is the codes-
GridColorPickerEditor editor =e.ActiveEditor as GridColorPickerEditor;
if(editor!=null ){
GridColorPickerElement element = editor.EditorElement as GridColorPickerElement;
RadColorDialog dialog = element.ColorDialog;
RadColorDialogForm dialogForm = dialog.ColorDialogForm as RadColorDialogForm;
dialogForm.ShowIcon = false;
foreach (Control ctrl in dialogForm.Controls[0].Controls)
{
Label lbl = ctrl as Label;
if (lbl != null)
{
switch (lbl.Text.ToLower())
{
case "current":
lbl.Text = "目前颜色";
break;
case "new":
lbl.Text = "新颜色";
break;
}
}
RadButton btn = ctrl as RadButton;
if (btn != null)
{
switch (btn.Text.ToLower())
{
case "ok":
btn.Text = "确定";
break;
case "cancel":
btn.Text = "取消";
break;
case "add custom color":
btn.Text = "添加自定义颜色";
break;
}
}
}
RadColorSelector colorSelector = dialog.ColorDialogForm.RadColorSelector as RadColorSelector;
colorSelector.SystemTabHeading = " 系统 ";
colorSelector.BasicTabHeading = " 基础 ";
colorSelector.WebTabHeading = " 网页 ";
colorSelector.ProfessionalTabHeading = " 专业 ";
Please note that you can use the localization provider instead of manually changing the text: Localizattion.
I hope this will be useful. Let me know if you have additional questions.
Regards,
Dimitar
Telerik by Progress
Hi Dimitar,
That helps perfectly!!!!Thanks a lot.
And I have one more question-
Still about the color dialog,the target is to hide the icon of the color dialog,it succeeded for this case:
private void pRadGridView_CellEditorInitialized(object sender, GridViewCellEventArgs e)
{
GridColorPickerEditor editor = e.ActiveEditor as GridColorPickerEditor;
if (editor != null)
{
GridColorPickerElement element = editor.EditorElement as GridColorPickerElement;
RadColorDialog dialog = element.ColorDialog;
RadColorDialogForm dialogForm = dialog.ColorDialogForm as RadColorDialogForm;
dialogForm.ShowIcon = false;
dialogForm.ShowInTaskbar = false;
}
}
while it failed for this case:
private void pRadGridView_FilterPopupInitialized(object sender, FilterPopupInitializedEventArgs e)
{
GridColorPickerEditor editor = e.FilterPopup as GridColorPickerEditor;
if (editor != null)
{
GridColorPickerElement element = editor.EditorElement as GridColorPickerElement;
RadColorDialog dialog = element.ColorDialog;
RadColorDialogForm dialogForm = dialog.ColorDialogForm as RadColorDialogForm;
dialogForm.ShowIcon = false;
dialogForm.ShowInTaskbar = false;
}
}
Is there a way to hide the icon by an easier way?
Best Regards,
Peter
The code in CellEditorInitialized event should work for the filter cell as well. For which cell you want to remove the icon in the second case?
I am looking forward to your reply.
Regards,
Dimitar
Telerik by Progress
Hi Dimitar,
I added a color column into the pRadGridView.When I clicked the filter button of the color column,I choosed the filter of "Custom",then the filter dialog showed up,there was a button to click to show the color dialog.That is the color dialog I want to hide the icon.
Thanks,
Peter
The following snippet shows how you can access the editors in this form:
private
void
RadGridView1_CreateCompositeFilterDialog(
object
sender, GridViewCreateCompositeFilterDialogEventArgs e)
{
CompositeFilterForm form = e.Dialog
as
CompositeFilterForm;
form.Shown += Form_Shown;
}
private
void
Form_Shown(
object
sender, EventArgs e)
{
CompositeFilterForm form = sender
as
CompositeFilterForm;
RadColorBox box1 = form.LeftEditor
as
RadColorBox;
var dialogForm = box1.ColorDialog.ColorDialogForm
as
RadColorDialogForm;
dialogForm.ShowIcon =
false
;
RadColorBox box2 = form.LeftEditor
as
RadColorBox;
var dialogForm2 = box2.ColorDialog.ColorDialogForm
as
RadColorDialogForm;
dialogForm2.ShowIcon =
false
;
}
I hope this will be useful.
Regards,
Dimitar
Telerik by Progress
Hi Dimitar,
That works perfectly,thanks a lot for your help.
And thanks for your patience.
I still have a question about the command bar,I added several buttons on it,when I decreased the width of the form mannually(debugging),some buttons just went invisible,it is possible to let those buttons go to show in another row on the command bar?
Best Regards,
Peter
This is available out of the box with RadMenu. With RadCommanBar the items are added to the overflow menu when there is not enough space.
Please do not hesitate to contact us with any additional questions or concerns.
Dimitar
Telerik by Progress