|
I'm sorry, I misunderstood you, I googled a little, and it seems that there is no cheap way to do it.
It is possible to convert the Region to Path and draw the path by using Region.GetRegionScans which will return an array of rectangles approximating the region. But I think this is a quite expensive method. I believe it would be better to start with GraphicsPath instead, of course if it is possible in your case.
Regards,
Lev
|
|
|
|
|
Byte b= 0xff;
Byte c= 0x82;
Byte is 8 bit unsigned interger .Why is it initialized as above?
Thanks
|
|
|
|
|
hung1984 wrote: Byte is 8 bit unsigned interger .Why is it initialized as above?
I dont see anything wrong. What do you see wrong?
If they were 8 bit signed integers, then yes, we would/could have a problem.
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 beta 1 - out now! ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
What do you think is wrong with it? Since both of those values are 8-bit values, written in hexadecimal, I don't see what the problem is.
|
|
|
|
|
i see now. Is it 0x is notation for hexadecimal ?
|
|
|
|
|
correct. That tells you that 0x98 is not 98.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
so, these 2 lines are the same?
Byte b= 0xff;
Byte b= 255;
|
|
|
|
|
Hi all,
Im currently building an upgrade to one of our free "value added" tools we send out to customers. The new version is to replace a 10yr old Delphi version. One of the features of the new one is to import data from the old version, which is stored in Paradox. Ive run into a little problem in vista access the paradox database files. If i dont run the app in Admin mode (via Run As Administrator) i get a Paradox driver error (11625), but if i run as admin, it works fine!
So far the only way i can think to fix the problem is one of the following:
* Create a manifest demanding Admin privilages for the application
* Document the user has to manually "Run As Administrator" for certain functions
* Somehow create a shortcut (if its possible) that automatically runs as administrator
Whats the best way of doing this? Can you suggest a better idea? Can the user "Run As Administrator" if they have admin rights? I ask this because some of our customers isntall the software on domained machines with Group Polices already set!
many many many thanks!
Will
|
|
|
|
|
The best way to do it is to see if you use some other method that doesn't require admin rights. Beyond that, on Vista, it's best to use a manifest.
|
|
|
|
|
Hi,
Thanks for the reply... Ive tried using OleConnection and an OdbcConnection using the native Paradox driver and the Jet driver, but they both fail when I try use the DataAdapater to fill a table from a select command!
Any thoughts / suggestions?
|
|
|
|
|
There's got to be something else going on because you don't need admin rights to do a database select. Has the the config of Vista been changed at all or is this an "out of the box" install?
|
|
|
|
|
Hello all,
happy holidays, when you get thus far.
I'd much appreciate your thoughts on this issue: I need to transfer a bunch of images from a server to a winforms application. Approximiately 30-40 group4fax tiff's at an unknown size. I haven't as yet decided on the architecture. I thought I'd go with a WCF service and transfer the images as byte arrays, pre-loaded to server-memory. Would this procedure seem recommended for this task? The aim, naturally, is to transfer the least amount of bytes to the client, to allow for the best response-time. I've noticed when I convert the images to byte arrays, these arrays triple in size, so I guess that's not the best way to go 'round the issue of limiting the client's download time.
All your thoughts are surely appreciated, thanks in advance,
Morten
|
|
|
|
|
If you just send the bytes of the image, there's no way they can 'triple in size'. If you were to turn them into a bitmap and send that data, they will get a lot bigger. Send the tiff data directly, and then stuff that into a stream and read it into a bitmap from there on the other end. The compression you will find in formats like tiff/jpeg/png are as good as you'll get. Perhaps converting to jpg will make them smaller, it's worth a try.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
harleydk wrote: I've noticed when I convert the images to byte arrays, these arrays triple in size
I assume you mean when byte arrays are encoded in Base64 which I assume is needed for WCF byte[] transfers. Then it is normal.
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 beta 1 - out now! ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
Good point - I didn't think of that.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
But Triple the size? Base64 should be 1/3rd larger, right?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
I'd like to display the build number of my application in a text box.
I tried with "txtApplicationVersion.Text = Application.ProductVersion;"
but that did not give the correct value.
Could someone point me in the right direction?
Thanks very much for your help,
Albert
|
|
|
|
|
Hi,
I suggest you try Assembly.GetExecutingAssembly().GetName().Version.ToString() or have a look at the properties of Assembly.GetExecutingAssembly().GetName().Version
[EDIT]
Although I expect Application.ProductVersion to return the same string.
You do have a [assembly: AssemblyVersion("1.0.*")] somewhere, do you?
e.g. in file AssemblyInfo.cs; make sure there is an asterisk in that line, that is how you tell
Visual to modify the version upon every build.
[/EDIT]
modified on Saturday, December 20, 2008 12:50 PM
|
|
|
|
|
I'm also a newbie, and I use Click once for deployment. I get a publish version from Click Once and I want to display this number in the info box.
To display the publish version use the following code:
=======================================
if (System.Deployment.Application.ApplicationDeployment.IsNetworkDeployed)
{
Version version = System.Deployment.Application.ApplicationDeployment.CurrentDeployment.CurrentVersion;
string versionString = version.ToString();
}
========================================
Please notice this works only on deployed versions (IsNetworkDeployed)
The other possiblity is the assembly version. You can set the assembly version manualy in the assembly file (found as a subfile under the properties item in the solution explorer). Or you can have an automatic assembly number with the number of days since jan 1, 2000 as build number and the number of seconds (divided by two) as the revision number by [assembly: AssemblyVersion("1.0.*")]
I hope to have cleared confussion.
|
|
|
|
|
Hello i am new to this place and thought id have a look around before i post a question but i was unable to find the answer to my problem.
I am very new to c# and creating winform application and require a login that will allow access to the application window.
I am using a mysql database with phpmyadmin and trying to autheticate the login using a ole db connection.
I have been trying to get this working for a while now and have made some progress but i am now getting the ERROR MESSAGE: (MYsql prov provider is not registered on the local machine) when ever i run the application and input a username and password and click OK.
Any help would greatly be appreciated.
Thanks in advacnced
My code is below:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;
namespace _Consultants
{
public partial class Form1 : Form
{
public static string ConnectionString = "Provider=MySQLProv;Data Source=_consultants;User Id=root;Password=password;";
public Form1()
{
InitializeComponent();
}
private void textBox2_TextChanged(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
OleDbConnection myConnection = new OleDbConnection(ConnectionString);
string uname;
string pword;
try
{
uname = textBox1.Text;
pword = textBox2.Text;
{
OleDbCommand myCommand = new OleDbCommand("Select count(*) from user where username = ' " + textBox1.Text + " 'and password=' " + textBox2.Text + " ' ");
myCommand.Connection = myConnection;
myConnection.Open();
int count = Convert.ToInt16 (myCommand.ExecuteScalar());
// Notice the double equal signs.
// Double equal signs are a comparison.
// Single equal signs are an assignment.
if (count > 0)
{
main_screen main = new main_screen();
main.Show();
this.Hide();
}
else
{
Application.Exit();
}
}
}
catch (Exception ex)
{
myConnection.Close();
MessageBox.Show("Wrong Input Entered", "Window Information"+ex.Message.ToString(),
MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
}
|
|
|
|
|
cobalt-rose wrote: ole db connection.
Oledb is slow. MySQL provides a managed library. You can get it here[^].
|
|
|
|
|
Thank you for the reply.
I have previously tried to get the mysql client but when i added the extension in my code it kept on saying that it couldnt find it or something.
Im downloading this at the moment is this correct http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-essential-5.1.30-win32.msi/from/pick )
Do i download the essentials/Zip/ or Without installer packages?
Also once installed do i need to put them anywhere specific like a bin file or httdocs or something?
Thanks in advanced.
C~Rose
|
|
|
|
|
You say you're getting an error message, but what is it ?
Why don't you use SQL Server, instead of MySQL ? There's better support for that built right in to .NET. having said that, there's no reason why this shouldn't work, but we can't tell you what's going wrong without seeing the error.
cobalt-rose wrote: OleDbCommand myCommand = new OleDbCommand("Select count(*) from user where username = ' " + textBox1.Text + " 'and password=' " + textBox2.Text + " ' ");
1 - give your variables real names, unless you want to write unreadable code
2 - read the articles on SQL injection, this code means someone who is not logged in, can erase your entire database, or quite possibly guess how to side step the login process, if they guess that you're expecting a number to be returned.
So, once someone is logged in, you don't use the database for anything else that's specific to one user ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
I use MySql in combination with C# as well. To answer the question from Cristian why using MySql instead of SQLServer: to get the best of both worlds, and have a rich user interface with a windows forms application, combined with a database that can be reached over the internet.
First of all, use the MySQL .net components provided by MySql, and create a reference to it in your projects. Don't forget the using statement:
using MySql.Data.MySqlClient;
I then use a number of standard functions like:
public static bool RunSQL(string sql, string ConnectString)
{
MySqlConnection ConnMySQL;
MySqlCommand cmdMySql = new MySqlCommand();
ConnMySQL = new MySqlConnection(ConnectString);
cmdMySql.Connection = ConnMySQL;
try
{
ConnMySQL.Open();
//Execute SQL
cmdMySql.CommandText = sql;
cmdMySql.ExecuteNonQuery();
}
catch (Exception e)
{
System.Windows.Forms.Clipboard.SetText(sql);
if (e.Message.ToString().IndexOf("Duplicate entry") < 0)
{
System.Windows.Forms.MessageBox.Show(e.Message);
}
return false;
}
finally
{
ConnMySQL.Close();
}
return true;
}
The connectstring is something like:
public static string ConnectString()
{
string Connectstring = @"server=yourservername;uid=yourusername;pwd=yourpassword;database=yourdatabasename;";
return Connectstring;
}
I hope this will get you on the right track
|
|
|
|
|
Hey i am now going to use Mysql to connect instead of ole db as i have been told that it is quicker...
How do i actually incoporate the mysql connection example into my program?
Do i need to put this code in every time that i need to connect to the database? or do i just put it at the top of the code?
Also how do i get the mysql.data.mysqlclient import as when i put it in my code i get the error:
"The type or namespace 'MySql' could not be found (are you missing a using directive or an assembly reference?"
Do i need to download the dll? and if so in which folder too?
|
|
|
|