|
Hi all,
has anybody ever tried to edit a bitmap programatically?
I have a bitmap of a printed circuit board, but around the board are white margins.
I would like to remove the white margins in my program.
Is this possible?
Best Regards
Bernd
-------------------------------------------
The light at the end of the tunnel has been switched off temporarily due to budget problems...
|
|
|
|
|
Of course it is. Programs like Photoshop do this all the time. The real question is how your going to detect the edge between the image and the white space you want to get rid of and what you want to do about it. DO you replace it with the green PCB or do you crop the image. There are all kinds of algorithms around for edge detection, but what will work for you is up t your own testing and research.
Edge Detection Algorithm[^] searh results on Yahoo.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks!
I'll have a look at this.
-------------------------------------------
The light at the end of the tunnel has been switched off temporarily due to budget problems...
|
|
|
|
|
I am not familiar with Discussion Forum.
|
|
|
|
|
What's not to understand? You go there, you post questions, you read responses and replies... You obviously got part of it right, you posted something here.
I take it you had a more specific question about some discussion forum software?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
How to get the list of installed fonts corresponding to any perticular charactor set? eg. if I want to get Japanese supporting font list (corresponding to char set Shift_JIS), how to do it?
please guide
|
|
|
|
|
You can get a list of the installed fonts by instantiating System.Drawing.Text.InstalledFontCollection . Enumerate through the FontFamilies array property. This information won't tell you about which character set the font supports, however. Character sets and fonts are two separate things. Perhaps there's a few bits in a font file that determine which charset a font supports, but I'm not aware of any.
The only way to tell is to either try drawing a character from that charset using that font and see if it works, or create some sort of font driver that lets you dig into the actual font data, which would be quite a feat since you need to somehow use the font handle to get the actual font file and examine the structure. Also keep in mind that there's many different types of font files, so this would be a very difficult task.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Is it possible to add our own attribute / events to web control (if it is not supporting) to increase functionality
|
|
|
|
|
|
Hi
How v can Invoke the methods that r declared in an a project(Dll) which is loaded dynamically into our project?
Is the MethodInfo class's Invoke methoda will do the job?
What does the first parameter in the second overloaded method of "Invoke" mean?
Pls help me with sample codes!!
|
|
|
|
|
|
Hi, i wanna know how can i get a cookie
for example:
mypage.com/login.html
This, have a form to login, so:
mypage.com/login.html?user=teste&pass=test
Will login with User= teste and Pass = test
Im just trying to get the COOKIE, provided by login.html after the login.
What can i use?
Thanks
|
|
|
|
|
First of all, this really belongs in the Web Developer forum. This forum is for questions relating to C#, which can be used to create ASP.NET web applications that parse, compile, and execute code on the server so format and stream HTML to (and other files) to the browser or other client application using HTTP.
Second, if you want to use ASP.NET, then by default the pages use the .aspx extension, not .html.
Third, by using .html extensions, you are implying that you want to do this using client-side scripting, since .html is, by default, not a CGI-parsed extension on any system without actually remapping file extensions.
Fourth, are you kidding? Passing the username and password in a query string is the most insecure method ever conceived! You might as well eliminate authentication. You pass username and passwords using POST (not GET) and you should use SSL over HTTP (HTTPS) if this is sensitive information. Even without using SSL, using POST at least doesn't store the username and password in the browser's history like this would.
After taking all that above into account, how you do this depends on what server you're using and lots of other information. Again, I suggest you ask this in the Web Developers forum.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Well, u dont understand...
I trying to acess a protected page with HttpWebRequest...but i need get the cookie first, to put in the CookieCollection :\
|
|
|
|
|
Moon Boy wrote:
Well, u dont understand
No, it's you that don't understand. First of all, this isn't even using cookies. This is a query string, and if you have questions about ASP.NET (which your URLs didn't show at all, since they use the .html files which are typically staticly delivered on the server) they belong in the ASP.NET forum.
If you're using the HttpWebRequest to access this site, then you need to pass the query string parameters as part of the URL. If the site is using cookies, then instantiate a new CookieContainer and add a Cookie . The documentation for the HttpWebRequest.CookieContainer property in the .NET Framework SDK even gives an example of how to do this. Consulting the documentation should be the first place you check.
Also, when you want to reply to someone in the CodeProject forums, click "Reply" on the message to which you want to reply.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
|
Dear, Sir and Madam.
I want to add PasswordChar Property which shows ****** for string which I
type in PropertyGrid Control.
Regards.
|
|
|
|
|
Do you mean you want asterisks to show in the PropertyGrid, or that you want a property named PasswordChar ? If it's the latter, then just define it as a public property on your class. To actually make is useful you have to maintain two separate buffers (either "connected" or "disconnected") - one for the actual text and one for the displayed text.
If you want asterisks to appear in the PropertGrid itself, then there's quite a bit more work involved. You would need to shadow the property using an ICustomTypeDescriptor (in the GetProperties implementations to return a PropertyInfo object that you'd manage) or using a custom designer. I suggest before even attempting this that you read about design-time support by reading Enhancing Design-Time Support[^] in the .NET Framework SDK.
If you're wanting to do this at runtime, then I highly suggest that you do NOT use the PropertyGrid managed class. It's actually not user-friendly (try reading the Windows User Interface Guidelines some time) and you can handle password fields a lot easier with a simple TextBox (which already supports password encoding via its PasswordChar property).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thank you, Sir.
I mean asterisks to show in the PropertyGrid.
|
|
|
|
|
Hi, how do I extract values from a bit field in c#? I tried it a la C++
if(flag.value & enum.value)
{
}
but it wouldn't let me go that way, thought it was boolean or something odd.
Anyway, I've had a quick look thru previous posts (takes a bloody long time to load pages!) but forgive me if it's been covered.
Thanks,
Brian.
"Ergo huffabo et puffabo et tuam domum inflabo" ait magnus malus lupus.
"Non per comam men-men-menti!" ait porcellus.
|
|
|
|
|
It's the other way round: the if statement requires the condition to evaluate to type bool in C#. You can't simply test an integer.
If enum.value represents a single flag, use
if( ( flag.value & enum.value ) == enum.value )
{
} If it represents a mask of flags, and you want to know if any of the masked flags are set, use
if( ( flag.value & enum.value ) != 0 )
{
} You might need to add the FlagsAttribute to your enum for the latter to work.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Cool, thanks heaps!
"Ergo huffabo et puffabo et tuam domum inflabo" ait magnus malus lupus.
"Non per comam men-men-menti!" ait porcellus.
|
|
|
|
|
I'm bran new to the world of SQL. I barely know what it is. I'm reading "Visual C# Step by Step" and the chapter, "Accessing Data with Web Forms" requires that I be running a SQL server.
I have had some difficulty doing this but I finaly logged in using the 'sa' account (Thank you Colin ). I now have a few security-related questions:
1. What is the difference between Windows Authentication Mode and Mixed Authentication Mode? I was unable to login when the authentication mode was set to Windows Mode so I had to change to Mixed Authentication.
2. Why couldn't I login under Windows Authentication Mode? Why did I have to change to Mixed Authentication Mode?
2. After changing the authentication mode to Mixed in the registry by shutting down the MSSQLSERVER service, changing the "LoginMode" to "3" in the registry, and restarting MSSQLSERVER, I changed my password from NULL with the following commands:
sp_password @old = null, @new = %my new password%, @loginname = 'sa'
go
Did I open myself to any security holes by changing to Mixed Authentication Mode? Or did changing my password from NULL solve the potential security issue?
Thanks,
-Ian
|
|
|
|
|
OK, here we go:
#1:
Windows Authentication uses the account of the user running the process connecting to SQL Server (or, I think, the account being impersonated by the process). Mixed mode uses Windows authentication or SQL Server authentication, where you supply the username and password in the connection string. The difference is that with SQL Server authentication, the usernames and passwords are stored in the MSDB database, whereas with Windows authentication, the usernames and passwords are stored either in the SAM (Security Accounts Manager, a Windows subsystem which uses the registry as a back-end store) or in Active Directory (on a Windows 2000 or higher domain). The server machine and client machine have to trust each other - if they're not the same machine, they have to be part of the same domain or domains which trust each other.
#2:
sa is typically a SQL Server account, stored in MSDB. If you want to use Windows authentication, you have to specify Trusted Connection=yes in the connection string. This tells the client code to negotiate a trusted connection. If the server is set to Windows Authentication only, you can't supply a username and password. If you had the Trusted Connection setting enabled, and you still couldn't connect, we need to talk about logins.
It isn't enough just to have a Windows user account to connect to SQL Server. The server also needs to know that the user is permitted to use it. By default only the built-in Administrators group is given access. To add a Windows login to SQL Server, open Enterprise Manager and go to Security > Logins. Right-click a blank area and choose New Login.
You also have to choose the roles for your user. Typically you want to select the public role. This role is usually given only the permissions necessary to use the database, not to administer it.
This is the reason you shouldn't use the sa user from an application: it's too powerful. The sa user maps to the dbo role, and is a server administrator. This means that the user can drop tables, delete data, insert data, alter stored procedures, alter table structure, basically do anything to any database on the server. That's far too powerful for an application.
By default, the public built-in role has no permissions at all. To add permissions in Enterprise Manager, expand the database you want to give permissions on and select Roles in the tree. Double-click the public role then click Permissions. Check the boxes for the permissions you want a general user to have.
#3:
Mixed Mode is a bit of a flaw because passwords are transmitted in the clear on the network between the client and the server. Anyone with a packet sniffer can read the passwords. You also have to store the password somewhere on the local machine. It's possible to do this in a secure way but it's typically easier to go with Windows authentication. You definitely want a strong sa password so that you're not susceptible to password-guessing attacks.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Wow. Many thanks to Mike for the great answers.
I've seen reference to Enterprise Manager in my SQL research but I don't think I have it. Unfortunately, I'm using MSSQL Desktop Edition (I think. The only GUI component I've seen runs in the systray and is called, "SQL Server Service Manager". I installed it from the SQL2000.msi package that gets installed with Visual Studio .NET Enterpise). How do I get a hold of Enterprise Manager? Many of the SQL solutions I find refer to it.
Many thanks,
-Ian
|
|
|
|
|