|
Hi, I hope you can help me with this; I've a drawing application where the user drags items from the ribbon and places them on a "canvas" (in fact it's a PictureBox control). The items on the ribbon are RibbonButtons with images. This all works, except when I drag the item, the button is shown with focus after the mouse has left the button - it's highlighted. To clear it, I have to move the mouse over the button. If I don't do that, I end up with several buttons all focused. Is there anyway to programatically, remove focus from a ribbon object?
I've done some more looking and I think the problem only occurs if a dodragdrop is performed. As the RibbonButton doesn't have a dodragdrop method, I use an invisible label. However, when the dragdrop is completed - and the mouse is released, there's no mouseup event for the button, so the button doesn't get repainted. I've tried doing a btn.OnMouseUp call but that doesn't do it. I also modified the ribbon code to expose the selected flag and turn that off and do a repaint, but I can't find where the ribbon code actually paints a normal, non-selected button - can someone point me to that - then I can make that public and force a repaint.
-Andrew
modified 21-Feb-17 5:44am.
|
|
|
|
|
I've resolved the problem; I was starting the dragdrop when the button had a mousedown event. I've changed that to a mouseleave - and after checking the button state, do the dragdrop. That fixes the problem.
|
|
|
|
|
Actually, that didn't quite resolve the problem. Occasionally a button is left as if the mouse is over it, even if it isn't and the only way to get rid of the effect is to move the mouse over the button and out again. I have "solved" the problem, but it's pretty nasty; when the mouse leaves the panel containing the buttons, the program goes through each button, makes a copy and replaces it in the panel. That does fix it.
|
|
|
|
|
it's real good, thank you so much it's very usefull component, and ask you if can you give me the general idea to design like this ribbon.
execuse me for my language, it's not good.
Khaled 2007 MA
|
|
|
|
|
I made a working sample, and then copied the bin to another computer. Neither the release nor debug versions work. The form will open, but it will not load the ribbon. The ribbon dll is present, do I need to specify a dynamic location to the path somehow?
edit-The target computer did not have .net4. I'm not sure why I didn't get any kind of prompt. I figured it out by changing the project to .net2 and it suddenly worked on the target computer. I changed the project back to .net4 and the target computer suddenly gave me a prompt to download .net4. So I guess I've got it figured out.
modified 3-Jan-17 12:26pm.
|
|
|
|
|
i have just finished a small project and i used installshield to deploy it.after a successfull installation in another pc and when i'm trying to lunch the application an error accured in a message box
<Could not load file or assembly 'System.Windows.Forms.Ribbon35, Version=3.5.8.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.file not found
File name: 'System.Windows.Forms.Ribbon35, Version=3.5.8.0, Culture=neutral, PublicKeyToken=null'
>
whats the solution pl
|
|
|
|
|
I'd like to allow mouse wheel scrolling through a combo box. I know that the Ribbon combo boxes aren't true combos (in the winforms sense), but reckon I could implement it well enough - except there's no mousewheel event listener in the RibbonComboBox. There's the other usual mouse events, such as mouse enter, mouse down etc, but not the mouse wheel one.
So, is there a workaround for this or a way to add this support?
Nearly forgot to say - other than this, this winforms ribbon is awesome!
|
|
|
|
|
D'oh. I realised that the Ribbon itself is a proper Control, so does support a MouseWheel event. By looking at the mouse location, it's easy enough to find the Panel and Item under the mouse, check if it's a RibbonComboBox and then move the selection up or down as appropriate.
private void Ribbon1_MouseWheel(object sender, MouseEventArgs e) {
Point p = e.Location;
RibbonTab tab = ribbon1.ActiveTab;
foreach (RibbonPanel panel in tab.Panels) {
if (!panel.Bounds.Contains(p)) {
continue;
}
foreach (RibbonItem item in panel.Items) {
if (!item.Bounds.Contains(p)) {
continue;
}
if (item is RibbonComboBox) {
RibbonComboBox combo = (RibbonComboBox)item;
ScrollRibbonCombo(combo, e.Delta > 0);
}
}
}
}
private void ScrollRibbonCombo(RibbonComboBox combo, bool up) {
if (combo.DropDownItems.Count == 0) {
return;
}
RibbonItem selection = combo.SelectedItem;
RibbonItem newSelection = selection;
if (selection == null) {
if (up) {
newSelection = combo.DropDownItems.Last();
} else {
newSelection = combo.DropDownItems.First();
}
} else {
int index = combo.DropDownItems.IndexOf(selection);
if (up && index > 0) {
newSelection = combo.DropDownItems[index-1];
} else if (!up && index+1 < combo.DropDownItems.Count) {
newSelection = combo.DropDownItems[index+1];
}
}
if (newSelection == null) {
return;
}
combo.SelectedItem = newSelection;
RibbonItemEventArgs args = new RibbonItemEventArgs(newSelection);
combo.OnDropDownItemClicked(ref args);
}
|
|
|
|
|
first of all Thank You Guys for such a great job.
I was using ribbon in MDI forms so wanted to enable disable tabs as per form values.
Can you please suggest anything. Thank you in advance
|
|
|
|
|
i want to ask with based on this article,, how to call event button click from mdiParent. i mean like this: i have more form, form1 is MDIcontainer having more button, when i change form to form2 i want to access event button click in ribboncontrol form1. so what should i do for this problem?
thanks before.
|
|
|
|
|
The question is none of ribbon button's business.
u may use event delegate like this
in form2 declare event handler
public partial class Form2 : Form
{
public event EventHandler mecliked;
private void button1_Click(object sender, EventArgs e)
{
if (mecliked != null)
mecliked(sender, e);
}
}
in form1 declare like this
private void frmMain_Load(object sender, EventArgs e)
{
rbnNew.Click+=rbnNew_Click;
Form2 frm = new Form2();
frm.Show();
frm.mecliked += frm_mecliked;
}
void frm_mecliked(object sender, EventArgs e)
{
MessageBox.Show("form1 me.clicked");
}
|
|
|
|
|
Isn't numeric updown working ?
|
|
|
|
|
Thank you for this article, very helpful for understand and get started leveraging ribbon ui
|
|
|
|
|
I have a VB project (stringed instrument chord shapes with backend SQL database) that relies totally on the standard Graphics facilities. I wanted to update the UI with a ribbon, but when I looked at WPF with its ribbon control, I freaked out because I would have had to totally rewrite all the code, some of which dates back to 2006 when I wrote the kernel in VB6 one Christmas in London. Using this ribbon, I was able to leave all my historic (and fully tested) code in place, and simply provide at least a more modern UI.
Great stuff, folks!
|
|
|
|
|
Hello,
programmatically I tried to edit the list of "recent items"
But does not redraw the control
it's possible?
for example:
Ribbon1.OrbDropDown.RecentItems.Clear()
Dim ri As New RibbonOrbRecentItem()
ri.Text = "Test"
ri.Value = "Test"
Ribbon1.OrbDropDown.RecentItems.Add(ri)
AddHandler ri.Click, AddressOf Ribbon_OrbRecentItemsClicked
Ribbon1.Refresh()
Me.Refresh()
thank you
ciao
Karim
|
|
|
|
|
Hello,
Did you get it work?
Kind regards.
|
|
|
|
|
How can I add a contextual tab for this ribbon??
|
|
|
|
|
|
thanks, but these Items dont show in my project. I downloaded the data again and replaced with the new one, but the result is the same.
|
|
|
|
|
Thats because there hasn't been a new relase since.
You need to download the latest sources from the repository an build the binaries yourself.
|
|
|
|
|
Hi,
it is possible to resize the image that I have associated to the ribbon button, and stretch the image to the new size?
I have added a image 64x64 but I would like size 48x48. I have modified MaximumSize and MaxSizeMode but any effect on the desired result. I always get an image 64x64 size.
Thanks and best regards!
Enric
|
|
|
|
|
The themeColor property is not doing anything.
Is this intentional?
Even if I try to set it programmatically, with
ribbon1.ThemeColor = RibbonTheme.Black;
ribbon1.Refresh();
Besides that, this is a fantastic addition to Windows Forms.
EDIT:
This works.
Theme.ColorTable = new RibbonProfesionalRendererColorTableBlack();
ribbon1.Refresh();
this.Refresh();
modified 27-Aug-15 4:29am.
|
|
|
|
|
That should work. Please check the RibbonDemo:
private void btMainForm_Click(object sender, EventArgs e)
{
MainForm f = new MainForm();
ApplySelectedTheme(f);
f.Show();
}
which is more or less doing what you do:
ribbon.ThemeColor = (RibbonTheme)Enum.Parse(typeof(RibbonTheme), cmbColor.Text);
Remark:
It might be possible that this is only working BEFORE the form is shown.
|
|
|
|
|
Hi,
In the Ribbon using keyboard Tab button, ribbon button are not being selected, Please provided me solution for this ASAP.
|
|
|
|
|
I got an error while working with the ribbon control. The build seems fine. But whilst running, an exception occuring from form.designer.cs saying "Invalid window handle".
private void InitializeComponent()
{
this.SuspendLayout();
.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.ClientSize = new System.Drawing.Size(879, 475);
this.Font = new System.Drawing.Font("Calibri", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.Name = "Form1";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Form1";
this.ResumeLayout(false);
ribbon1 = new System.Windows.Forms.Ribbon();
this.Controls.Add(ribbon1);
}
private System.Windows.Forms.Ribbon ribbon1;
I checked into stacktrace and haven't found any leads.
ComponentModel.Win32Exception {"Invalid window handle"}
ErrorCode : -2147467259
StackTrace :
at System.Windows.Forms.RibbonHelpers.GlobalHook.InstallHook()
at System.Windows.Forms.RibbonHelpers.GlobalHook..ctor(HookTypes hookType)
at System.Windows.Forms.Ribbon.SetUpHooks()
at System.Windows.Forms.Ribbon.OnParentChanged(EventArgs e)
at System.Windows.Forms.Control.AssignParent(Control value)
at System.Windows.Forms.Control.ControlCollection.Add(Control value)
at System.Windows.Forms.Form.ControlCollection.Add(Control value)
at Project1.Form1.InitializeComponent() in Form1.Designer.cs:line 43
at Project1.Form1..ctor() in Form1.cs:line 16
at Project1.Program.Main() in Program.cs:line 18
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
Can u help with this issue?
|
|
|
|