|
That doesn't look like C# to me!
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Maybe it is .Net 5.
|
|
|
|
|
Besides, this code has been written using C++ MFC, but you can easily convert it into C#.NET
|
|
|
|
|
This code is just a prototype and describes the basic concept of notify message handling, it's no matter you implement it in C++ or C#. The notify message handling works similar in either C#.NET or C++ MFC. The main post of this post is the concept.
|
|
|
|
|
Sadly I don't think it does do what I need. Basically I want the RichTextBox to display text, with the correct font, bold, background colour, etc, but to be transparent to mouse events such as double click.
I am able to intercept mouse double clicks in a class derived from RichTextBox, and SendMessage them to the parent form. They are passed in to the parent form WndProc. But for some reason they do not invoke the MouseDoubleClick event handler. I tried overriding the Form.WndProc, but could not invoke MouseDoubleClick, for reasons I understand.
|
|
|
|
|
Surely, because in Win32API, to be able to handle control's messages in parent window you have to send and process notification messages. For example, if you need to process MouseDblClick message outside the RichEditCtrl, first you have to handle this message in RichEditCtrl window class by posting WM_NOTIFY message and then process the WM_NOTIFY in the parent window as just I have shown in my reply.
|
|
|
|
|
|
Baby, help me solve my problem: FormDesigner Runtime
|
|
|
|
|
I made a function of having a Form Designer software.
In this software, I use this namespace:System.Drawing.Design.
I use the following code in my program is designed .to Program run A pop-up It is designed to form.
Now I have a problem: How can The program Run time Right click It is designed to form A pop-up with a menu.
DesignSurface surface = new DesignSurface();
surface.BeginLoad(typeof(Form));
Control view = (Control)surface.View;
view.Dock = DockStyle.Fill;
this.Controls.Add(view);
toolBoxService = new DemoToolboxService();
toolBoxService.ToolBox = new ListBox();
toolBoxService.ToolBox.Items.Add(new ToolboxItem(typeof(Button)));
toolBoxService.ToolBox.Items.Add(new ToolboxItem(typeof(TextBox)));
toolBoxService.ToolBox.Items.Add(new ToolboxItem(typeof(Label)));
toolBoxService.ToolBox.Items.Add(new ToolboxItem(typeof(TabControl)));
toolBoxService.ToolBox.Items.Add(new ToolboxItem(typeof(StatusBar)));
toolBoxService.ToolBox.Dock = DockStyle.Fill;
this.panel1.Controls.Add(toolBoxService.ToolBox);
IServiceContainer container = surface.GetService(typeof(IServiceContainer)) as IServiceContainer;
if (container != null)
{
container.AddService(typeof(IToolboxService), toolBoxService);
}
|
|
|
|
|
How to do Automatically select the Next items of list box using Timer?
|
|
|
|
|
It depends on the UI technology you use, but for example if you use forms, you can create the timer and wire Tick[^] event. In the event, you set the SelectedItem[^] property.
|
|
|
|
|
Keep a class level index to the currently selected item, and either use it to set the ListBox.SelectedIndex property, or to pick the appropriate entry from the ListBox.Items collection.
In your timer Tick handler, you use the index and increment it.
What part of this is giving you difficulties?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
if i click the button,list box items automatically go to next and display the image.Each image displayed at 10 second.
Timer t= new timer();
private void button_click(object ,Event )
{
for(int i=0;i<listbox1.items.count;i++)
{
if(i<=listbox1.items.count)
{
listbox1.SelectedIndex =i;
t.Tick += new System.EventHandler(showcurrentimage);
t.interval=10*1000;
t.start();
}
}
}
private void showcurrentimage (object , event)
{
picture.Load(listbox1.Selecteditems.Tostring());
t.sop();
}
|
|
|
|
|
Why are you adding a new tick event for each iteration round the loop?
You do realize that you will get a Tick event handler call for each time you add it?
Seriously, start by moving the timer setup code to your form load, and start it only once.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
ok,how to use the Tick event with out loop? please show any example code
|
|
|
|
|
The whole idea of a tick event is that you don't need a loop!
Try an experiment: set up and start your timer in the load event, and make the tick event write to the console:
Console.WriteLine(DateTime.Now); Comment everything else out of the handler.
Run your app in the debugger, and look at the output pane. See what I mean?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Baby, help me solve my problem: FormDesigner Runtime
|
|
|
|
|
Increase the SelectedIndex of the ListBox in the Timer_Tick event handler. Build in safeguard to reset index after last item in the list.
|
|
|
|
|
|
What the elephant?
"I had the right to remain silent, but I didn't have the ability!"
Ron White, Comedian
|
|
|
|
|
Keep asking for Skype accounts and you'll just get banned from the site.
|
|
|
|
|
I'm trying to pass the image from one form1 to form2 . Actually the list box have 10 images in the form1 ,and the preview button also.
if i click the preview button in the form1,the image displaying in form2.how to do this?
|
|
|
|
|
You already asked this here[^].
Don't repost the same question over and over again and ignore the answers you're given.
|
|
|
|
|
I am an amateur programmer, English is very poor, don't laugh at me。
I do has a table single design device, inside can like Visual Studio as edit table single, I using has this named space: "" using System.ComponentModel.Design; ", was design of form I said it for: canvas, now has a trouble is: how in canvas was edit of when, is added controls of when, right key canvas Shang of design controls, pop-up a has" revoked, and next, and copy, and paste, and delete, and level "Features such as menus. Thank you
Partial code:
DesignSurface surface = new DesignSurface();
surface.BeginLoad(typeof(Form));
Control view = (Control)surface.View;
view.Dock = DockStyle.Fill;
this.splitContainer1.Panel1.Controls.Add(view);
this.propertyGrid1.SelectedObject = surface.ComponentContainer.Components[0];
modified 13-Aug-15 7:59am.
|
|
|
|
|