|
Hi,
1. How can you resize a picture stored in a Bitmap object.
2. Why is it not a real icon when you save it as ImageFormat.Icon
Thanks
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
1 - You can create a new bitmap of the right size, and copy it through a graphics object. You can also just display it at a different size, if that's all you need.
2 - I have no idea, what makes it not real ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Thank you Christian, regarding (2), simply when you save it as an icon that way, it's not displayed along with the other icons as "an icon", you dont see the icon!! you just see the file as if it's a corrupted file and the only way to view it is to set the container folder view as "thumbnail", simply it still acts like a picture file with a missing icon!
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
Muammar© wrote: How can you resize a picture stored in a Bitmap object.
Create a new Bitmap object with the size you want, create a Graphics object for it, and draw the original image on it scaled to the size.
Muammar© wrote: Why is it not a real icon when you save it as ImageFormat.Icon
In what way is it not a "real" icon?
Have you included any mask in the image? I don't know how to do this exactly, but I suppose that you would add it as another frame to the image.
---
single minded; short sighted; long gone;
|
|
|
|
|
mask.. frame.. Even more puzzled!
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
Icons use a specific color as a transparency mask.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
bm.MakeTransparent(colorDialog1.Color); still not working.. Please christian, help
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
Hello,
You can get the Color directly from your Bitmap:
Color transparentColor = bm.GetPixel(0, 0);
bm.MakeTransparent(transparentColor);
Hope it helps!
All the best,
MArtin
|
|
|
|
|
Thanks Martin, but I tried this as well.. nope, still not working, are you telling me that it's working fine with everyone here??
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
Hello,
Muammar© wrote: are you telling me that it's working fine with everyone here??
It worked more than once for me.
Have you converted your icon from and jpg maybe?
If yes check if it's realy using only one background color. (Fast: Use Paint and try Fill background with Red)
Where are you showing the bitmap after making it transparent?
All the best,
Martin
|
|
|
|
|
I didn't say it would, I was just explaining the terminology. Why do you need to create an icon in code ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi,
IIRC this is the code snippet that creates a real icon from a bitmap:
Icon icon=Icon.FromHandle(bitmap.GetHicon());
Stream s=new FileStream(fileSpec, FileMode.Create);
icon.Save(s);
s.Close();
|
|
|
|
|
Thanks Luc
IT'S WORKING
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
Hi
I want to put value"DD5FGRT" in byte array
and want to compare two byte array.
how can i do this.
|
|
|
|
|
Characters are encoded and decoded to byte sequences - you can't talk about a byte representation of a string without specifying an encoding.
You will find the encodings in the Text namespace:
System.Text.Encoding.UTF8.GetBytes("DD5FGRT");
People tend to use ASCII and Default (ANSI) encoding as well, and these are indeed great - when interfacing with your grandmothers DOS programs. They do not belong in any serious development today as they can only handle a miniscule subset of text. For the Default encoding, you even have the added benefit that this will change from system to system (or on the same system when someone change regional settings).
If nothing else, you can always check the length of the array, and then loop it to see if it's identical.
|
|
|
|
|
I open the second form from first form.
but the first form can not get the second one with OwnedForms attribute.
whenever it maybe happen?
|
|
|
|
|
You need to set the Owner or Parent property on the form.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
|
Hi
Right now i am stroing dts package in local and executing it. The code what i have written is
Dataset ds=new Dataset();
Package package=GeneratePackage(); //Generate package is a my function
Application app=new Application();
app.SavetoXML("path",package,null);
DtsConnection dtsCon=new DtsConnection();
dtsCon.ConnectionString=package.GetPackagePath();
dtsCon.Open();
DtsCommand dtsComm=new DtsCommand(dtsCon);
dtsComm.CommandText="DataReaderDest";
IDataReader reader=dtsComm.ExecuteReader(CommandBehaviour.Default);
ds.Load(reader,LoadOption.OverwriteChanges,reader.GetScehmaTable().TableName);
return ds;
It is working fine. I would like to execute the package without storing it in local using dtscommand. Can anybody help me please.
kesavan
-- modified at 3:20 Thursday 24th May, 2007
|
|
|
|
|
Could you let me know about Trace Collector, with respect to object cleanup?
Cheers,
Jaya Vidya
|
|
|
|
|
The main thing you need to know about object cleanup, is call Dispose if it's available.
I googled for trace collector, where did you hear about it ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi,
I wish to disable toggling of check box in checked list box (C#). If my check box is checked user shall not be able to uncheck it and vice versa but text should be allowed to be selected.
In list box i was able to set colours for items but if i set color i am not able to select any of item. I wish to give colors to items in list box but also i should be able to select the items.
Please help if someone knows the solution of above 2 issues.
|
|
|
|
|
Have you copied the question of your friend from your class?
|
|
|
|
|
Hi,
I wish to disable toggling of check box in checked list box (C#). If my check box is checked user shall not be able to uncheck it and vice versa but text should be allowed to be selected.
In list box i was able to set colours for items but if i set color i am not able to select any of item. I wish to give colors to items in list box but also i should be able to select the items.
Please help if someone knows the solution of above 2 issues.
|
|
|
|
|
Hello,
Ashish_Sood wrote: I wish to disable toggling of check box in checked list box (C#). If my check box is checked user shall not be able to uncheck it and vice versa but text should be allowed to be selected.
It sounds like you don't whant to set "Enabled" to false.
What you can do is handle the "ItemCheck" event and reset the Current value property of ItemCheckEventArgs.
private void checkedListBox1_ItemCheck(object sender, System.Windows.Forms.ItemCheckEventArgs e)
{
e.NewValue = e.CurrentValue;
}
Ashish_Sood wrote: In list box i was able to set colours for items but if i set color i am not able to select any of item. I wish to give colors to items in list box but also i should be able to select the items.
I think you can select, but the color changes if you do so.
Maybe by handling the "SelectedIndexChanged" and reseting the color you can be successfull.
Hope it helps!
All the best,
Martin
|
|
|
|