|
u can do this with vc there is no hooking with c# on other applications windows messages. even if you used win32 hooking API's implicitly from c#, you will hook only your own Application Messages.
marcoryos
|
|
|
|
|
When I prepare a C# application, is it supposed to work only on a stand-alone machine or it automatically works on a network (intranet) also?
If it automatically works (as a default) on the network also, then is there any way to control the number of computers on the network on which it will work? For example, if I want to allow its operation on only one machine on the network, can I do so, and if yes, then how?
|
|
|
|
|
I want connect to MYSQL database by C# and I want to use storeProcedure to access database but I can't do that. Please help me
|
|
|
|
|
Well to connect to mysql you either need an odbc driver which can be found at mysql's website or microsofts website. afaik mysql doesnt support stored procedures yet - it is only due in version 5 and I think they are far away from that.
|
|
|
|
|
well I dont' know how do you call them .. but certainly MySql does support stored procedures form v.4.1 onwards!
|
|
|
|
|
I call them stored procedures and I beg to differ with you on that statement.
http://dev.mysql.com/doc/mysql/en/roadmap.html[^]
The current production release is 4.1. MySQL 5.0 is available in alpha status. See the table of features and which version they belong to.
|
|
|
|
|
What do you mean when you say that you can't do that? What is it that you need?
---
b { font-weight: normal; }
|
|
|
|
|
I'm trying to resize a gif-image that is transparent. But it looses it's transparesy.
Does someone know how to do this?
My code:
public Bitmap _bitmap = null;
private void getGraphicsFromImageNotStretched(MemoryStream ms, int hight, int width)
{
Image image = Image.FromStream(ms);
double orgHight = (double)image.Height;
double orgWidth = (double)image.Width;
if((orgHight * hight) > (orgWidth * width))
{
double ratio = (orgWidth * width) / (orgHight * hight);
_bitmap = new Bitmap(image, (int)((double)width * ratio), hight);
}
else
{
double ratio = (orgHight * hight) / (orgWidth * width);
_bitmap = new Bitmap(image, width, (int)((double)hight * ratio));
}
image.Dispose();
}
Thanks
Thomas
|
|
|
|
|
I suppose it's because it is a GIF image it has a palette. When you resize it, it has to be converted to a true color image (or the resizing would look awful), and the transparency is lost.
If you convert it to true color before you resize it, it should be possible to keep the transparency.
If you use a true color PNG image with aplha channel transparency instead, it will work, and it will look much better. I use this for water marks on images.
---
b { font-weight: normal; }
|
|
|
|
|
Thanks for your replay.
I've tried different things out, but I don't seem to get it right.
The closest I've come is getteing a light-blue background (using PNG).
You don't have a code-snipp that could get me in the right direction.
Thanks
Thomas
|
|
|
|
|
As I said, I have used a transparent PNG, and I had no problem at all with the transparency.
How do you use the resized image? Are you saving it as a file? If so, what file format are you using?
---
b { font-weight: normal; }
|
|
|
|
|
I'm creating small icons of images in an ASP page, so I'm writing the images to the output stream.
First I'm resizing the image, witch data I get from a memory stream (this data is an transparent image):
public Bitmap _bitmap = null;
private void getGraphicsFromImageNotStretched(MemoryStream ms, int hight, int width)
{
Image image = Image.FromStream(ms, true);
double orgHight = (double)image.Height;
double orgWidth = (double)image.Width;
if((orgHight * hight) > (orgWidth * width))
{
double ratio = (orgWidth * width) / (orgHight * hight);
_bitmap = new Bitmap(image, (int)((double)width * ratio), hight);
_bitmap.Palette = image.Palette;
_bitmap.MakeTransparent();
}
else
{
double ratio = (orgHight * hight) / (orgWidth * width);
_bitmap = new Bitmap(image, width, (int)((double)hight * ratio));
_bitmap.Palette = image.Palette;
_bitmap.MakeTransparent();
}
image.Dispose();
}
Then I write the data to the output stream:
public static byte[] GenerateImageBytes(Bitmap theBitmap)
{
byte[] bytes = null;
// save the image to the output stream
System.IO.MemoryStream ms = new System.IO.MemoryStream();
theBitmap.Save(ms, ImageFormat.Png);
bytes = ms.ToArray();
ms.Close();
return bytes;
}
This result in an image that is not treansparent
Thanks
Thomas
|
|
|
|
|
If you call the MakeTransparent method without specifying a color, it will set the default transparent color as transparent. Do you know what color this is, and that it's the correct color to set as transparent?
---
b { font-weight: normal; }
|
|
|
|
|
No I don't know, but won't it be different from image to image?
Theres mabye a way to get it from the Pallete?
Thanks
Thomas
|
|
|
|
|
Hello again! I'm making a web app which generates data from a database and posts it in a datagrid. Now my problem is how could i post data from 2 separate tables in 1 datagrid. Here are the facts:
table1 composes of 14 columns and numerous rows depending on the result (no problem whatsoever)
table2 composes of 4 columns and with only 1 row (clueless)
Now i already have table1 posted on the grid, I was wondering how i could insert table2 on top of table1 creating a few spaces between them in the process. Thanx for all your replies!!
I'm new to programing so the syntax to implement these functions are still quite alien to me. I'd appreciate all your replies thanx in advance!
|
|
|
|
|
|
|
Hi - really if table 1 and table 2 have completely different data, then you should put two datagrids in there. You can't do what you want, because the grid needs consistent column names to display, and at a minimum, the same number of columns.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
oh...coz i was thinking of merging the datas 2gether into 1 main datatable then creating a buffer-like columns and rows as spaces. i mean is that possible? here's the code i tried to use:
public DataTable fMain(string strMonth,string strYear)
{
DataTable dt_emper = new DataTable();
dt_emper = objDS.fGet_employer();
DataTable dt_emp = new DataTable();
dt_emp = objDS.fGet_emp_deduct(strMonth,strYear);
//DataTable dtMain = new DataTable();
DataRow drow;
DataTable dtMain = new DataTable("dtbl");
DataColumn dcolMain = new DataColumn();
dtMain.Columns.Add("");
dtMain.Columns.Add("");
dtMain.Columns.Add("");
dtMain.Columns.Add("");
dtMain.Columns.Add("");
dtMain.Columns.Add("");
dtMain.Columns.Add("");
dtMain.Columns.Add("");
dtMain.Columns.Add("");
dtMain.Columns.Add("");
dtMain.Columns.Add("");
dtMain.Columns.Add("");
dtMain.Columns.Add("");
dtMain.Columns.Add("");
drow=dtMain.NewRow();
drow[0]=dt_emper.Rows[0][0].ToString();
drow[1]=dt_emper.Rows[0][1].ToString();
drow[2]=dt_emper.Rows[0][2].ToString();
drow[3]="";
drow[4]="";
drow[6]="";
drow[7]="";
drow[8]="";
drow[9]="";
drow[10]="";
drow[11]="";
drow[12]="";
drow[13]="";
drow[14]="";
dtMain.Rows.Add(drow);
for (int ctr=0;ctr<dt_emp.rows.count;ctr++)
{=""
="" drow[0]="dt_emper.Rows[ctr][0];
" drow[1]="dt_emper.Rows[ctr][1];
" drow[2]="dt_emper.Rows[ctr][2];
" drow[3]="dt_emper.Rows[ctr][3];
" drow[4]="dt_emper.Rows[ctr][4];
" drow[5]="dt_emper.Rows[ctr][5];
" drow[6]="dt_emper.Rows[ctr][6];
" drow[7]="dt_emper.Rows[ctr][7];
" drow[8]="dt_emper.Rows[ctr][8];
" drow[9]="dt_emper.Rows[ctr][9];
" drow[10]="dt_emper.Rows[ctr][10];
" drow[11]="dt_emper.Rows[ctr][11];
" drow[12]="dt_emper.Rows[ctr][12];
" drow[13]="dt_emper.Rows[ctr][13];
" drow[14]="dt_emper.Rows[ctr][14];
" drow[15]="dt_emper.Rows[ctr][15];
" dtmain.rows.add(drow);
="" }
="" return="" dtmain;
="" }
i've="" used="" the="" debugging="" technique="" and="" it="" stops="" before="" <code="">dtMain.Rows.Add(drow);. Is it sill possible or do I really need to have 2 grids for the 2 tables?
thanx again!
|
|
|
|
|
What you're thinking of doing is a hack. Do the two tables have data that relate to one another ? If not, then there is no reason to show them in one grid. If so, write a stored procedure that returns the data from both tables in a single dataset. That's what the database is for.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
no they don't have a data that can relate with the other. Darn and i thought i could get away with that. hehe oh well. thanx again Chris! I'l do the 2 grid process
thanx
|
|
|
|
|
Hi,
I am using the following code for Asynchronous webservice but it is getting hang in WebResponse result = req.GetResponse(); Please let me know what mistake i'm doing.
public XmlNode AForwardRequest(string webRequest, string userName, string password)
{
XmlNode resultNode = null;
try
{
XmlDocument webdoc = new XmlDocument();
string url = "";
string payload = "";
if (webRequest.IndexOf('?') != -1)
{
url = webRequest.Substring(0, webRequest.IndexOf('?'));
payload = webRequest.Substring(webRequest.IndexOf('?') + 1);
}
else
url = webRequest;
WebRequest req = WebRequest.Create(url);
req.Credentials = new NetworkCredential(userName, password);
req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded";
byte[] SomeBytes = null;
if (payload != null)
{
SomeBytes = Encoding.UTF8.GetBytes(payload);
req.ContentLength = SomeBytes.Length;
IAsyncResult r = (IAsyncResult)req.BeginGetRequestStream(new AsyncCallback(MyClientCallback), req);
}
else
{
req.ContentLength = 0;
}
req.Timeout = Timeout.Infinite;
WebResponse result = req.GetResponse();// In this line it gets hang
Stream ReceiveStream = result.GetResponseStream();
webdoc.Load(ReceiveStream);
result.Close();
resultNode = webdoc.DocumentElement;
}
catch (Exception e)
{
}
return resultNode;
}
public void MyClientCallback(IAsyncResult asyncResult)
{
WebRequest req = (WebRequest)asyncResult.AsyncState;
req.EndGetRequestStream(asyncResult);
}
bye,
Vinoth
|
|
|
|
|
Im creating an application that would be used for a WaveOn wireless device. The application is created using C# and the device runs with CE OS. I was trying to update the system date/time information programmatically depending on the time zone offset that the system pickups from an xml config file. I have done several ways (using APIs and all)... for some time, I have succeeded in my ordeal. Unfortunately as I was modifying the application to make it more flexible, the result seems to be varying ever so often & i couldn't get the correct results I was once able to get. Is WIndows CE really that unstable? Any help would do. Thanks.
|
|
|
|
|
hi, i want to now c# code for delete from the database 'Access'
|
|
|
|
|
Short question, short answer.
OleDbCommand[^]
The SQL Syntax you want goes along the lines of:
DELETE FROM tableName WHERE condition
Where tableName is obvious and condition is something like myField=123
|
|
|
|