|
The listview control has the scroll bar.
But I only need the V Scroll bar, and I want the scrool bar in the left of the list view and when scrolling, the list view will be changed one row by one row.
can anyone help me ? How to uses the VScrollBar to control the listview control.
|
|
|
|
|
Dear All,
I have developed an application which does some manipulation with database and it also uploads and downloads files from web.
the application is basically in Winform Layout, it has Notify Icon which shows the status of uploading and downloading.
the problem is in logging of computer, if the application is running, the computer does not log off which i want it to log off. Y it doesent log off?
if i close the application and point to log off, computer can log off successfully.
Abdul Rahaman Hamidy
Database Developer
Kabul, Afghanistan
|
|
|
|
|
Hi,
with which method do you close the form manualy? did the closing handler stop closing?
kind regards
|
|
|
|
|
thx, sorry for late reply,
yes i have certain conditions in closing event, based on those condition i am closing my form.
a simple condition is a boolean value, if that bool value is true than i am closing my form.
i think this causes the form not to close when i log off my compuer
how can i solve this, Please?
Abdul Rahaman Hamidy
Database Developer
Kabul, Afghanistan
|
|
|
|
|
Hi,
you're lucky, because I've got announcement for your post.
Okay, I have a way:
You may use
Microsoft.Win32.SystemEvents.SessionEnding += new Microsoft.Win32.SessionEndingEventHandler(SystemEvents_SessionEnding);
and then
void SystemEvents_SessionEnding(object sender, Microsoft.Win32.SessionEndingEventArgs e)
{
switch (e.Reason)
{
case Microsoft.Win32.SessionEndReasons.Logoff:
break;
case Microsoft.Win32.SessionEndReasons.SystemShutdown:
break;
default:
break;
}
}
you may omit the switch block, because you don't need it. Everytime the handler is called, Windows logs you off, or shuts down.
IMPORTANT: On Form_Closing (or Form_Closed) you MUST remove handler from SessionEnding-Event:
Microsoft.Win32.SystemEvents.SessionEnding -= new Microsoft.Win32.SessionEndingEventHandler(SystemEvents_SessionEnding)
hope it helps
kind regards
modified on Wednesday, September 2, 2009 5:14 AM
|
|
|
|
|
i have tried following but still it didnt helped me
void SystemEvents_SessionEnding(object sender, Microsoft.Win32.SessionEndingEventArgs e)
{
exitProgram=true;
Envoirnemt.Exit();
}
Abdul Rahaman Hamidy
Database Developer
Kabul, Afghanistan
|
|
|
|
|
Don't know if Envoirnemt.Exit(); works. Try this.Close(); instead, if it is a windows form application
Greetz
|
|
|
|
|
I have done following
void MainFormLoad(object sender, EventArgs e)
{
SystemEvents.SessionEnding +=new SessionEndingEventHandler(SystemEvents_SessionEnding);
}
void SystemEvents_SessionEnding(object sender,Microsoft.Win32.SessionEndingEventArgs e)
{
StreamWriter sw=new StreamWriter(@"c:\log.txt",true);
sw.WriteLine(e.Reason.ToString());
sw.WriteLine("close");
sw.Close();
exitProgram=true;
Close();
}
looks like nothing happens when i log off or shut down the computer
i see nothing in my c drive and also my winform never closes.
Note: i have also notify icon in my WinForm. It always appears. Y it doesent closes?
Abdul Rahaman Hamidy
Database Developer
Kabul, Afghanistan
|
|
|
|
|
|
Hi guys,
i have a litte problem with Microsofts PixelFormat. I have a Byte[] containing my R-G-B-Pixel values. The problem is, that PixelFormat.Format24bppRgb takes the pixel-values essentially in order B-G-R ... whats a little bit crappy. How could i get my array into a 24bpp-bitmap, with correct color-information? I need a very fast solution, because there are more than one images per second, with a size of more than 6000x2000 pixel, which must be issued.
Any possibility? Tried it with unsafe code and switching pixel per pixel-value, but it takes nearly 3 secs on an image with that size. Are there any tricks to get a correct colored image faster?
Regards
Andre
|
|
|
|
|
blacksheep1 wrote: The problem is, that PixelFormat.Format24bppRgb takes the pixel-values essentially in order B-G-R
Are you absolutely sure about that?
I don't do a lot with graphics, but I have never had any problems with PixelFormat.Format24bppRgb . Is there any chance that your byte[] has become, for want of a better word, corrupted. Maybe it contains Alpha values, therefore slowly moving out of sync.
It is difficult to offer more as you do not explain exactly what it is that you are trying to do. For example where are you getting the byte[] from?
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.”
|
|
|
|
|
Im getting the byte[] from an Camera, and yes, its 100% in order R-G-B. For testing, i made a byte[] by hand in a test-project.
public byte[] makeImg()
{
int x = 0;
byte[] Img = new Byte[f_WIDTH * f_HEIGHT*3];
for (int i = 0; i < f_WIDTH * f_HEIGHT*3; i+=3, x++)
{
if (x == f_WIDTH)
{
x = 0;
}
if (x <= f_WIDTH/3)
{
Img[i] = Convert.ToByte(255);
Img[i + 1] = Convert.ToByte(0);
Img[i + 2] = Convert.ToByte(0);
}
if (x > f_WIDTH / 3 && x < (f_WIDTH / 3)*2)
{
Img[i] = Convert.ToByte(0);
Img[i + 1] = Convert.ToByte(255);
Img[i + 2] = Convert.ToByte(0);
}
if (x > (f_WIDTH / 3) * 2)
{
Img[i] = Convert.ToByte(0);
Img[i + 1] = Convert.ToByte(0);
Img[i + 2] = Convert.ToByte(255);
}
}
return Img;
}
When i print it on screen, or put it into a bmp-file, the colors in the resulting image are blue-green-red ... in that order.
|
|
|
|
|
I have put your test image generator code into a Windows Forms Application and I get a vertical RED stripe, then a vertical GREEN stripe then a vertical BLUE stripe. This is what I would expect.
Here is my code:
public partial class ByteArrayToImageForm : Form
{
private int f_WIDTH = 100;
private int f_HEIGHT = 100;
private byte[] testImageArray;
public ByteArrayToImageForm()
{
InitializeComponent();
this.testImageArray = this.MakeImage();
}
public byte[] MakeImage()
{
int x = 0;
byte[] Img = new Byte[f_WIDTH * f_HEIGHT * 3];
for (int i = 0; i < f_WIDTH * f_HEIGHT * 3; i += 3, x++)
{
if (x == f_WIDTH)
{
x = 0;
}
if (x <= f_WIDTH / 3)
{
Img[i] = 255;
Img[i + 1] = 0;
Img[i + 2] = 0;
}
if (x > f_WIDTH / 3 && x < (f_WIDTH / 3) * 2)
{
Img[i] = 0;
Img[i + 1] = 255;
Img[i + 2] = 0;
}
if (x > (f_WIDTH / 3) * 2)
{
Img[i] = 0;
Img[i + 1] = 0;
Img[i + 2] = 255;
}
}
return Img;
}
private void ByteArrayToImageForm_Paint(object sender, PaintEventArgs e)
{
int arrayIndex = 0;
int x = 0;
int y = 0;
Bitmap visibleBitmap = new Bitmap(this.f_WIDTH, this.f_HEIGHT, PixelFormat.Format24bppRgb);
while (arrayIndex < this.testImageArray.Length)
{
visibleBitmap.SetPixel(x, y,
Color.FromArgb(this.testImageArray[arrayIndex],
this.testImageArray[arrayIndex + 1],
this.testImageArray[arrayIndex + 2]));
x++;
if (x >= this.f_WIDTH)
{
x = 0;
y++;
}
arrayIndex += 3;
}
int drawX = (this.ClientRectangle.Width - visibleBitmap.Width) / 2;
int drawY = (this.ClientRectangle.Height - visibleBitmap.Height) / 2;
e.Graphics.DrawImage(visibleBitmap, drawX, drawY);
}
}
Try it out. **NOTE** I have dispensed with the Convert.ToByte parts from your code as they are not necessary, although it does not alter the output (I tried both ways).
So unless you were using Convert.ToByte because you were converting from int, for example, which might explain your problems, I am at a loss.
Sorry!
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.”
|
|
|
|
|
Hi everyone,
I try to create Cubes with Analysis Services in Visual Studio (C#) 2005, but my problem is...
... I created the datasource, datasourcesight, the cube and dimensions, but if I try to compile it and add it to SQL Servermanagement Studio it means, that it can't be added to the server cause the name might me wrong...
Sorry I am from germany and so I only have the german errorlog:
Fehler 1 Das Projekt konnte aufgrund der folgenden Konnektivitätsprobleme nicht auf dem Server 'test' bereitgestellt werden: Es kann keine Verbindung hergestellt werden. Stellen Sie sicher, dass der Server ausgeführt wird.. Überprüfen oder aktualisieren Sie den Namen des Zielservers, indem Sie mit der rechten Maustaste im Projektmappen-Explorer auf das Projekt klicken. Wählen Sie 'Projekteigenschaften' aus, klicken Sie auf die Registerkarte 'Bereitstellung', und geben Sie dann den Namen des Servers ein.
... my knowledge: it just means that the connection with the server failed, because I typed the wrong servername into the project
greets,
Mschauder
|
|
|
|
|
Hi,
you've got the wrong forum. The front-end is Visual Studio, yes, but it's mainly used plug-in for that is: SQL Server Business Intelligence Development Studio. And so it's not C#.
Try to ask the question on database forum.
BTW: Is the name of your server really 'test' and not maybe 'localhost', check the project properties Deployment -> Target -> Server
greetz
|
|
|
|
|
Hi
How can I implement the Mimefilter in c#.
I had got some links related to these http://msdn.microsoft.com/en-us/library/aa767916(VS.85).aspx[^]
Is there any other information related to these?
actually I want to change the web page text on the fly, such that the user can see the changed text directly on browser?
How to do this
|
|
|
|
|
Hello..
i want to encrypt an assembly at run time using command prompt. And same assembly i want to decrypt using C# code.
If any one know then ..it will really helpful for me....
thanks
|
|
|
|
|
What have you tried so far?
Post some code and explain where you think it is failing.
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.”
|
|
|
|
|
i tried Dot Fuscator from command prompt to encrypt the assembly.
The sample code for dotfuscator :
i am using c++ code to generate dll from c# class.
CString pathDot="C:\\Program Files\\Microsoft Visual Studio 9.0\\Application\\PreEmptive Solutions\\Dotfuscator Community Edition";
sprintf(command,"\"%s\\dotfuscator\" /in:c:\\IS500Licence\\Licence.dll /v",pathDot.GetBuffer(0));
system(command);
|
|
|
|
|
Hello,
I need to extract a carasteres from a picture (JPG for exemple), on position X=40, Y=60, Height = 10, Width=10, can you help me to do it? please help me, thank you verry mutch
|
|
|
|
|
Hi,
what did you try so far? Just send a little bit code.
Bye
|
|
|
|
|
The Tesseract OCR[^] might be of help to you. I've heard from a few ex-colleagues that it is actually a very good OCR engine.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Hi All,
I have created a simple remoting server inside a Window Service as :
<pre>TcpChannel tcpChannel = new TcpChannel(8085);
ChannelServices.RegisterChannel(tcpChannel,true);
WellKnownServiceTypeEntry entry = new WellKnownServiceTypeEntry("RemotingWindowSrvc", "RemotingWindowSrvc.MailFormat", "MailFormat", WellKnownObjectMode.SingleCall);
RemotingConfiguration.RegisterWellKnownServiceType(entry);</pre>
Then we try and make call to this server in my client as:
<pre>private void GetRemoteObject()
{
TcpChannel chan = new TcpChannel();
ChannelServices.RegisterChannel(chan);
MailFormat obj = (MailFormat)Activator.GetObject(typeof(MailFormat), "tcp://localhost:8085/MailFormat");
obj.sendUserRegistration("...");
}
}</pre>
MailFormat: is the name of the Class, being called here.
But upon calling "obj.sendUserRegistration("...");", client hangs indefinitely.
please help me with this.
Thanks,
Puneet
|
|
|
|
|
how about attaching debugger to the server process and see in it, if something happens...
|
|
|
|
|
Hi,
Thanks a lot for the reply, I have been able to solve this problem.
It was hanging cause, it wasn't able to resolve the function name. But once I signed the assembly and deployed it in GAC, it was able to recognize it and call the function.
I am putting the code for your reference:
Dim ch As TcpChannel = New TcpChannel(8085)
ChannelServices.RegisterChannel(ch)
RemotingConfiguration.RegisterWellKnownServiceType( _
GetType(TrialClassLib.MailFormat), "myRemoteObject", WellKnownObjectMode.Singleton)
|
|
|
|
|