|
The SaveAdd method is used to add a frame to a multi-frame image, not to write a part of a larger image.
There is nothing in the framework to support partial writing of a large image. You have to do it by hand.
Look into the bitmap file format. There is no compression so the file format is fairly simple.
You have to specify how large the final image will be when you write the file header to the file.
One thing that might cause you some problem is that bitmap images are stored upside down...
---
b { font-weight: normal; }
|
|
|
|
|
Thanks for that Guffa. I know not to waste any more time with SaveAdd !
I tried the old fashioned way before but couldn't get it to work, but that was probably because I wrote the wrong size to the file header. I would just see a single strip visible yet the file size would indicate that all the data was there.
Thanks for the illumination,
zenzero
|
|
|
|
|
Hello,
I want to use multiple queries (so, in the while-loop of a reader, i want to use another query + reader).
The folowwing code will give an example:
<br />
SqlCommand myCommand = new SqlCommand("SELECT date, customerid FROM orders ORDER BY date ASC", connect);<br />
SqlDataReader myReader = myCommand.ExecuteReader();<br />
while (myReader.Read())<br />
{<br />
SqlCommand myCommand2 = new SqlCommand("SELECT customer FROM customers WHERE id = " + myReader["customerid"] + " ORDER BY date ASC", connect);<br />
SqlDataReader myReader2 = myCommand2.ExecuteReader();<br />
while (myReader2.Read())<br />
listBestellingen.Items.Add(myReader["date"] + " " + myReader2["customer"]);<br />
}<br />
myReader.Close();<br />
But he sais i allready have a reader open (which is the truth), and that i have to close it, but that's a no can do)..
Can somebody help me?
Thanks!
-- modified at 16:20 Thursday 25th May, 2006
|
|
|
|
|
A datareader keeps the connection open exclusively for the duration of its read operation.
There are 2 ways to rectify this:
1. use another connection for the second datareader
2. Read the contents of first datareader into an arraylist, close the datareader and then use the same connection for the second datareader (recommended).
With Regards
Shane Sukul
BSc Mcsd.Net Mcsd Mcad
.Net Architect/Developer
Ashlen Consulting Services P/L
|
|
|
|
|
Or a third option to produce a better SQL command that only requires one reader.
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
You can only have one active reader per connection. You must open a new connection to run two readers simultaneously on the same database. You also don't close your second reader which means it won't get closed until the garbage collector cleans it up - and that may not be for a long time.
However, you can do all this with one SQL command:
SELECT orders.[date], cusomter.customer
FROM orders
INNER JOIN customer ON orders.customerid = customer.id
ORDER BY [date] ASC
So your code would look like this:
SqlCommand = myCommand = new SqlCommand("SELECT orders.[date], cusomter.customer"+
"FROM orders INNER JOIN customer ON orders.customerid = customer.id ORDER BY [date] ASC";
SqlDataReader myReader = myCommand.ExecuteReader();
while(myReader.Read())
{
listBestellingen.Items.Add(myReader["date"] + " " + myReader["customer"]);
}
myReader.Close();
Does this help?
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
|
SQL Server 2005 supports having multiple readers open at the same time. (A feature called MARS).
You need to add MultipleActiveResultSets=True to the connectionstring to make this work for your connection.
string connectionString = "Data Source=localhost;Initial Catalog=AdventureWorks;IntegratedSecurity=SSPI;MultipleActiveResultSets=True";
|
|
|
|
|
Hello,
I'm using Visual Studio 2003. I have a simple windows form that I am working with in the Form Designer in Visual Studio. Whenever I change the size of the form in the Designer, then click save, rebuild and run, the changes do not take effect. The form still has the old size. In the InitializeComponent() method, the size of the form is changed. Does anyone know why this may be happening? Thanks in advance.
|
|
|
|
|
Try to "Clean solution".
Best regards, Alexey.
|
|
|
|
|
I'm developing an IExtenderProvider that will be located in a dll. From the code in the IExtenderProvider I want to find out the name of the control that is extended including it's namespace path, ie something like "WindowsApplication1.Form1.button1". How can I achive this?
Thanks in advance
Christian
|
|
|
|
|
In the class that implements IExtenderProvider write a routine to get the name and inside put something like:
string name = this.GetType().FullName
It's that simple! Might I suggest if you're writing lots of these extenders to create a base class which has this method already implemented.
You know you're a Land Rover owner when the best route from point A to point B is through the mud.
Ed
|
|
|
|
|
Thanks a bunch. I'm going to try this right away!
Right now I'm only writing one such extender, but otherwise it would be a good idea.
BR
Christian
|
|
|
|
|
Well. It didn't quite cut it. I'm wondering if it's because of the fact that the extender is in a dll that the windows application is referencing?
-- modified at 16:53 Thursday 25th May, 2006
When I use it, it returns "System.Windows.Forms.Button".
|
|
|
|
|
The following code (just a simple example):
using System;
using System.Windows.Forms;
namespace PiLogic.Windows.Forms
{
public class Test : Button
{
public string GetName()
{
return this.GetType().FullName;
}
public static void Main(string[] args)
{
Test test = new Test();
Console.WriteLine(test.GetName());
}
}
}
Displays the following text when run:
PiLogic.Windows.Forms.Test
So I don't know why you get System.Windows.Forms.Button, you sure your using this and not base ?
You know you're a Land Rover owner when the best route from point A to point B is through the mud.
Ed
|
|
|
|
|
The code is in an Extender. The extender gets a reference to the control as an object. The IExtenderProvider class is in a different assembly than the Button object. The dll does not reference the project with the form and button, as that would create circular references. I think that the IExtenderProvider evaluates the type to one that it's aware of.
This is not my actual code, but I think you get the idea.
bool IExtenderProvider.CanExtend(object o)
{
Console.WriteLine(o.GetType().FullName);
}
The button object is actually a System.Windows.Forms.Button type. Therefor I add the name of the Form that is parent of the IExtenderProvider to the name of the button. This will give me Form1.button1, but I also need the namespace that Form1 belongs to. If I do GetType().FullName on the form I get System.Windows.Forms.Form, but the actual type of the form would be WindowsApplication1.Form1.
Do I make sense?
/Christian
|
|
|
|
|
I get what you're trying to do now. The only way I can think of at the moment is you're going to have to create a pile of recursive functions to walk up through the button's parent hierarchy to extract the name. GetType () will just extract the base type of the button.
You can use the Name property of the control, and then iterate backwards to it's parent form and the parent form's namespace etc. But I think that this is a bad way to do it. As I said, I can't think of another way at the moment, I'll keep trying but might I suggest trying to find another way around this. Can you store the actual references rather than the names? Then (I'm guessing now ) if you need to compare the two objects you can use == to do it.
You know you're a Land Rover owner when the best route from point A to point B is through the mud.
Ed
|
|
|
|
|
Thanks for your input. I have already prepared a workaround, as I don't want this issue to tie me up any longer. I'm using the form name and the control name only.
I can understand why GetType().Name returns System.Windows.Forms.Button for the button, because my button is only an instance of that type. The form on the other hand is an instance of a custom made class that inherits from System.Windows.Forms.Form. Because of this, the function should return the name of my class that the object is instanciating.
Again, thank you for your effort.
/Christian
|
|
|
|
|
Hi Guys,
I cant find any section for Biztalk server in the Code Project.
Is it not relevant here?
Or should we have it?
I strongly believe that we should have a section for Biztalk so that we can share Biztalk related project samples and information.
Thanks
Firoz Ozma
..:: firozOzman ::..
http://spaces.msn.com/members/firozozman/
|
|
|
|
|
i m very bad in c# programming
can anyone tell me good websites or books to learn c# programming.
plzzzzzzzzz its very urgenttt
|
|
|
|
|
lucky1234560 wrote: can anyone tell me good websites or books to learn c# programming.
This one!
You know you're a Land Rover owner when the best route from point A to point B is through the mud.
Ed
|
|
|
|
|
|
Has anyone had to find the virtual application root inside a javascript? I'm having some trouble with it. In the past, we have been able to use:
var spellURL = "../CommonPages/SpellCheck.aspx";
inside our spell.js script. But we recently added a new level of subdirectories. So SOMETIMES we need another "../" in order for js to find the aspx page. So instead of trying to use relative paths, does anyone know the js equal of "~"??
fyi - i didn't design the new level of directories. That was PJ (Pre-Jessica)
Thanks, Jessica
|
|
|
|
|
FYI - ended up using
/AppName/CommonPages/SpellCheck.aspx
Thanks, Jessica
|
|
|
|
|
I have this as part of building an array of pictureBoxes:
excuse the .<. below because without the .'s the rest of the line was cut off
for (i=0; i.<.MaxPics; i++)
{
ACTHumbBox[i] = new PictureBox();
...
ACThumbBox[i].MouseClick += new MouseEventHandler(ACThumbBox_MouseDown);
...
}
private void ACThumbBox(object sender, MouseEventArgs e)
{
blah blah blah
}
How can I determine which pictureBox triggered the event?
-- modified at 14:56 Thursday 25th May, 2006
|
|
|
|