|
You need to override the OnMouseDown event and check the parameter
if(e.Button == MouseButtons.Right)
object obj = this.shapesListView.GetChildAtPoint(e.Location);
...
Check out the following article for details.
|
|
|
|
|
Good day Guys,
Please help! I'm in a dire situation right now. I have a program which works much like a cash register. I have a set of command buttons in one form in which I want to change the properties (e.g., text/caption, font size, backcolor, etc...) based on what is stored from the database. The thing is, I don't know how can that be specified! Please help!
|
|
|
|
|
Ok I am in a dilema here. I am working on a BI module. I am reading the data from a tabl using a Sql's "With Cube" function, my result set looks like following:
+---------+-------------+----------------+
|#ofReqs--|---SDate----|Department------|
+---------+-------------+----------------+
|--------3|3/10/2006----|--Hardware-----|
+---------+-------------+----------------+
|--------2|3/12/2006----|--Hardware-----|
+---------+-------------+----------------+
|--------5|3/15/2006----|--Hardware-----|
+---------+-------------+----------------+
|--------4|3/17/2006----|--Hardware-----|
+---------+-------------+----------------+
|--------9|3/10/2006----|--SoftWare-----|
+---------+-------------+----------------+
|--------8|3/12/2006----|--SoftWare-----|
+---------+-------------+----------------+
|--------5|3/14/2006----|--SoftWare-----|
+---------+-------------+----------------+
|--------9|3/15/2006----|--SoftWare-----|
------------------------------------------
What I need is a collection of Reqs; a collection of Date; a Collection of Department but I need them to be related with each other cuz I need to use them on a graph.
What I am trying to display on the graph is as follows:
Day wise No of Reqs made to a Department.
something like NameValueCollection<string, string=""> so if a string key [Department] is repeted the result would get added to it another element does not get created; but with three values NameValueCollection<string, string,="" double="">
Whatever.Add("Software", "3/14/2006", 5);
//result Software [Key] - 3/14/2006, 5 [Value]
Whatever.Add("Hardware", "3/14/2006" 3);
//reult Hardware[Key] - 3/14/2006, 5 [Value]
Whatever.Add("Software" - 3/10/2006, 4);
//result Software [Key] - [3/14/2006, 5] [3/10/2006,4] [Value]
Something like... I dont know, I hope I am not over complecating the problem. Does any one have a clue what I am talking about
|
|
|
|
|
|
I thought about that
Lets say I create a dataset. How am I going to get the result set that I want? Can I query against the DataSet?
Would you be able to give me an example please? Thanks for the help.
|
|
|
|
|
Hi!
I have a little code to resize and watermark images. The problem is that it generates images with really poor quality. I have a comparison below with my results with code and PhotoShop, what I want is to make the code generate a copy with the same quality as PhotoShop, if it's possible. You just have to tell me what to add and where! Please!
These images are automatically resized from a much bigger image found at:
http://www.foh.nu/heli.jpg[^]
Generated with code: http://www.foh.nu/heli1.jpg[^]
Generated with PhotoShop: http://www.foh.nu/heli2.jpg[^]
Don't change too much in the code, I still have to remain the canvas and image as is, becouse I have to draw more images into the canvas later on, for protection (copyright image, transparent, etc.)
This is the code at the moment:
<br />
void makeThumbnail()<br />
{<br />
System.Drawing.Image image = System.Drawing.Image.FromFile("C:\\Inetpub\\wwwroot\\heli.jpg");<br />
Bitmap canvas = new Bitmap(200, 283, image.PixelFormat);<br />
<br />
Graphics g = Graphics.FromImage(canvas);<br />
<br />
g.DrawImage(image, 0, 0, 200, 283);<br />
<br />
canvas.Save("C:\\Inetpub\\wwwroot\\1.jpg", ImageFormat.Jpeg);<br />
<br />
image.Dispose();<br />
canvas.Dispose();<br />
}<br />
Hope you can help! Cheers!
-- modified at 20:10 Friday 17th March, 2006
|
|
|
|
|
try adding
g.InterpolationMode = InterpolationMaode.HighQualityBicubic;
|
|
|
|
|
Hi
You can use a quality parameter when saving as a jpeg:
...
int quality = 90;
EncoderParameters parameters = new EncoderParameters( 1 );
parameters.Param[ 0 ] = new EncoderParameter( Encoder.Quality, quality );
ImageCodecInfo codec = GetImageCodecInfo( ImageFormat.Jpeg );
canvas.Save("C:\\Inetpub\\wwwroot\\1.jpg", codec, parameters );
...
public static ImageCodecInfo GetImageCodecInfo( ImageFormat format )
{
ImageCodecInfo[] codecs = ImageCodecInfo.GetImageEncoders();
foreach ( ImageCodecInfo codec in codecs )
if ( codec.FormatID == format.Guid )
return codec;
return null;
}
----------------------------
Be excellent to each other
EasiReports[^] My free reporting component for WinForms.
|
|
|
|
|
<br />
<br />
public static ImageCodecInfo GetImageCodecInfo(ImageFormat format)<br />
{<br />
ImageCodecInfo[] codecs = ImageCodecInfo.GetImageEncoders();<br />
foreach(ImageCodecInfo codec in codecs)<br />
{<br />
if(codec.FormatID == format.Guid)<br />
{<br />
return codec;<br />
return null;<br />
}<br />
}<br />
}<br />
<br />
void makeThumbnail()<br />
{<br />
System.Drawing.Image image = System.Drawing.Image.FromFile("C:\\Inetpub\\wwwroot\\heli.jpg");<br />
Bitmap canvas = new Bitmap(200, 283, image.PixelFormat);<br />
<br />
Graphics g = Graphics.FromImage(canvas);<br />
<br />
g.DrawImage(image, 0, 0, 200, 283);<br />
<br />
int quality = 90;<br />
EncoderParameters parameters = new EncoderParameters(1);<br />
parameters.Param[0] = new EncoderParameter(System.Drawing.Imaging.Encoder.Quality, quality);<br />
<br />
ImageCodecInfo codec = GetImageCodecInfo(ImageFormat.Jpeg);<br />
canvas.Save("C:\\Inetpub\\wwwroot\\1.jpg", codec, parameters);<br />
<br />
image.Dispose();<br />
canvas.Dispose();<br />
}<br />
<br />
Gives the following error:
Compiler Error Message: CS0161: 'ASP.image_aspx.GetImageCodecInfo(System.Drawing.Imaging.ImageFormat)': not all code paths return a value
On line:
<br />
public static ImageCodecInfo GetImageCodecInfo(ImageFormat format)<br />
-- modified at 10:29 Saturday 18th March, 2006
|
|
|
|
|
Watch your brackets
----------------------------
Be excellent to each other
EasiReports[^] My free reporting component for WinForms.
|
|
|
|
|
|
You can try setting the quality to 100%.
If that still is not good enough, then you could try saving in a loseless format such as png ( then you don't need the quality parameter ).
----------------------------
Be excellent to each other
EasiReports[^] My free reporting component for WinForms.
|
|
|
|
|
Not a bad idea actually ..
Cheers
|
|
|
|
|
Actually that doesn't solve a thing. It still makes it crappy quality. It's not the loss that's the problem, it's the antialiasing .. it doesn't do it when I resize the image.
Still get the same result. :-/
|
|
|
|
|
Have you tried using Image.GetThumbnailImage ?
I'm running out of ideas here
----------------------------
Be excellent to each other
EasiReports[^] My free reporting component for WinForms.
|
|
|
|
|
I don't know how to use it but I'll figure it out!
Thank you for the input. I'll get back on the thread when I've got the time to investigate it more =)
|
|
|
|
|
Have a look at this[^] article.
|
|
|
|
|
I have a .NET C# application that connects to databases and creates tables and such and works on MSSqlServer and an Oracle Server I've tested it on and now I would like to get it sorking on DB2 as well. I've noticed there aren't the same components for DB2 as there are for Oracle and Sql so I did some research and it seems the only good looking components come from IBM and/or cost $. I've tried using the code already in place with an OleDbConnection and Command and it works for creating the tables but I haven't gotten it to insert without throwing an error. I think the error is has to do with the parameter field of the command. I have tried it with @ before the column names as with SQL and : as with Oracle, but neither solution works. If anyone has any experience with similar problems I would appreciate any help.
|
|
|
|
|
IIRC OleDbCommand does not support named parameters. Use a ? character as a parameter placeholder, and add OleDbParameter s to the Parameters collection in the order that they appear in the query text.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
I've tried this solution, and I think it makes sense for select statements, but for inserts the syntax doesn't look right and it doesn't work.
Ex:
Insert into table(col1, col2, col3), (?, ?, ?)
parameters:
@col1, value, type
@col2, value, type
@col3, value, type
I have tried this with @before the column names, :before them and nothing but the column names.
These statments have worked for me (with the column names instead of ?'s) in SQL and Oracle, so I have a hard time believing it can't be done in Db2.
|
|
|
|
|
It seems that if I use dataview in my app, and a change is made to the dataset, and I call Update(ds). It does not update the datasource.
Here is my code in the form_load section:
<br />
sqlDataAdapter1.Fill(dataSet11);<br />
<br />
SqlCommandBuilder cb = new SqlCommandBuilder(sqlDataAdapter1);<br />
<br />
dt = dataSet11.Tables[0];<br />
dataView1.Table = dt;<br />
<br />
cm = (CurrencyManager)this.BindingContext[dataView1];<br />
<br />
cm.CurrentChanged += new System.EventHandler(OnCurrentChanged);<br />
lblRecord.Text = "Record " + (cm.Position + 1) + " of " + cm.Count;<br />
and the code in my save record section:
<br />
if (dataSet11.HasChanges())<br />
{<br />
cm.EndCurrentEdit();<br />
<br />
sqlDataAdapter1.Update(dataSet11);<br />
}<br />
<br />
I'm not sure why it does not update. If I remove the dataview then it updates the datasource. Suggestions?
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
What do you mean "it does not update the datasource"? Have you inspected the DataSet with the debugger to see if the data has truly been changed and therefore needs to sync against the source? A common problem I see is that someone mishandles validation, transfer, etc where they think the input changed the data but in actuality it ignored or threw it out. If dataSet11 never changed, as far as the system is concerned there is nothing to update.
|
|
|
|
|
See the code that says..."if (dataSet11.HasChanges())" I would think that it would not drop into this "IF" statement if nothing had changed.
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Okay Time to eat crow.....I stepped thru the code and the dataset is not refelcting the changed made. If I just assume that there are changes it updates the datasource just fine. So now the question is why doesn't the dataset see the changes?
Tom
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
i am trying to load user control and aspx pages from different namespace (project), in my namespace Template i have my user control and aspx files, and i am trying to load those files from namespace Test1.
Thanks
|
|
|
|