|
Blue_Skye wrote:
i think that thread maybe help my web application work faster. Is it right?
No, using threads on a single processor system will actually perform slower than using a single thread. That said, using threads to do heavy work, freeing up your GUI thread to let the user continue working gives the appearance of improved performance. If you want more information about threads, there are plenty of articles on codeproject and msdn.microsoft.com regarding threading, synchronization, locks, semaphores and so on.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: He has a funny face. And he's my son.
Judah Himango
|
|
|
|
|
Hi all,
I am new to C# GDI+ things. I try to add up the color occurence of the given jpg to array colorSumrySrc after comparing the pixel argb values of the incoming picture with the values in sysColors. The result would be there is no pixel color matched with sysColors and thus colorSumrySrc are all in zeros. The case is that the argb values for system Colors may not be exactly same as the color in input picture. So, I want to change the approach to just storing red, green, blue -> 3 major color categories in sysColors. But my concern here would be that the argb values for a color category is discreted, e.g. blue includes skyBlue, deepBlue... How can i specify the range of the color here for comparison? E.g. if a pixel color have argb value - 1111111, then if it falls to blue category that have range from -100000 to -200000, then my code will considered that pixel to be blue. Any one can help??
public string[] sysColors = new string[] {Color.AliceBlue.ToArgb().ToString()
...
,Color.AntiqueWhite.ToArgb().ToString()
} // array holds system color argb values for comparison
colorSumrySrc = new int[sysColors.Length]; // array holds corresponding color occurence of sysColor if given picture have pixel the same as sysColor, initialized as 0 for all entries
string sImgPath = @"c:\temp";
string sImgName = "a.jpg"; // given picture for pixel comparison
Bitmap bmp = null;
string rslt = null;
int bmpHeight = 0;
int bmpWidth = 0;
int totalPixel = 0;
string colorDesc = null;
try
{
bmp = new Bitmap(sImgPath + sImgName);
if (!bmp.Size.IsEmpty)
{
bmpHeight = bmp.Size.Height;
bmpWidth = bmp.Size.Width;
totalPixel = bmpHeight * bmpWidth;
}
for (int y=0; y<bmpheight; y++)="" {
="" for="" (int="" x="0;" x<bmpwidth;="" x++)="" color="" y);
="" colordesc="color.ToArgb().ToString();
" i="0;" i<syscolors.length;="" i++)="" if="" (colordesc.equals(syscolors[i]))="" this.colorsumrysrc[i]++;=""
="" break;
="" }="" match
="" check="" it="" is="" of="" its="" type
="" x
="" y
="" catch="" (exception="" e="" )="" rslt="e.Message" +="" "="">>>" + e.StackTrace;
}
Thanks much!!!
Rene Xavier
|
|
|
|
|
If you only want to catgorize into red, green and blue I have a proposal (although I dont know how good it works):
In a reddish color the R value should be higher than the others, in a blueish a blue one should...
This leads to a rather simple if statement:
private void WhatIsIt(Color color)
{
if (color.R > color.G)
{
if (color.B > color.R)
{
Console.WriteLine("Its blue.");
}
else
{
Console.WriteLine("Its red.");
}
}
else
{
if (color.G > color.B)
{
Console.WriteLine("Its green.");
}
else
{
Console.WriteLine("Its blue.");
}
}
}
|
|
|
|
|
Hihi,
Thanks you very much for the reply, but how if I want to classify the colors into Rainbow colors: Red, Orange, Yellow, Green, Olive, Blue, and Violet?
Thanks a ton,
Rene Xavier
|
|
|
|
|
Ok. Define a list with the colors you want.
Whenever you have to categorize a color do the following:
Sum up the differences of the R, G and B values for the color and each color in your list and sum them up.
When done take the color of your list where the difference is the smallest.
Dont know if it works, but you could try
|
|
|
|
|
Thanks much for your advice
I use another approach for specifying the argb ranges for each type of color finally.
Rene Xavier
|
|
|
|
|
Umm, i just start to write an n-tier application. I really need an standard n-tier application to check 'n base on it to develop my project. That application doesn't need to be too big, complicated or even a complete project. i just need an application that show clearly about n-tier (urr, maybe one control class for two design from ...).
I really need it. Can anybody help me ?
Thanks!
|
|
|
|
|
Hi,
he following link on MSDN gives very good examples of N-Tier Application with code samples.
It includes Fitch and Mather 7.0 and Duwamish 7.0
MSDN Enterprise Samples
Cheers
Ravindra Sadaphule
MCSD.NET
|
|
|
|
|
Hi
I want write a program that compute the time of connecting to internet .(like the dial_up connetcion notify icon in windows ) i want the connection property too like connection speed .
can anyone halp me ?
Regards' Amir jalaly
|
|
|
|
|
Use a simple API function InternetGetConnectedState, to return a boolean variable.
using System ;
using System.Runtime ;
using System.Runtime.InteropServices ;
public class InternetCS
{
//Creating the extern function...
[DllImport("wininet.dll")]
private extern static bool InternetGetConnectedState( out int Description, int ReservedValue ) ;
//Creating a function that uses the API function...
public static bool IsConnectedToInternet( )
{
int Desc ;
return InternetGetConnectedState( out Desc, 0 ) ;
}
}
blank
|
|
|
|
|
We are in a process to create a deployment process (deploy activex controls, com+ dlls, .net dlls). Because we have ~30 servers to install our code to. We are thinking of couple of approaches. I have tested an application that will register all these components on all the servers e.g. use comadmin to register the dlls in COM+ services (remotely), same with the registry files. But how to register activex controls and .net dll that go to COM+ services? Has anybody seen this issue?
Thanks,
sacred_warrior
|
|
|
|
|
I have a Windows application and I was doing something that I thought to be very simple. The ONLY change that I made was:
<br />
[STAThread]<br />
static void Main() <br />
{<br />
Form1 someForm = new Form1();<br />
someForm.Visible = false;<br />
Application.Run(someForm);<br />
}<br />
This didnt work. I dont know what I am doing wrong; I would have thought that that was a pretty good way to make it invisble but Im wrong.
Thx,
Jim
|
|
|
|
|
You need to make changes to your form in your onload or constructor...not in the Main.
Have a wonderful evening
Doug Wright
Developer, TDCI
|
|
|
|
|
Thanks a lot, but sadly I tried that too with no result
More exactly, this was the code that I used:
<br />
public Form1()<br />
{<br />
this.Visible = false;<br />
InitializeComponent();<br />
}<br />
I also tried
<br />
public Form1()<br />
{ <br />
InitializeComponent();<br />
this.Visible = false;<br />
}<br />
|
|
|
|
|
|
Application.Run(Form f) sets the form's Visible attribute to True internally when it's starting the message loop for the form, so your form gets displayed regardless of what you set Visible to.
To hide the form from the user you can either set its size to (0,0) or move the form off-screen (or both).
Regards,
mav
|
|
|
|
|
Thanks, I didnt know about that side effect! This program is going to be run as a scheduled task, how do I go about stopping it from stealing focus?
Thanks a lot,
Jim
|
|
|
|
|
You don't have to show a form for your program to run and perform its tasks.
Take a look at the other Application.Run() overloads, that could be the cleaner solution.
Otherwise you'd have to p/invoke ShowWindow() , there you can specify to show a window without giving it focus.
Regards,
mav
|
|
|
|
|
Good post, I tested this out after posting to him earlier and saw that my suggestion wouldn't help. I was curious as to why it wouldn't hide as well.
Have a wonderful evening
Doug Wright
Developer, TDCI
|
|
|
|
|
why don't u try the this.Hide() in the load constructor
ByMindOnlyYouCanDoIt
|
|
|
|
|
Hi!!
Does anyone know how I can use a normal image as a cursor?
I have seen I can load a .cur file, but do you know if I can do it from a .gif or .jpg?
If not, do you know how I can create a .cur file from another kind of image file?
Thanks.
Bego
|
|
|
|
|
i tried this before and the thing that i reached that tools and only tools
ByMindOnlyYouCanDoIt
|
|
|
|
|
hi every 1 ,
i want some idea's about a grauation project, i need something new can any 1 give me an idea about what to do ?????
|
|
|
|
|
What are you graduating from??? Highschool or university? ^^
|
|
|
|
|
Is there a graduation project in high school ?
|
|
|
|