|
I am fairly new to winforms and for some reason even though I added a 32x32 bitmap to my LargeImageList for my ListView it resizes them to 16x16 at runtime. My small icons display at the same size. The actual files are 32x32. Anyone encountered this and know how to fix it?
Matt Newman Sonork: 100:11179
"Battleship, was the first game that taught you to lie" - Zachery
|
|
|
|
|
Hi!
What should I do to create working bindable property in my custom control? I took System.Windows.Forms.Label, inherited into nLabel (numeric label) and added following code:
[Bindable(true)]<br />
public int val <br />
{<br />
get { return _val;}<br />
set { _val=value; this.Text=_val.ToString(); }<br />
}<br />
next I've bound this control and some other control to one datasource. I tried to change value, but value is locked by my control.
What is wrong?
h.
|
|
|
|
|
try return this.Text;
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
I'tried this one - it doesn't work (
There is really interesting event flow in the bound property. When you try to change value at bound column, property events are fired as following: GET ( ), SET, SET.
First GET destroy any data changes - because it reads from internal data of my class. This makes value "uneditable". How to detect, that data was changed externally or is it possible to not return anything from the property?
h.
|
|
|
|
|
Well it gets every second. I include a blank set set {} and this suffices for my read only
One way you might look into is
MyClassList : CollectionBase, IBindingList
MyClass : IEditableObject
Use the customer example in the IEditableObject example in msdn help within the IDE
The reason its doing this is it has to raise events notifying the control of changes.
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
HI!
thanks for your time and help. I tried to implement IEditableObject in my class, but these methods are not used in regular databinding. They are used in grids only.
but the most important I've found the bug:
I've made form with datagrid and nLabel connected to one datasource. I found, that they cannot be based on one currency manager. When they are on separate cm, everything works well. I've never seen similar behavior before this one. Could anybody explain it to me?
h.
|
|
|
|
|
yes they are used in datagrid or any control that uses an IBindingList
I use them for labels also
basically my class looks like
public class MyClass
{
private string s;
private MyObject i;
public string MyString
{
get { return s; }
set { s = value; }
}
public MyObject ThisObject
{
get { return i; }
set { i = value; }
}
}
public class MyObject
{
public override string ToString()
{
return "MyObject class";
}
}
if any other problems, explain a little more and I can send a prototype project to ya. I had to go trhough hell with getting my databinding to work. My classes wrap the database then bind to classes. And i perform biz rules on them so almost no code in GUI.
nick
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
Hi!
It seems you truly are an expert - esp. in Windows controls )
I have just one more question: How the bound property notifies datasource, that it's value has changed?
Let's imagine textbox with similar property val as in the numLabel described in my first mail. When value in datasource changes, text in textbox will change. But when user changes text in textBox, datasource doesn't change untill some other control does not refresh data. I played with control bound to dataset and datagrid which shows data from table. When I've changed value in the control, datagrid doesn't show any changes. But when I clicked on bound column in current row of datagrid, the value was read from the control. I'd like to know if there is a way to make it without clicking in datagrid - just like all MS controls do?
thanks again
h.
|
|
|
|
|
yeah I had a hard time with this also. The datagrid reacts by the underlying data source having its OnListChange event fired. This forces a refresh of the data for the grid.
You might try on either the change or leave event raising a changed event. This could possibly help in your situation. I'm a few days from this same situation in my app, so either way I will have to figure it out.
nick
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
Hi,
Is there a way to determine the indexes of rows that has been selected on a Datagrid in a Windows Form. I am trying to return values for what have been selected in the datagrid, but so far, I have only found the method, currentcell. Are there other events or methods I can use? Thanks in advance.
|
|
|
|
|
CurrentCell do that.So why don't you use it?
Mazy
No sig. available now.
|
|
|
|
|
Because it seems like currentcell only returns the one that is last selected. So if I highlight two rows, then it would not work.
|
|
|
|
|
|
|
I'm trying to create a remote object in a client application. It works using:
ClassRemotable ob=(ClassRemotable)Activator.GetObject(
typeof(ClassRemotable),
"tcp://127.0.0.1:8989/MyServer/ClassRemotable"); but it fails with:
object[] activationAttributes = {new UrlAttribute "tcp://127.0.0.1:8989/MyServer")};
ClassRemotable ob=(ClassRemotable)Activator.CreateInstance(
typeof(ClassRemotable),
null,
activationAttributes); throwing a System.Reflection.TargetInvocationException with the text "Requested Service not found".
Any idea why?
rechi
|
|
|
|
|
Hi.
I have a label which I would like to Databind to the count property of a rows collection in a datatable:
label1.DataBindings.Add("Text", MyDataTable.Rows, "Count");
The label gets the first time i put data into the table. But when i clear() the table and put new data into it, the label does not get the changes.
Why is that?
|
|
|
|
|
try setdatabinding maybe
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
no that's not it. think it has something to do with datatable.rows.count not sending notifications.... but i cant see how i can find out if it is supposed to send notifications....
|
|
|
|
|
Hi, I trying to run a registered version of WinZip 8.1 via a SOAP Service written in C# with Visual Studio 2002.
And I am trying to unzip a file on the server using a soap service call
When I take the code out of the SOAP service and try to run it on my local machine as is it works, on the server that the SOAP service is running on all I get is the executable being run in the background and only visible through the Task Manager, but no files being unzipped. The command line that I actually run does work if I run it from the command promt on the server.
sFileName = "\Temp\QNH007983.zip"
sRootFolder = "\Sat\"
Zip command being run 'winzip32.exe-e "C:\Temp\QNH007983.zip" "C:\Temp\Sat\"'
ExtractZipFile( @"\Temp\QNH007983.zip", @"\Sat");
private string ExtractZipFile(string sFileName, string sRootFolder)
{
try
{
string emuPath = "winzip32.exe";
//string emuParams = " -min -e \"C:" + sFileName+ "\" \"C:" + sRootFolder + "\""; //run minimised
string emuParams = "-e \"C:" + sFileName+ "\" \"C:" + sRootFolder + "\"";
ZipFileCall = emuPath + emuParams;
Process p = new Process();
ProcessStartInfo psI = new ProcessStartInfo( emuPath , emuParams);
psI.CreateNoWindow = false;
psI.UseShellExecute = true;
p.StartInfo = psI;
p.Start();
return sFileName;
}
catch
{
return "Failed - to save zip file";
}
}
thanks in advance
Satvinder
|
|
|
|
|
In my application, I want to read images which are in the PNG format, 256 colors, with transparency, store them in memory and then display them on screen.
So I do something like that :
Bitmap[,] myBitmapArray;
...
myBitmapArray[i,j] = new Bitmap ("FileName.png");
...
graphics.DrawImage(myBitmapArray[i,j]);
The pb is my application takes 100 Mb in memory to load the pictures, which are only 4 Mb in the files
Apparently, when loading a picture, there is no format specifier. So I thought it should use the file, but when looking at the PixelFormat member, it's always 32bpp...
So I have tried to create the bitmap another way,
like new Bitmap (128,64, System.Drawing.Imaging.PixelFormat.PixelFormat8bppIndexed), and then copy my image from the file here.
But :
- If I use 16bpp555, I lose the transparency
- If I use 16bpp1555, JIT debugging tells me "out of memory"
- If I use 8bppIndexed, JIT debugging tells me I cannot create a graphics (graphics.FromImage -> error).
How can I load my 256 color files and draw them in a picture box, without taking so much memory because they are transformed in true color?
|
|
|
|
|
i think you mean Format16bppArgb1555?
you could hack it an store the byte[] data from the image in an array, and then only create the bitmap when you need it..
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
I've made some further testing, and discovered it comes from the format.
With two similar picture, 256 colors,one is png the other is gif
Bitmap bitmap = new Bitmap("Myfile.png");
-> bitmap.PixelFormat = PixelFormat.Format32bppArgb
Bitmap bitmap = new Bitmap("Myfile.gif");
-> bitmap.PixelFormat = PixelFormat.Format8bppIndexed
Conclusion :
The png codec is "buggy" and if you use the standard constructor, the bitmap ignore the file attributes and is always 32bppp.
The gif coded works OK, and the bitmap keeps the file attributes.
With this, I've reduced my application memory usage by 60%
|
|
|
|
|
I want to convert a text based protocol into XML, using C#, how do I do that in the best maner ?
Can I use XSLT in any way ? or do I have to make an parser that converts the file manually ?
An example of the text file:
BORN ANTAL AXLAR = 220
VARMGÅNG
TJUVBROMS
TEST EFTER TÅG !!
FELKODER
W00 T02
VARMGÅNGS MÄTVÄRDEN ANTAL AXLAR = 220 TÅGRIKTNING = U
LH097 023 029 030 029 026 031 017 030 022 029 033 027 032 027 025 020 033 034 029 024 031 028 027 024 031 027 020 024 033 037 031 019 027 026 022 022 032 024 022 019 032 026 024 029 029 028 029 024 032 031 028 027 032 031 021 026 031 029 023 027 030 032 025 022 025 031 027 024 039 032 023 025 032 029 023 027 029 038 025 028 028 027 024 024 034 025 020 029 028 037 025 028 035 031 023 025 024 026 023 023 030 032 025 021 039 033 022 027 035 026 020 028 031 029 023 024 035 027 027 024 027 026 024 022 033 027 027 025 030 029 030 028 032 028 027 025 030 024 034 026 025 023 024 025 028 029 023 029 036 032 022 027 030 029 028 025 028 027 022 024 035 027 034 028 033 023 022 025 030 025 028 027 032 028 022 027 030 026 020 029 029 028 025 024 016 017 013 012 018 012 011 015 016 012 014 013 019 012 013 013 014 011 011 013 036 027 032 029 028 022 024 024 023 017 017 021 032 026 018 025 LV097 028 026 027 033 039 027 031 032 024 025 027 023 037 026 028 023 031 028 025 022 030 028 023 024 028 025 025 026 032 029 024 021 033 022 020 022 034 023 022 021 028 029 026 023 030 027 025 026 033 028 023 019 032 028 023 026 030 023 024 032 030 026 022 024 028 022 020 029 036 032 022 021 038 025 026 025 032 033 026 027 030 020 027 025 038 024 024 029 027 027 019 027 035 021 025 023 034 026 028 026 032 030 028 018 035 031 027 026 029 031 022 024 029 022 023 020 028 031 023 037 028 022 024 020 032 024 021 031 031 028 029 020 032 025 029 022 032 024 032 026 025 025 026 020 031 026 024 026 034 030 022 022 033 026 021 024 034 023 022 020 034 029 025 035 034 021 027 027 032 029 024 024 023 027 028 028 025 023 023 021 032 032 023 023 013 013 008 012 014 013 008 010 013 012 011 010 016 013 009 016 014 010 008 011 046 032 027 027 029 025 024 019 028 010 024 010 033 020 021 022
TJUVBROMS MÄTVÄRDEN
LÅGNIVÅ HS = 047
LÅGNIVÅ VS = 047
ANTAL AXLAR HS = 220
ANTAL AXLAR VS = 220 TÅGRIKTNING = U
TH 002 002 001 001 002 002 002 002 002 002 002 002 001 002 002 001 001 001 001 001 001 001 001 001 002 001 001 001 002 002 002 002 001 001 001 002 001 001 001 001 001 001 002 001 001 001 002 001 001 001 002 002 001 001 001 001 002 001 002 001 002 001 002 001 001 001 002 001 001 001 002 002 001 001 001 001 002 001 002 001 001 002 001 002 001 001 002 001 001 001 002 001 001 001 001 002 001 001 002 001 001 001 001 001 001 001 001 001 001 001 001 001 002 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 002 001 001 001 002 001 001 001 001 002 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 002 002 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 001 002 001 001 001 001 001 001 001 001 001 001 002 001 001 001 001 001 001 002 001 001 001 002 001 001 001 002 001 002 001 001 001 001 001 001 001 002 001 001 001 TV 001 001 002 001 002 001 003 002 002 002 003 001 003 003 002 001 001 001 003 003 001 001 001 002 003 002 001 001 001 003 003 002 001 001 002 003 002 001 001 001 002 002 002 001 001 002 003 002 001 001 001 002 002 001 001 001 003 002 001 001 002 002 002 001 001 001 003 002 001 001 002 003 001 001 001 001 003 001 001 001 003 003 002 001 002 003 002 001 001 001 002 002 001 001 003 003 001 001 002 003 001 001 001 002 002 001 002 001 002 001 001 001 003 002 001 001 002 003 001 001 001 002 002 001 001 002 003 001 001 001 003 002 001 001 003 003 001 001 002 003 001 001 002 002 001 001 002 003 001 001 002 002 001 001 002 003 001 001 001 003 002 001 002 002 002 001 001 002 002 001 001 001 002 001 002 001 002 001 001 001 002 001 001 001 002 002 002 002 002 001 002 003 001 001 002 003 001 001 002 002 001 001 002 002 001 001 003 002 001 002 002 002 001 001 002 001 002 002 001 001 <.
.
|
|
|
|
|
well of course you could use xslt, it can even be user to create excel files
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
hi evey one,
I have a problem with RichTextBox in System.Windows.Forms.
the function SuspendLayout() and ResumeLayout() doesn't work!!!
Did I do something wrong?
And what is the solution when I want to cancle the drawing of this control?
Thank you in advanced,
Eran.
|
|
|
|