|
Ok, I had this simple image box and when setting the image property to my 1 pixel width image, I see a stupid fading effect applied to my image?? Why does the IDE have to nose in and "fix it" for me
Please help
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
If you want a solid color, you have to use nearest neighbour scaling instead of bicubic scaling. If the control has no propery for changing this, you have to scale the image yourself before putting it in the control.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Hey Guffa!
Thanks, but it's not working, I believe it has something to do with PixelFormat that I cant set
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
Muammar© wrote: Thanks, but it's not working
What's not working?
Muammar© wrote: I believe it has something to do with PixelFormat that I cant set
How do you try to set it?
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Create a new bitmap of the same size with the PixelFormat you want and copy the old image into this one.
|
|
|
|
|
Hello Mr. Solo
Sorry but DOH , can you tell me how to do it?? Did you try it??
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
Hi All
Who I Can Add Footer To DataGrid Or DataGridView In .Net By Using C# Code
In Windows Application ??
This Option May Be Tack To Cerate New Windows Application Control Inhert From DataGrid Or From DataGridView .
Who I Can Do That ?
Thancks For Any Body Help me
Thaer
|
|
|
|
|
Code(C# .Net 2.0):
private System.Windows.Forms.ToolStripButton toolStripButton_Scan =new System.Windows.Forms.ToolStripButton();
this.toolStripButton_Scan.ToolTipText = "New transaction created from scan";
question:
How to change the style of the text "New transaction created from scan".
Thank you!
|
|
|
|
|
The simple answer is: you can't.
If you really really have to, it might be possible by handling the tooltip yourself.
To do this you'll need to:
(1) Create a tooltip you can maintain reference to.
(2) Implement your own draw via the Draw event, drawing the desired string via the graphics object provided.
(3) Intercept the appropriate mouse events to popup and clear the tooltip.
I'm largely language agnostic
After a while they all bug me
|
|
|
|
|
Thank u.
Now,I can get the tooltip by the sentence like this:
ToolTip tip = (ToolTip)ToolStrip1.GetType().InvokeMember("ToolTip", BindingFlags.GetProperty | BindingFlags.NonPublic|BindingFlags.Instance, null, ToolStrip1, null);
I'm able to change the backcolor , forecolor etc.. Except the fontsize.
My purpose is to change the fontsize. how to do it ?
|
|
|
|
|
Add an event handler for the Draw event, then handle the drawing yourself.
The event args will have a Graphics instance you can use to draw the string.
I'm largely language agnostic
After a while they all bug me
|
|
|
|
|
|
I want to create a backend application which posts data to a asp.net web server at regular intervals of time..
How to implement this??
Also, if I use a web service, will that me helpful??
Can anyone help me??
Som
|
|
|
|
|
do you understand what is meant,when they say "backend"?
Please tell us in details what do you ant to do and how far have you gone doing it,remember we cannot do work for you, start and get stuck and we will unstuck you.
thanks
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
Is it possible to insert a array in the value part of a dictionary?
I want this array of bool:
bool[] arrayOfBool = new bool[10];
I'm not sure how to setup the dictionary, I tried with this:
Dictionary<int, Collection<bool[]>> dict1 = new Dictionary<int, Collection<bool[]>>();
Or this:
Dictionary<int, bool[]> dict2 = new Dictionary<int, bool[]>();
But when I try to add an item for each dictionary, I get some errors. Maybe the entire dictionaries are wrong.
Is this possible? If so, how?
/Steffe!
|
|
|
|
|
What error are you getting? Compile time? Run time? "Errors" isn't very helpful, you know.
Anyway, this works for me:
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
namespace CollectionDictionary
{
class Program
{
static void Main(string[] args)
{
bool[] array1 = new bool[10];
bool[] array2 = new bool[10];
FillBools(array1);
Thread.Sleep(1000);
FillBools(array2);
PrintBools(array1);
PrintBools(array2);
Dictionary<int, bool[]=""> dict = new Dictionary<int, bool[]="">();
dict[1] = array1;
dict[2] = array2;
PrintBools(dict[1]);
PrintBools(dict[2]);
}
private static void FillBools(bool[] array)
{
Random r = new Random((int)DateTime.Now.Ticks);
for (int i = 0; i < array.Length; i++)
{
array[i] = r.Next() % 2 == 0 ? true : false;
}
}
private static void PrintBools(bool[] array)
{
foreach(bool b in array)
{
Console.Write(b + ", ");
}
Console.WriteLine();
}
}
}</int,></int,>
|
|
|
|
|
Your dict2 attempt is the correct way. This is how you add an item to the dictionary:
dict2.Add(42, arrayOfBool);
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Thanks, that worked!
I tried to write the value "true", to one of the bools in the array, with this code:
dict2[42].arrayOfBool[1] = true;
But it didn't work. I got this error:
'System.Array' does not contain a definition for 'arrayOfBool'
How do I get access to one of the bools in the array, so I can give it value?
/Steffe!
|
|
|
|
|
dict[42] will return the array, so you should be able to access the n'th element of the array using
dict[42][n] = true;
|
|
|
|
|
Thanks! That worked fine
|
|
|
|
|
I have a question. I have an image and I want to binarize it in C#. I don't want it to be in a fax (black and white 1 bit) format. It can be in grayscale but it needs to be binirized.
Any ideas on this?
|
|
|
|
|
mikefl wrote: binarize
Pardon? What are you trying to do here? Convert it to a byte stream? If so, you may want to try
public byte[] ConvertImage(Image image)
{
using (MemoryStream ms = new MemoryStream())
{
image.Save(ms, ImageFormat.Gif);
return ms.ToArray();
}
}
|
|
|
|
|
Thanks for the comment. I have a grayscale image. I need to binarize it so that it looks pretty decent. I tried converting it to 1 bit black and white and many of the parts of the image are complete white or black. I need to basically get one grayscale image and convert it into a nice binarized copy of it that's black and white (no gray pixels) but not smudged.
Any ideas?
|
|
|
|
|
I don't understand exactly what you are trying to do. Anyway:
Grayscale means that each pixel will have equal values for R,G and B.
Usually, that value will be (R + G + B) / 3 for the current pixel.
Binarization means that each pixel will either be black or white.
pseudocode:
foreach pixel in image<br />
{<br />
int greyValue = (R + G + B) / 3;<br />
if(greyValue >= threshold)<br />
setPixel(255, 255, 255);
else<br />
setPixel(0, 0, 0);
}
|
|
|
|
|
what would be a good working version of that code? Is there anything online that I can look at that's functional?
|
|
|
|