|
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
|
|
|
|
|
Scenario:
Computer A has an instance of a windows form it wants to send to ComputerB. Computer A and B are running the same application and are on the same physical and logical network.
How might I best go about achieving this?
Thanks in advance
|
|
|
|
|
Question: any windows form or windows forms of a application you programmed? Do you want to control Computer A with the form copied to Computer B or do you want just to show the content?
Greetings,
Ingo
------------------------------
A bug in a Microsoft Product? No! It's not a bug it's an undocumented feature!
|
|
|
|
|
Copmuter A and B are running the same application written by me. Computer A wants to "send" the form and its contents to Computer B where it is displayed in its exact same state as it left Computer A
|
|
|
|
|
I need to embved a quote(") into a string i tried \" but that doesn't remove the \ on runtime. I am trying to make a reuseable RegEx statement.
Regex rxFind = new Regex(szQuery);
When I run the code, szQuery contains the \" instead of just the ".
How do I fix this, or what is the better way to do this?
|
|
|
|
|
Embedding a quote into a string with \" does remove the \ on runtime, unless you are accepting input from the user, in which case, you do not need to escape the quote.
If you are trying to make a reusable Regex statement, you will always want to do:
Regex rxFind = new Regex(Regex.Escape(szQuery));
This makes sure that all characters that are part of the syntax of reguar expressions are translated so that they do not effect the expression.
Seperately, you could add more slashes (\\\" instead of \"), because they are significant in Regexes.
|
|
|
|
|
Is it possible to attach ToolTips for individual tabs of a TabControl?
I've tried setting ToolTips to TabPage and TabControl, but both attemps failed.
This works in Mozilla browser for both selected and unselected tabs.
The only solution I thinked up was to catch MouseMove events of a TabControl and look which tab is currently under mouse cursor. There's still a problem of how to show ToolTip (or something similar) statically. But I believe there's some cleaner and easier way.
|
|
|
|
|
You have to set the 'ShowToolTips' Property of the Tabcontrol to true before the Tooltips of the tabpages are shown.
Greetings,
Ingo
------------------------------
A bug in a Microsoft Product? No! It's not a bug it's an undocumented feature!
|
|
|
|