|
ok thats DataGridView..is there any event by i can handle the button event ...
|
|
|
|
|
CellContentClick is the event by which u can handle the click events of button.
Just add buttons at design time using smart tag that u know.
In eventHandler give MassageBox.Show("Ok");
On Clicking button in datagridview u will see this msg.
|
|
|
|
|
ok thats right...but cellcontent_click event is fired when u click the header of the datagridview...then its a problem...
|
|
|
|
|
So inspect the event arguments (e) to determine who clicked it.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
No. Its not. You will get the event on clicking control that u have added(like as checkbox,button,combobox etc.). Just cross check...
It works properly.
|
|
|
|
|
Please take a look at this reply to a similar question in the VB forum. RE-How-can-i-get-this-checkbox-to-work-when-it-is-selected.aspx[^]
As it is in the VB forum it is in VB.Net but you should be able to follow well enough to convert it into C#
Hope this helps.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Use the "CommandName" property of the Button and set it to What ever name you want to give and the "CommandArgument" property to the unique id of that row to get the same.
You can catch the same in the RowCommand Event of the Gridview as
if (e.CommandName == "WhatEverYouNamed")
{
}
Using this you can have multiple buttons doing multiple things in one gridview.
Regards,
Kaushal Arora
Please Mark as Answer if it solved your problem.
|
|
|
|
|
I can get the WM_CREATE msg in WndProc when I click button1,but it didn't fired at the PreFilterMessage.
Follow is the source code.Thanks!
static class Program
{
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
filter ft = new filter();
Application.AddMessageFilter(ft);
Form1 f = new Form1();
f.Show();
Application.Run();
}
}
public class filter : IMessageFilter
{
#region IMessageFilter 成员
const int WM_CREATE = 0x00001;
public bool PreFilterMessage(ref Message m)
{
<code> if (m.Msg == WM_CREATE)
{
MessageBox.Show("A");
return true;
}</code>
return false;
}
#endregion
}
public partial class Form1 : Form
{
#region Designer
private System.ComponentModel.IContainer components = null;
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows 窗体设计器生成的代码
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
this.button1.Location = new System.Drawing.Point(0, 0);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 0;
this.button1.Text = "button1";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(609, 265);
this.Controls.Add(this.button1);
this.Name = "Form1";
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Button button1;
#endregion
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
Form1 f = new Form1();
f.Show();
}
const int WM_CREATE = 0x00001;
protected override void WndProc(ref Message m)
{
<code> if (m.Msg == WM_CREATE)
{ MessageBox.Show("B"); }
base.WndProc(ref m);</code>
}
}
|
|
|
|
|
Because you have already overridden it in the Form. So I guess additional message filters won't execute. Also use this[^] overload of Application.Run .
|
|
|
|
|
Thanks,
I remove the override method of WndProc from form1,but it didn't work fine.
PS: We can capture all msgs except the WM_CREATE in PreFilterMessage method.
N a v a n e e t h wrote: Also use this[^] overload of Application.Run.
I have changed
Form1 f = new Form1();<br />
f.Show();<br />
Application.Run();
to
Application.Run(new Form1());
May be I didn't clear what you mean.
|
|
|
|
|
It seems it wasn't catch by PreFilterMessage.
Is there some way to catch WM_CREATE for all forms in my application without override those WndProc in each winform?
|
|
|
|
|
I reproduced the problem you are saying. Sadly, I don't have any solution to offer.
hwswin wrote: Is there some way to catch WM_CREATE for all forms in my application without override those WndProc in each winform?
Yes. Just create a class which derives from System.Windows.Forms.Form and override the WndProc there. You can derive all your forms from this class.
|
|
|
|
|
Ok, Here is my thought on this
The filter added using Application.AddMessageFilter will only get called for messages posted to the message queue. Some win32 messages like WM_CREATE will be sent directly to the control. If you see the win32 APIs, there are SendMessage and PostMessage available. SendMessage doesn't post the message to queue and the messages sent by SendMessage won't be caught by the filter. PostMessage posts the message to the application message queue and filter gets called.
I guess this would be the reason for filter not getting called.
|
|
|
|
|
Thks again!
Greate,Use the hook can figure out my "Question".
<a href="http://support.microsoft.com/default.aspx?scid=kb;en-us;318804">See here</a>[<a href="http://support.microsoft.com/default.aspx?scid=kb;en-us;318804" target="_blank" title="New Window">^</a>]
|
|
|
|
|
Curently i take a picture from webcam and load into the picture box by this way. take picture and save in to hard disk and load it again into picture box. is there any easy way to do this?
try
{
DeviceManager manager = new DeviceManagerClass();
Device d = null;
foreach (DeviceInfo info in manager.DeviceInfos)
{
d = info.Connect();
}
int i = 0;
Item item = d.ExecuteCommand(CommandID.wiaCommandTakePicture);
foreach (string format in item.Formats)
{
WIA.ImageFile imagefile = item.Transfer(format) as WIA.ImageFile;
imagefile.SaveFile("d:\\" + i + ".jpeg");
pictureBox1.Image = Image.FromFile("d:\\" + i + ".jpeg");
i++;
A S E L A
|
|
|
|
|
Well, no, because the file you have, is not a .NET bitmap or image object. If you can save from the ImageFile to a memory stream, you could use that as a point of conversion.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
that mean i need to save the image in a memory stream to use is back, am i correct?
is there a way to convert in to Image?
A S E L A
|
|
|
|
|
Hi everybody!
I use tool WebBrowser in VS2008 to load image from Page web to my computer, but I want do it.
Help me!
Thanks you very much
|
|
|
|
|
I'm sorry, but I don't understand. You're using the webbrowser control ? You say you've opened a web page ? So, what do you want to do ?
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
I want copy the image from web in control webbrowser for application to my computer
If I do by hand, i have must click right mouse, choose save as picture, I want to do automation work by programming
|
|
|
|
|
Hello
I'm looking for some Csharp component to display all character of a selected font, allowing selection
Charmap.exe is a good example
It can be very usefull in order to select special character as Webdings, Windings, Symbols or cyrillic . etc
Any idea ?
Thanks for your help
|
|
|
|
|
I would try a TextBox (set to multi-line) or a RichTextBox; insert the appropriate characters, and then set the font as required.
Or you could use a whole bunch of Labels .
|
|
|
|
|
Someone did a similar thing here (can't post the code, I'm afraid) by :
For each char from 32 to 255
create a label with a border, width and height as appropriate, and the font set to the desired font, Text of the char.ToString();
The labels can then be positioned however you want for a pleasing display.
On the click event of the label, it displays the same character in a label using the same font with an increased size, and on double-click it raises a 'CharacterSelected' event which pass back the font and character selected.
Should be enough to get you started?
___________________________________________
.\\axxx
(That's an 'M')
|
|
|
|
|
Yeah, but how can one find out ALL the characters present in a specific font, without looping all Unicode char codes and measuring string width looking for non-zero?
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|
not sure you need to - just display 'em - you'll get an empty box if they're not defined in that font.
___________________________________________
.\\axxx
(That's an 'M')
|
|
|
|