|
I have made a button on my main form and I want it to show a ContextMenu when the button is clicked, not when you Right click it. Like start button on windows
In the end we're all just the same
|
|
|
|
|
Catch the MouseDown / MouseUp events there you can call a context menu even when the left Mousebutton is pressed.
<br />
private void btnMenu_MouseDown(object sender, MouseEventArgs e) {<br />
btnCreateReport.ContextMenuStrip = cmnStartMenu;<br />
this.btnCreateReport.ContextMenuStrip.Show(this.Location.X + btnMenu.Location.X + e.X, this.Location.Y + btnMenu.Location.Y + e.Y);<br />
} <br />
Where cmnStartMenu is a ContextMenuStrip
------------------------------
A bug in a Microsoft Product? No! It's not a bug it's an undocumented feature!
|
|
|
|
|
Thanks.
Now I would like this menu to be twice the size when it appears. How would you do this?
Also how would you add a sound to this menu so when you click the button, a sound is played?
In the end we're all just the same
-- modified at 8:10 Wednesday 8th February, 2006
|
|
|
|
|
|
I have a problem with the code:
private void btnMenu_MouseDown(object sender, MouseEventArgs e) {
btnCreateReport.ContextMenuStrip = cmnStartMenu;
this.btnCreateReport.ContextMenuStrip.Show(this.Location.X + btnMenu.Location.X + e.X, this.Location.Y + btnMenu.Location.Y + e.Y);
}
AN error message says:
Cannot find this.Location on Information_Device form and its the same with btnCreateReport what should I do?
In the end we're all just the same
|
|
|
|
|
Here is the error I get when I impliment the code:
The type or namespace 'btnCreateReport' could not be found (are you missing a using directive or an assembly refference?)
Information_Device.MainMenu does not contain a definition for btn_CreateReport
MainMenu is name of form with button on it.
What is 'btn_CreateReport?'
Aslo I forgot to say that I'm using Visual C# .net 2003, not 2005
In the end we're all just the same
-- modified at 5:28 Monday 6th March, 2006
|
|
|
|
|
Hi friends,
I am developing windows based application.. I am using ListBox in my application.. I dont know how to insert the images in the listbox control items.. I want to display seperate images for the items in the listbox.. Any help or suggesstion is helpful to do that..
Thanks in advance
Regards,
SAravanan
|
|
|
|
|
First, create a class that contains image, something like this:
<br />
public class ListBoxItem {<br />
<br />
public Image img;<br />
public string text;<br />
<br />
public override ToString() {<br />
return text;<br />
}<br />
}<br />
Then you need to create owner-drawn ListBox (which iherits a ListBox class).
First, set DrawMode property to OwnerDrawFixed or OwnerDrawVariable (i like the second one).
Then you need to override OnMeasureItem and OnDrawItem methods. Make sure, you've set right size for the item in measuring method so you can draw it properly later. If you want to use images with alpha channel, use ImageList.Draw which can do the job.
|
|
|
|
|
Will u please post the code.. because i am a newbiew to C#.Net
Thanks for ur help
Regards,
Saravanan
|
|
|
|
|
I need write application, so get Ip address in local network .
How much?
Thanhk.
|
|
|
|
|
If you want to find your own Ip Address, you could use this.[^]
|
|
|
|
|
If you have DNS you could just use HostIP = System.Net.Dns.GetHostByName(ServerName);
and if you have AD, you could do a DirectorySearch of computers and get a list by name, then use that to retireve the "ServerName" for your dns lookup
string Beautiful;
Beautiful = "ignorant";
label1.Text = "The world is full of " + Beautiful +" people.";
Why is common sense such an un-common comodity?
|
|
|
|
|
What would be the best way to backup my database via my program. So that the user can just click on backup and it wil backup the entire database.
Is there a sql command that I can send to the database that will fire a backup process of somesort, or will I have to export the data manualy via the program?
Thanx in advance
|
|
|
|
|
Hi All,
I've got a Windows Form which have GDI graphics drawn onto them. In addition, I have a Panel on this form which I add other Windows controls to. When I activate the graphics, they display under the panel that is also on the form no matter what the z-index is set to on the panel. How can I have the graphics display ontop of the panel? I don't want to add them to another panel because I want the other panels to be seen under the graphics, something another panel would not allow.
Thanks in advance,
Eric
|
|
|
|
|
I don't really understand the Problem, but I try to find an answer anyway:
You can draw into a Panel, but the GDI Graphics are background graphics, so you can't overwrite a control easily. Another possibility is to make the panel transparent, so you can draw on the Form, but the drawing is seen even under the panel. For that you should look up http://www.codeproject.com/cs/media/CsTranspTutorial3.asp[^]
Greetings,
Ingo
------------------------------
A bug in a Microsoft Product? No! It's not a bug it's an undocumented feature!
|
|
|
|
|
You got the problem right on. I figured that would be the case but wanted to see for sure. Can it work the other way. I.e. you can draw on a panel, make the panel transparent and make it top of the z-order, and the drawning and things under the panel will still show?
Thanks so much for your help,
Eric
|
|
|
|
|
Hi
I work on a ASP.net Webapplication where a user can interact with the Microsoft.Ink.
I push a Windows.Forms.Control on the client. In this control i implement some methods. On the client i can use them by using javascript.
I got the following problem.
This is the Method in the UserControl that gives me a Base64String..
<br />
protected String SerializeInkData()<br />
{<br />
if(inko.Ink.Strokes.Count > 0) <br />
{<br />
byte[] inkDataBytes = inko.Ink.Save(PersistenceFormat.Gif);<br />
return Convert.ToBase64String(inkDataBytes);<br />
}<br />
<br />
return String.Empty;<br />
}<br />
And then give it back..
<br />
public string InkData <br />
{<br />
get <br />
{<br />
if (inko.Enabled) <br />
{<br />
return SerializeInkData();<br />
}<br />
else<br />
{<br />
return String.Empty;<br />
}<br />
}<br />
} <br />
Ok.. on the client I call the InkData Method by using javascript and save the Data into a hidden field. The client app is a asp.net site.
While the site is post back to the server i read the content of the hidden field and try to save it in a database.
The Column is from datatype IMAGE.
But it don't work. I think that i have to convert the string of the hidden field into an byte[] Array.. But how?
<br />
SqlConnection conn = new SqlConnection(connStr);<br />
<br />
conn.Open();<br />
<br />
string img = this.BodyInkData.Value;<br />
<br />
string insert = "INSERT INTO TestTable (Image) VALUES ('" + img + "')"; <br />
SqlCommand cmd = new SqlCommand(insert,conn);<br />
<br />
cmd.ExecuteNonQuery();<br />
<br />
conn.Close();<br />
How can I convert the string to a byte[] and save as BLOB into the Database?
Greeting from Germany
-- modified at 3:43 Wednesday 8th February, 2006
|
|
|
|
|
Hi All, quick question.
How do I create update files, so that when I made changes to the program, I don't have to uninstall the other one and replace it with the new one.
And what exactly do I need, cab files? And how does it work?
Thanx in advance.
|
|
|
|
|
When you make a setup-project you can say if the application has to be uninstalled first or not. The you generate a normal setup file (msi or cab).
Greetings,
Ingo
------------------------------
A bug in a Microsoft Product? No! It's not a bug it's an undocumented feature!
|
|
|
|
|
Hey howzit!
Imagine my form: it has a Panel displaying an image, this image represents an paper application form (e.g. credit card application). My application places textbox's over various areas of this "paper form" to allow for user input.
I want to beable to zoom into this "paper form" i.e. all the controls must dynamically resize (incl. the text inside the textboxes) in a similar fashion to how MS Word zooms.
Can anyone help?
|
|
|
|
|
This zooming cand be achived by changing the text's size into all of your zoomed controls.
Assuming that you have a big label and a few text boxes over it, simply cahnge the label's text size and then the text boxes's text size.
protected internal static readonly ... and I wish the list could continue ...
|
|
|
|
|
Hi Vlad,
Thanks for your message.
I am not that clear about what you are saying, could you please give me an example with all the code, I would really appreciate it a lot?
|
|
|
|
|
e.g.:
Textbox.Font.Size = 12 * ScaleFactor;
Where ScaleFactor 1 is 100 Percent, and ScaleFactor 1.5 is 150 percent and so on.
You have to change the FontSize of every Control as said.
------------------------------
A bug in a Microsoft Product? No! It's not a bug it's an undocumented feature!
-- modified at 5:07 Wednesday 8th February, 2006
|
|
|
|
|
I want to develop a program that would permit me to sign on a computer at the logon screen. I assume that a windows service running with system permissions would be running in time to actually execute this, but I have no idea what I should research to interact with the logon screen.
All help would be appreciated!
Did I post well? Rate it! Did I post badly? Rate that too!
|
|
|
|
|
Esmo2000 wrote: I have no idea what I should research to interact with the logon screen.
I'm not entirely sure if this is what you want, but allow me to introduce you to my friend GINA[^], the Graphical Identification and Authentication component. Crappy acronym, I know.
Share and enjoy.
Sean
|
|
|
|