|
Like this:
...
this.panel1.Controls.Add(this.pictureBox1);
...
this.pictureBox1.Size = new System.Drawing.Size(pictureBox1.Image.Width,
pictureBox1.Image.Height);
this.panel1.AutoScroll = true;
...
These are the important lines.
The first line will add "pictureBox1" to "panel1" (it is now inside the panel)
The second line will set the pictureBox1.Size to the size of the loaded image.
The third line adds "AutoScroll" to the panel.
As soon as the panel is smaller than the image of the picturebox within, Scrollbars will appear.
Cheers
Sebastian
|
|
|
|
|
I have a problem with images in my application, I cant build them in.. it allways says:
************************************************************************************************
Eine nicht behandelte Ausnahme des Typs 'System.Resources.MissingManifestResourceException' ist in mscorlib.dll aufgetreten.
Zusätzliche Informationen: Für die angegebene Kultur (oder die neutrale Kultur) in der Assembly konnten keine Ressourcen gefunden werden. Stellen Sie sicher, dass 'Form1.resources' richtig in die Assembly 'NeckingRa' eingebettet wurde.
baseName: Form1 locationInfo: NeckingRa.Form1 resource file name: Form1.resources assembly: NeckingRa, Version=1.0.1706.20859, Culture=neutral, PublicKeyToken=null
*************************************************************************************************
Its in German, but someone maybe knews what is this about???
What should I do now? Please help me.
I am beginer so please explane it so I can understand
|
|
|
|
|
Are you using a setup project to deploy your app? if so just add the files to your setup project and tell it where to put them when you project gets installed. If not then you'll have to add them as resources.
Kev Pearman MCAD
|
|
|
|
|
No, I am not creating a Setup..
Im still working on app..
I changed my code and added
public struct PointD
{
public double x;
public double y;
}
public struct node
{
public string Name;
public ArrayList Lstates;
}
and my images were gone..
|
|
|
|
|
What images, you haven't shown any code with references to any images?
Show the code that references the images.
Kev Pearman MCAD
|
|
|
|
|
Adnan,
try putting your structs into separate files or after your class, this might help.
mav
|
|
|
|
|
Done, it works, thanks mav
thanks
|
|
|
|
|
I guess that as long as it works i doesn't matter but
why would putting your structs inside a class throw the above exception?
Kev Pearman MCAD
|
|
|
|
|
Well, I've seen some strange things happen when I've added private classes to some of my form-derived classes.
Basically, the visual designer stores some resources in .resx files (for example image data).
These XML-based files hold serialized data that can be retrieved by an object name (just add a picture box to a form and than look at what's generated in InitializeComponent() ).
If, by which means ever, such a resource cannot be found than the visual designer will choke and running the application will create an exception similar to what adnan wrote.
I think that he had introduced some naming conflicts, so removing the offending struct declarations from the .cs file fixed the way .NET accesses its embedded resource streams.
mav
|
|
|
|
|
hi,
I want to change the color of the scrollbars(horizontal and vertical) that appear with panel control (when I set autoscroll true) .if anyone knows how to set different styles to scrollbars of a (container) control in C#, pl let me know..
Thanks
|
|
|
|
|
Can any one help me out. I am trying to call an external .exe file whihc creates mpeg files in my project. Is there a efficient way to do so.
Thank you
pavan
|
|
|
|
|
externalProcess = System.Diagnostics.Process.Start(exeName, parameters);
externalProcess.WaitForExit(1000);
|
|
|
|
|
Hey, Can anyone tell me how to use the Session and Application variables to distinguish between 2 users. I tried SessionID. Couldn't make it happen. Please help
|
|
|
|
|
This question belongs in the ASP.NET forum.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Hey, Can anyone tell me how to use the Session and Application variables to distinguish between 2 users. I tried SessionID. Couldn't make it happen. Please
|
|
|
|
|
You must set the enable session property to true
ex: [WebMethod(EnableSession=true)]
Choose the appropriate sessionState in the web config file.
(The default is good enough for normal purpose)
Initialize ur session variable
ex: Session["test"] = ""; in the Session_Start of Global.asax
u can assign values to test variable in ur web service methods.
cool man
|
|
|
|
|
I have a problem trying to zoom in on a bitmap i opened in a form.I couldnt find any simple code example that illustrates how to implement zooming from inside a program.I would appreciate if anyone can help me out.Please contact me at gehanmustafa@hotmail.com.
Yours,
Gehan Mustafa
|
|
|
|
|
gijoebijoe wrote:
Please contact me at gehanmustafa@hotmail.com.
No.
All you need to do is use DrawImage to draw the image at a larger than normal size.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Hi,
I'm having problems with issuing a SQL ExecuteNonQuery in my webService. It always returns an int with value -1.
I'm executing a stored procedure which should return a rowcount of the number of matching rows, which is 0 or 1. There is a matching row, so i should get 1 returned.
The code i am using is as follows:
--------------------------------------------------------------------------
string CnStr = "data source=localhost; Integrated Security=SSPI;Initial Catalog=Active";
SqlConnection sqlCn = new SqlConnection();
//Pass connection string to the SQLconnection object
sqlCn.ConnectionString = CnStr;
// Create a sqlcommand object to execute sql stored procedure
//pass query string and connection object to Command object
SqlCommand cmd = sqlCn.CreateCommand();
//Specify the Stored procedure to be executed
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "stp_Check";
//Create a Paramater object to provide input and return
cmd.Parameters.Add("@Mac", SqlDbType.Char,17);
cmd.Parameters["@Mac"].Value = strMAC;
//Open the connection
sqlCn.Open();
//Execute the query - return rowcount
int intMACAddressRows;
intMACAddressRows = cmd.ExecuteNonQuery();
-----------------------------------------------------------------------
If i execute the Stored procedure directly it works fine (i.e. one row is returned).
Thanks for any help you can give.
Cheers,
Colin
|
|
|
|
|
Update, Insert, and Delete commands will return the number of rows affected. Anything else returns -1.
creganc wrote:
If i execute the Stored procedure directly it works fine (i.e. one row is returned).
I'm unsure whether you mean the row is returned or the count of rows affected is returned when the procedure is executed directly. If you mean the actual row is returned, it is a Select statement and the return value will always be -1.
Charlie
if(!curlies){ return; }
|
|
|
|
|
Hi Charlie,
Thanks for the prompt response.
Sorry, should have said that the stored procedure is just issuing a select statement.
Ah, i thought the executenonquery would return the rowcount from the select.
As i only want to know if the row exists so should i use executescaler instead? Does that return the count as an int?
Thanks again for your help.
cheers,
Colin
|
|
|
|
|
ExecuteScalar returns an object which is the first column of the first row of the records returned. So, if the select statement is something like:
SELECT Count(*) FROM MyTable WHERE MyColumn = @MyParam you'd get the number of rows like this:
int rowCount = (int)command.ExecuteScalar();
Charlie
if(!curlies){ return; }
|
|
|
|
|
Thanks Charlie thats great.
Thanks for your help.
Cheers,
Colin
|
|
|
|
|
Hi,
I want to develop/use expense management tool similar to Microsoft's PocketPC Expense. I would like to create categories on the fly and data to be stored in xml for easy porting? Does any one has source code or ideas to do this?
Can any one point me to a open source for this?
|
|
|
|
|
I have a program that checks for the existence of a file and then reads the content, but I am running into a problem when I try to read, the file is still being written to. I have to ideas on how to solve, but unsure of the methods/syntax. I realize the solution is probably simple, but I'm failing to see it.....
1st - I can't find a property for the file or fileinfo class for 'locked', does such a method exist elsewhere? I am having trouble finding it.
2nd - I can catch the error, but can I in effect do a try {} catch {} re-try?
|
|
|
|