【发布时间】:2012-01-16 20:13:57
【问题描述】:
我目前在 Visual Studio 2010 中使用 vb.net,并且正在将 radbuttons 用于 winforms。
我怎样才能拥有一个左侧有图像而右侧有文字的按钮? 我找不到合适的属性来设置图像。
是的,我可以设置 Displaystyle 的属性(图像和文本)和图像对齐(中左)
谁能分享他的知识?
谢谢!
【问题讨论】:
标签: .net winforms rad-controls
我目前在 Visual Studio 2010 中使用 vb.net,并且正在将 radbuttons 用于 winforms。
我怎样才能拥有一个左侧有图像而右侧有文字的按钮? 我找不到合适的属性来设置图像。
是的,我可以设置 Displaystyle 的属性(图像和文本)和图像对齐(中左)
谁能分享他的知识?
谢谢!
【问题讨论】:
标签: .net winforms rad-controls
将Appearance 设置为Appearance.Button
设置Image 属性
将TextImageRelation 设置为TextImageRelation.ImageBeforeText
默认外观Appearance.Norm 在标签部分显示带有图像的传统单选按钮。
【讨论】:
如果您的问题是关于普通按钮,那么您可以在 Visual Studio 的属性窗口中更改按钮的图像属性。
如果您是动态生成按钮,您可以:
yourbuttonobject.Image = Image.FromFile(@"path to your image");
this.Controls.Add(yourbuttonobject);//controls have to be added to a container control
如果您的问题是关于 Telerik 的 Telerik radbutton 控件 Telerik Rad Buttons for WinForms 然后你可以像这样为按钮设置主题How to theme the Telerik radbutton button
如果您的问题与单选按钮有关,您可以从属性窗口或通过如下代码为其设置主题:
private void Form1_Load(object sender, EventArgs e)
{
RadioButton dynamicRadioButton = new RadioButton();
dynamicRadioButton.Text = "I am a Dynamic RadioButton";
dynamicRadioButton.Location = new Point(20, 20);
dynamicRadioButton.Height = 40;
dynamicRadioButton.Width = 300;
dynamicRadioButton.Name = "DynamicRadioButton";
dynamicRadioButton.Image = Image.FromFile(@"your_image_path");
this.Controls.Add(dynamicRadioButton);
}
【讨论】: