|
Your only other option is a byte array that cannot be displayed until you put it in a bitmap. All bitmaps are square. That's why I'm trying to clarify what you need here.
Christian Graus
Please read this if you don't understand the answer I've given you. If you're still stuck, ask me for more information.
|
|
|
|
|
So then if i want to create a bitmap that contains a triangle, would I create a bitmap that can enclose the triangle and fill the rest with something like null pixel value?
|
|
|
|
|
No such thing as null, you'd need to choose a color to fill the rest with.
Christian Graus
Please read this if you don't understand the answer I've given you. If you're still stuck, ask me for more information.
|
|
|
|
|
From what i see in System.Drawing.Region, correct me if Im wrong, I can create a region of any size and shape. System.Drawing.Rectangle uses four points to specify the size of the rectangle using four points, but i dont suppose its possible with System.Drawing.Region using three points? Im not sure if im making sense.
From reading previous posts, i implied that i needed to save these two triangles separately, which meant that i need to display the divided image. However, this is not the case. I just need to divide up an image, perform some changes within those triangles and display them altogether with the changes that were made.
|
|
|
|
|
You can create a region, but that's not a bitmap. I thought a region specified an area on a bitmap, not an irregular bitmap itself.
Yes, I believe the graphics object has a number of methods that take a region and only operate within that region on the bitmap. What sort of changes ?
Christian Graus
Please read this if you don't understand the answer I've given you. If you're still stuck, ask me for more information.
|
|
|
|
|
Just changing the value of the pixels. Nothing complex. So to create a region using System.Drawing.Graphics, i just use a Point array?
Thanks for the responses.
|
|
|
|
|
yeah, I believe so.
Christian Graus
Please read this if you don't understand the answer I've given you. If you're still stuck, ask me for more information.
|
|
|
|
|
|
Ok few more questions:
1) How is the coordinate plane set up? Like where would the origin be?
2) could a point be outside of an image?
|
|
|
|
|
Hey:
I have understood the following problem...that u want to convert a rectangular image into two triangles...
"first thing no bitmap is in the form of triangle...Because(by definition) a Bitmap is a rectangular array of pixels...so it can never be triangle"
However u can read the image using byte array...with the help of Marshal.copy method....then copy Half of the array to 1st image array & half to the 2nd image array....
again use.Marshal.copy()method) to convert the bytes array to Bitmap image....
For all the above u must have concept of the following:
1-BitmapData
2-Safe & Usafe code
3-Marshal.copy()method.
Th nks
"Programming is a fun"
|
|
|
|
|
Rao Rafique wrote: However u can read the image using byte array...with the help of Marshal.copy method....then copy Half of the array to 1st image array & half to the 2nd image array....
Not a triangle, you couldn't. Not unless you copied one row at a time. And I explained that in depth, you can have the bytes in memory, but not in a format you can view.
Christian Graus
Please read this if you don't understand the answer I've given you. If you're still stuck, ask me for more information.
|
|
|
|
|
Hello,
lam using the next method of the random class to return integer between 0 and 15 but it repeats some numbers.
so what can I do to prevent it from repeating numbers?
Dad
|
|
|
|
|
you can't, that's what 'random' means.
To do what you want, build a list of 16 ints, 0-15. Get a random number from 0-15 and pull that index out of the array. For your next number, get a random digit between 0 and 14. And so on.
Christian Graus
Please read this if you don't understand the answer I've given you. If you're still stuck, ask me for more information.
|
|
|
|
|
Christian Graus wrote: To do what you want, build a list of 16 ints, 0-15. Get a random number from 0-15 and pull that index out of the array. For your next number, get a random digit between 0 and 14. And so on.
That wouldn't help much because even if you reduce the number each time, you can still get the same number multiple times (if the first Next() returns 3, nothing stops the next call of the method to return 3 again).
You should save the numbers in a generic List, because it has a variable amount of items and you can still access the items by int indexes.
Then call Next() and after getting the value from the list, remove the index that just has been generated by Next (you need to save its result in some variable).
For the next step, you'd need to create a new random with the changed count of the now smaller List as seed (why can't you change the seed of a random after it's been created anyway?).
|
|
|
|
|
Hi all.
How can i hide the mail address of the "sender" of a mail in C#?
Thanks.
|
|
|
|
|
How do you mean ? If you're sending the mail with C#, then you can specify whatever sender you like.
I assume you're writing some sort of hostile mail bomb or spam program. Why do you want people to hate you ?
Christian Graus
Please read this if you don't understand the answer I've given you. If you're still stuck, ask me for more information.
|
|
|
|
|
I read it the same way. If he doesn't understand something that trivial, he'll get nailed for sure!
|
|
|
|
|
What you are asking for is not possible. An email message has to have a sender.
You can put any sender address you like in an email message, then it depends on your mail server what addresses it allowes as sender.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Thanks for the replays.
The problem is this:
I've made a software for save password,and i've insert in it a service "password recovery" thath send a mail with the password of the account (if the user have insert it).For this i'm using my gmail account.
But i've try to send a mail to me (to another address, and so i've see that the user can see my mail address).
How can i avoid the problem?
If i have to create another mail account,can you advice me what service to use? (a free service that i can use with C# and i can block the replay).
Thanks.
Ps:sorry for bad english.
|
|
|
|
|
I have a table that I want to display one column to a user for viewing only via a windows form. What is the easiest way to display this data?
I was looking at the DataGrid, but I am not sure how to load this. Any sample code or articles on this componet would be great.
Thanks!
|
|
|
|
|
Just do a search of the articles on this site for something like "Bind data AND grid", and I'm sure you will find multiple examples.
|
|
|
|
|
Set the datasource of the grid and call the databind method. Look for some articles for more info on how to format the data.
Christian Graus
Please read this if you don't understand the answer I've given you. If you're still stuck, ask me for more information.
|
|
|
|
|
First of all let me apologize for posting this without searching about it first.
I'm doing this because I'm in a hurry and I need to leave my work right now, and I was in the middle of this problem.
Well I'm starting on p/invoke just now and I can't make it work.
I created a class with all methods I need to call from the dll and it looks something like this:
[DllImport(@"MitraLib.dll", EntryPoint = "MitraConectaBD", CallingConvention = CallingConvention.StdCall)]
public static extern int MitraConectaBD(IntPtr AsUsuario, IntPtr AsSenha, IntPtr AsBanco, bool AbLoginPrompt);
Well, with the class created I started to code what I wanted:
public Form1()
{
Thread.CurrentThread.Name = "MAIN";
InitializeComponent();
IntPtr ptrLogin = Marshal.StringToHGlobalAnsi("oscar");
IntPtr ptrSenha = Marshal.StringToHGlobalAnsi("1");
IntPtr ptrDataBase = Marshal.StringToHGlobalAnsi("Gerencial2000i");
int retCode = MitraLib.MitraConectaBD(ptrLogin, ptrSenha, ptrDataBase, false);
Marshal.FreeHGlobal(ptrLogin);
Marshal.FreeHGlobal(ptrSenha);
Marshal.FreeHGlobal(ptrDataBase);
}
Well, when I try to compile my project I get an exception saying
(translated to english by myself)
It wasn't possible to load the DLL 'MitraLib.dll': It wasn't possible to find the specific module(Exception HRESULT: 0x8007007E)
or something like that.
Does anyone have any clue?
I'm sorry again for posting this withou searching the forum (although I googled it but didn't find anything)
ps. MitraLib.dll is a Delphi code.
Thanks in advance
Oscar
|
|
|
|
|
Not sure, but try removing the namespace:
int retCode = MitraLib.MitraConectaBD
|
|
|
|
|
Hi there!
Thanks for the attention.
But no, that didn't work. When I remove MitraLib the method MitraConectaBD stops belonging to the current namespace!
I forgot to tell on my first post: My MitraLib.dll file is already in bin\Debug and in bin\Release folders.
Also, in the project properties, the output path in in Build tab is already set to bin\Debug
But still doesn't work...
Is there any extra configuration I should make to work?
Thanks again!
|
|
|
|