【WinForms】C1Winform的中是否有此功能控件
最近几年DotNetBar发展的很快,最近整理程序发现DevComponents.DotNetBar.RadialMenu控件,是很跟形式的,主要是视觉上的不同效果,其实功能等同于右键菜单,我将于附上图片。比如有Item集合{新建文件、打开文件、打印文件、预览文件}等功能,同时具有ItemClick事件。类似转盘菜单,中间有一个小图片。比较实用。不知道C1中目前是否有此控件,望高手指导。回复 1楼liujun_sx的帖子
有的,C1RadialMenu就和你说的类似。它是源于OneNote的圆形菜单。
有关它的介绍可以参考我们的产品博客:http://blog.gcpowertools.com.cn/post/2014/05/23/C1MenusTools-Menus.aspx 下载测试,发现只能点击Fonts,而First等都不能点击,看了First的checked为false,enabled为false,自己在设计下不不能修改,不知道是咋回事 还发现这个控件的radialMenu的item中增加radialMenuItem,维护了text后,确定返回,再进去一看,增加的radialMenuItem没有了,这些都是在设计状态下。 private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
this.c1RadialMenu1 = new C1.Win.C1Command.C1RadialMenu();
this.radialMenuItem1 = new C1.Win.C1Command.RadialMenuItem();
this.radialMenuItem2 = new C1.Win.C1Command.RadialMenuItem();
this.radialMenuItem3 = new C1.Win.C1Command.RadialMenuItem();
this.radialMenuItem4 = new C1.Win.C1Command.RadialMenuItem();
this.radialMenuItem5 = new C1.Win.C1Command.RadialMenuItem();
this.SuspendLayout();
//
// c1RadialMenu1
//
this.c1RadialMenu1.AutoHide = false;
this.c1RadialMenu1.Image = ((System.Drawing.Image)(resources.GetObject("c1RadialMenu1.Image")));
this.c1RadialMenu1.ItemClick += new C1.Win.C1Command.RadialMenuItemClickEventHandler(this.c1RadialMenu1_ItemClick);
//
// radialMenuItem1
//
this.radialMenuItem1.Name = "radialMenuItem1";
this.radialMenuItem1.Text = "打开";
this.radialMenuItem1.ToolTip = "打开";
//
// radialMenuItem2
//
this.radialMenuItem2.Name = "radialMenuItem2";
this.radialMenuItem2.Text = "新建";
this.radialMenuItem2.ToolTip = "新建";
//
// radialMenuItem3
//
this.radialMenuItem3.Name = "radialMenuItem3";
this.radialMenuItem3.Text = "另存";
this.radialMenuItem3.ToolTip = "另存";
//
// radialMenuItem4
//
this.radialMenuItem4.Name = "radialMenuItem4";
this.radialMenuItem4.Text = "打印";
this.radialMenuItem4.ToolTip = "打印";
//
// radialMenuItem5
//
this.radialMenuItem5.Name = "radialMenuItem5";
this.radialMenuItem5.Text = "预览";
this.radialMenuItem5.ToolTip = "预览";
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(659, 366);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);
}
private C1.Win.C1Command.C1RadialMenu c1RadialMenu1;
private C1.Win.C1Command.RadialMenuItem radialMenuItem1;
private C1.Win.C1Command.RadialMenuItem radialMenuItem2;
private C1.Win.C1Command.RadialMenuItem radialMenuItem3;
private C1.Win.C1Command.RadialMenuItem radialMenuItem4;
private C1.Win.C1Command.RadialMenuItem radialMenuItem5;
设计下自动生成的代码,而再进入c1RadialMenu1 控件的item是空的,附有图片
测试发现,自己还需要设计的后台代码生成有问题,没有添加到c1RadialMenu1
this.c1RadialMenu1.Items.Add(this.radialMenuItem1);
this.c1RadialMenu1.Items.Add(this.radialMenuItem2);
this.c1RadialMenu1.Items.Add(this.radialMenuItem3);
this.c1RadialMenu1.Items.Add(this.radialMenuItem4);
this.c1RadialMenu1.Items.Add(this.radialMenuItem5);
自己必须要添加以上代码才可以,绝对应该是控件的bug了 经过几轮测试终于能有点结果了,一下是重新创建了一个form
要协助修改后台设计器生成的代码
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
this.c1RadialMenu1 = new C1.Win.C1Command.C1RadialMenu();
this.radialMenuItem1 = new C1.Win.C1Command.RadialMenuItem();
this.radialMenuItem2 = new C1.Win.C1Command.RadialMenuItem();
this.radialMenuItem3 = new C1.Win.C1Command.RadialMenuItem();
this.radialMenuItem4 = new C1.Win.C1Command.RadialMenuItem();
this.radialMenuItem5 = new C1.Win.C1Command.RadialMenuItem();
this.c1ThemeController1 = new C1.Win.C1Themes.C1ThemeController();
((System.ComponentModel.ISupportInitialize)(this.c1ThemeController1)).BeginInit();
this.SuspendLayout();
//
// c1RadialMenu1
//
this.c1RadialMenu1.AutoHide = false;
this.c1RadialMenu1.BorderWidth = 30;
this.c1RadialMenu1.ButtonRadius = 26;
this.c1RadialMenu1.Image = ((System.Drawing.Image)(resources.GetObject("c1RadialMenu1.Image")));
this.c1RadialMenu1.Items.Add(this.radialMenuItem1);
this.c1RadialMenu1.Items.Add(this.radialMenuItem2);
this.c1RadialMenu1.Items.Add(this.radialMenuItem3);
this.c1RadialMenu1.Items.Add(this.radialMenuItem4);
this.c1RadialMenu1.Items.Add(this.radialMenuItem5);
this.c1RadialMenu1.Radius = 160;
this.c1RadialMenu1.UseAnimation = true;
this.c1ThemeController1.SetTheme(this.c1RadialMenu1, "Office2007Blue");
this.c1RadialMenu1.ItemClick += new C1.Win.C1Command.RadialMenuItemClickEventHandler(this.c1RadialMenu1_ItemClick);
//
// radialMenuItem1
//
this.radialMenuItem1.Name = "radialMenuItem1";
this.radialMenuItem1.Text = "打开";
this.radialMenuItem1.ToolTip = "打开";
//
// radialMenuItem2
//
this.radialMenuItem2.Name = "radialMenuItem2";
this.radialMenuItem2.Text = "新建";
this.radialMenuItem2.ToolTip = "新建";
//
// radialMenuItem3
//
this.radialMenuItem3.Name = "radialMenuItem3";
this.radialMenuItem3.Text = "另存";
this.radialMenuItem3.ToolTip = "另存";
//
// radialMenuItem4
//
this.radialMenuItem4.Name = "radialMenuItem4";
this.radialMenuItem4.Text = "打印";
this.radialMenuItem4.ToolTip = "打印";
//
// radialMenuItem5
//
this.radialMenuItem5.Name = "radialMenuItem5";
this.radialMenuItem5.Text = "预览";
this.radialMenuItem5.ToolTip = "预览";
//
// c1ThemeController1
//
this.c1ThemeController1.Theme = "Office2007Blue";
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(659, 366);
this.Name = "Form1";
this.Text = "Form1";
this.MouseClick += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseClick);
((System.ComponentModel.ISupportInitialize)(this.c1ThemeController1)).EndInit();
this.ResumeLayout(false);
}
同时添加了ItemClick事件,把Item的text内容显示出来
private void c1RadialMenu1_ItemClick(object sender, C1.Win.C1Command.RadialMenuItemClickEventArgs e)
{
C1.Win.C1Command.RadialMenuItem rmi = e.RadialMenuItem as C1.Win.C1Command.RadialMenuItem;
if (rmi != null)
{
string str = rmi.Text;
MessageBox.Show(str);
}
}
private void Form1_MouseClick(object sender, MouseEventArgs e)
{
if (e.Button == System.Windows.Forms.MouseButtons.Right)
c1RadialMenu1.ShowMenu(this, new Point(600, 500), true);
if (e.Button == System.Windows.Forms.MouseButtons.Left)
c1RadialMenu1.HideMenu();
}
一下是效果图
距离我原来的效果再差一步距离了,望葡萄城的高手赐教了 回复 7楼liujun_sx的帖子
不好意思,回复晚了。
发现你很厉害的已经完成了大部分功能,不知道能否把Sample发出来,有例子可以有更多的金币奖励,可以换取我们的礼品。金币兑换 回复 6楼liujun_sx的帖子
这个问题我已经重现,我会反馈到产品组确认是,谢谢你指出这个问题。 回复 7楼liujun_sx的帖子
你好,这是产品的设计,鼠标Hover的时候,显示C1RadialMenuItem.HightlightColor属性设置的高亮的边框,如你图上的效果。如果想要明显一点的效果,可以设置C1RadialMenuItem.HotExpandableBorderColor属性,并且给该Item添加子Item,当鼠标Hover的时候,会有如下的效果,和没有子Item的项目区别:
参考代码:
//
// radialMenuItem1
//
this.radialMenuItem1.HotExpandableBorderColor = System.Drawing.Color.Green;
this.radialMenuItem1.Name = "radialMenuItem1";
this.radialMenuItem1.Text = "打开";
this.radialMenuItem1.ToolTip = "打开";
this.radialMenuItem1.Items.Add(this.radialMenuCommandItem1);
//
// radialMenuCommandItem1
//
this.radialMenuCommandItem1.Text = "Bold";
页:
[1]
2