|
I'm no expert for J# (to be honest; I've never used it ), but after taking a quick look I think the following could work:
e.get_Graphics().DrawString(listBox1.get_Items().get_Item(e.get_Index()).ToString(), ...
www.troschuetz.de
|
|
|
|
|
Here's my guess:
Brush myBrush = Brushes.get_Blue();
if( listBox1.get_SelectedItem() != null )
e.get_Graphics().DrawString( listBox1.get_SelectedItem().toString(),
this.get_Font(),
myBrush,
(float)e.get_ClipRectangle().get_X(),
(float)e.get_ClipRectangle().get_Y() );
I simplified a little, because I couldn't tell which overload you wanted; you seemed to want to pass a Rectangle where as it looks like a RectangleF is required in a couple of the overloads.
Matt Gerrans
|
|
|
|
|
Thanks Stafan and Matt for your responses.
Unfortunately I am still getting compiling errors. Matt’s suggestion of : (float)e.get_ClipRectangle().get_X(), does not work as get_ClipRectangle() is not a member of ‘e ’.
This is my whole method:
<br />
private void listBox1_DrawItem(Object sender, System.Windows.Forms.DrawItemEventArgs e)<br />
{ <br />
listBox1.set_DrawMode(DrawMode.OwnerDrawFixed);<br />
e.DrawBackground();<br />
Brush myBrush = Brushes.get_Black();<br />
<br />
switch (e.get_Index())<br />
{<br />
case 0: myBrush = Brushes.get_Red(); break;<br />
case 1: myBrush = Brushes.get_Orange(); break;<br />
case 2: myBrush = Brushes.get_Purple(); break;<br />
}<br />
e.get_Graphics().DrawString(listBox1.get_SelectedItem().toString(),this.get_Font(),myBrush,(float)e.get_ClipRectangle().get_X(),(float)get_ClipRectangle().get_Y());<br />
<br />
e.DrawFocusRectangle();<br />
<br />
}<br />
Any other ideas will be gratefully received.
Thanks,
Harold Clements
|
|
|
|
|
Hello everybody.
Can you please help me in writing a code to find Serial Number of a fresh CD-ROW-Disk.
Actually, I have to make a utility using any of the tool (C# / VB / or C)
which can read serial number of a CD (fresh or open-session cd).
Awaiting for any solution.
Thanks.
Sharad
|
|
|
|
|
hi,
i hve developed a client server application in c#. This application have a security server and client. i test it on a machine where .net is not installed.
i install there .net frame work, MSDE for sqlserver and application it is working well.
but on client side when i try to run this application it throws "an unhandled exception" thread code nothing else.
amazing thing is if i run security server on a different machine client runs well.
tell me what will be possible problem there.
regards,
farukh.
farukh ali farooq
|
|
|
|
|
hi every 1,
i'm working on a networking project "Simple Project" and i want to transfer files in this network how should i do this , i know a littel about sockets but i think that i can do it .. any 1 help please !!!
|
|
|
|
|
Hi
Look at the Socket.Receive and Socket.Send methods in the MSDN - they provide sample code for point-to-point connection transfer (TCP). One machine does Send/Recv and the other does Recv/Send.
Socket.ReceiveFrom and Socket.SendTo demonstrates datagram connectionless transfer (UDP). One does Send only and the other does Recv only.
The sockets buffer has a limited size typically max 64KB with UDP and much less for TCP, so with file transfers you will have to send it bit-by-bit, so you'll have to define a protocol that includes information such as 'this is block 1 of 23', and collate this on the receiving end into a single file.
You will also have to consider what happens if you miss a block - ie. wait for the next cycle, etc.
HTH
Martin
|
|
|
|
|
Hi
In c# program What you should do is store the field (i.e column name)of a xml schema file in an array . Then while looping thru’ your input name (a xml file say "first.xml" with a single column name same as the name as in the schema) you should find out where this column name lies in your input file (i.e the index. Could be 4th one). Then update the output file accordingly(write that column values from the xml file into the output xml file).How to do this. a coding help pls
ramyaa
|
|
|
|
|
Hi guys,
I'm really struggling with a problem I'm having with a datagrid.
Basically, I download a log of alerts in the form of an xml document and load them into a datagrid, all in string format.
The problem is that when I display the form the first cell in the grid is always selected. What I am looking for is some way of making the grid unselectable, or even just a way to deselect the cell when I display the form.
I am using a DataTable called alerts with 3 DataColumns called date,url and notes. This is the constructor code
InitializeComponent();<br />
date = new DataColumn("Date");<br />
date.ReadOnly = true;<br />
url = new DataColumn("URL");<br />
url.ReadOnly = true;<br />
notes = new DataColumn("Notes");<br />
notes.ReadOnly = true;<br />
<br />
alerts = new DataTable("Alerts");<br />
alerts.Columns.Add(date);<br />
alerts.Columns.Add(url);<br />
alerts.Columns.Add(notes);<br />
<br />
dataGrid1.DataSource = alerts;
I then have a test method in place to fill the grid
<br />
public void SetTestList()<br />
{<br />
for(int i=0;i<20;i++)<br />
{<br />
alerts.Rows.Add(new string[]{"Test "+i,"Test "+i,"Test "+i});<br />
}<br />
<br />
this.Refresh();<br />
}
Anyone have any ideas what I can do to sort this problem out?
Cheers
Mike
|
|
|
|
|
Hi,
I have written a word automation application in c#, using the 2003 word object model 11.0. I have tested it on my system and it works fine. When i copy the EXE and required dll's on to another system, i get a System.UnauthorizedAccessException. Considering that all i have written is a windows form, that attemps to create a word object and open a document, this is pretty unexpected. This exception occurs on creating the object itself.
But when i add the user with permissions to the DCOMCNFG Default Access, then i am able to create the word object. But on my own system the code works fine without the settings. Can anyone help me out here!!
Thanks and Regards,
Laks
Not everything that can be counted counts and not everything that counts can be counted
|
|
|
|
|
My application logs its operation into a file.
As part of the application when an exception is thrown I am logging the exception.
The log shows the whole exception stacktrace and message in English and it’s fine.
However, when the application is installed on Russian Windows the exception messages (not the stacktrace) is logged in Russian.
How can I cause the exception to be written always in English?
I know that when I change the Thread.CurrentThread.CurrentUICulture to of the thread to CultureInfo.InvariantCulture just before the exception is thrown then the exception message is in English even on the Russian machine.
This solution forces me to change the CultureUI of the all the threads on creation and it’s not nice solution.
Ami
|
|
|
|
|
Hi!
How can I get the versionnumber of an assembly ?
|
|
|
|
|
try this:
using System.Reflection
...
string s = Assembly.GetExecutingAssembly().GetName().Version.ToString();
U can use other calls than GetExecutingAssembly if u whant other assemblies.
|
|
|
|
|
Hi all,
i want to merge two images in c#.net.please help me .
rathish
|
|
|
|
|
Hi all,
I am new to XML. I am trying to fill a Dataset with the help of XML. But what I want to do is to verify the data against an XML schema file(XSD file) and then fill it in the Dataset. Is it possible. If yes can anyone help me please.
|
|
|
|
|
I have creatd a webpage using C# in asp.net
I have a close button with which i want to close the webpage as soon as i click on it
is it possible using C#?
Sukanya
|
|
|
|
|
I am so poor in thin client application. So i can't able to help you in C#. But at the same time you can meet your goal using JScript. I know this is not an exact answer for your queary. But this is alternative for your queary.
<br />
<body><br />
<script language=jscript><br />
function CloseMe()<br />
{<br />
close();<br />
}<br />
</script><br />
<form id="Form1" method="post" runat="server"><br />
<button id="btn" onclick="CloseMe();"/><br />
</form><br />
</body>
Sreejith Nair
[ My Articles ]
|
|
|
|
|
AFAIK this can't be done with ASP.NET cause it's a server side technology. So you have to use script code like the one provided in the previous answer.
Besides, the ASP.NET forum is a more suitable place for questions like this.
www.troschuetz.de
|
|
|
|
|
Hi folks,
Is C# is suitable for real time image processing.... ?
comments plz...
|
|
|
|
|
|
I’m writing a distributed app. I have a web service and windows form. In my form I have declared an instance of the web service like so:
WindowsForm.localhost.service1 ws = new WindowsForm.localhost.service1();
The web service has a web method that sets a string and another web method that retrieves it. The string (m_word) is initialized to “ “ (space).
This is what I’m trying:
Some button event handler ()
{ ws.SetString(this.textbox.text); }
Other button event handler()
{ this.Lable1.text = ws.GetString(); }
What I’m expecting to happen it the word from the text box will appear in the lable but it doesn’t. Its as if I’m typing this.
Some event handler()
{
WindowsForm.localhost.service1 wsA = new WindowsForm.localhost.service1();
WsA. SetString(this.textbox.text);
}
Some other event handler()
{
WindowsForm.localhost.service1 wsB = new WindowsForm.localhost.service1();
this.Lable1.text = wsB.GetString();
}
I know this is a bit cryptic so if any one need clarification let me know. I think I’m missing something about how web services’ live.
Ronald Hahn, CNT - Computer Engineering Technologist
New Technologies Analyst
HahnTech Affiliated With Code Constructors
Edmonton, Alberta, Canada
Email: rhahn82@telus.net
|
|
|
|
|
My understanding of your problem is this:
in the first event, you are creating a webservice object wsA, whose string variable you set to a particular value.
But then when you call the function GetString() its on an entirely new object of the webservice class.So technically you should get " " back as the result.
You need to use the same instance of the class to persist the value.
So instead of creating a new object of webservice class, call the GetString() on wsA instead of wsB.
HTH
Cheers!
<bold>Looney Tunezez
"If you build it....
.....BUGS will come!" -JB
Application.Run(new Form1(this.Dispose())); <--WHAT :wtf::confused::eek:
"Stability. What an interesting concept" - Chris Maunder
<bold>
|
|
|
|
|
Yeah I got all that. In the first part of my question I said that I have a global Web service declared and I’m using it in my functions but when I use it from two function calls It looks like I’m getting two different instances of the web service.
Ronald Hahn, CNT - Computer Engineering Technologist
New Technologies Analyst
HahnTech Affiliated With Code Constructors
Edmonton, Alberta, Canada
Email: rhahn82@telus.net
|
|
|
|
|
Can you post the code for the web service class? Maybe something is wrong in there?
|
|
|
|
|
Hi,
Web services are stateless, they don't preserve information across method calls. If you want to preserve state, you need to implement your own mechanism, like passing around a session key..
Regards
Senthil
|
|
|
|