|
Yep, i need to get the index of which ever one was clicked
|
|
|
|
|
My suggestion any good? That was what I was assuming.
He who makes a beast out of himself gets rid of the pain of being a man
|
|
|
|
|
I couldnt figure that way out :s lol, still learning
|
|
|
|
|
First generate the click method: Go into the ListView's events in the form design or if you've coded the ListView:
listView1.ColumnClick += new ColumnEventHandler(listView1_ColumnClicked);
Half way through writing that, Intellisense will say press tab to auto generate method.
Then inside the method, the code I previously wrote should do the job.
He who makes a beast out of himself gets rid of the pain of being a man
|
|
|
|
|
Ah ok, I think I have figured it out now, thanks
|
|
|
|
|
|
Hi Guy
when u click in the column u can get from the EventArgs.
try like this EventArgs e;
e.Column.Index;
i hope help this
Cheers
RRave
MCTS,MCPD
|
|
|
|
|
I have some problems with reading and writing to an Intranet directory. I always get an permission exception.
The executable file is shared on an NTFS network volume. There is no problem to read and write files directly in executable home directory.
When I try to read/write outside the folder I get an exception.
The next step was to create an PermissionSet but I got an Security Exception.
How I can read/write files
thanks in advance
|
|
|
|
|
|
i'm a beginner in c#. now i'm doing a water model by using bump mapping. i used refer to http://www.riemers.net[^]to do this. the problem is, the code for the bump mapping is in HLSL code. How can i do the code in c#?
[img]http://img488.imageshack.us/img488/6241/signaturesakirahku9.jpg[/img]
|
|
|
|
|
|
You can't, unless you want to write a horribly slow software renderer, which involves a lot more work than learning HLSL/GLSL/Cg (any of those shader languages)+
For more information about graphics programming I suggest you better take a look at those sites:
http://www.gamedev.net[^]
http://forums.xna.com[^]
modified 12-Sep-18 21:01pm.
|
|
|
|
|
thanks for the reply.
[img]http://img488.imageshack.us/img488/6241/signaturesakirahku9.jpg[/img]
|
|
|
|
|
I wrote already some days ago to ask a question: here follows the topic.
"In my application I create some bottons in a form; some of them receive an image to be set as their backgroundImage. When this is done and the mouse hovers on the control I start a timer: I want the program to do something when the -let's say- 5th timer tick occurs, but in the meanwhile I want the image to increase its pixels' alpha value a bit each tick.
How to control the alpha value of an image I load from a file and display it as a backgroundImage on a button?"
KaptinKrunch kindly suggested me a link to have a look to:
http://www.c-sharpcorner.com/UploadFile/mahesh/DrawTransparentImageUsingAB10102005010514AM/DrawTransparentImageUsingAB.aspx
Well, I checked that code, and at some more documentation..and tried that on a small test project, to load a bitmap on a pictureBox, and modify its alpha channel as much as a trackBar in the same form is scrolled, from 0 to 1.
The problem is that: once I have create the Graphics object, loaded with my image, and modified it, I can't reconvert it as a Bitmap object, in such a way to be able to set it as the Image property of the PictureBox of the Form.
Notice this is just a small piece of code to try the thing: actually, in my application, I have to load the bipmap as the BackgroundImage property of a Button, but I don't think this changes a lot..
Thanx for any extra help, sorry for my English..
Here down is listed the code I can't fix:
public partial class Form1 : Form
{
private string sourceFileName;
private string destFileName, proposedDestFile;
private Bitmap image, newImage;
private int modifiedImagesCounter;
ColorMatrix colorMatrix;
ImageAttributes imageAtt;
Graphics g;
public Form1()
{
InitializeComponent();
float[][] matrixItems = {
new float[] {1, 0, 0, 0, 0},
new float[] {0, 1, 0, 0, 0},
new float[] {0, 0, 1, 0, 0},
new float[] {0, 0, 0, 1, 0},
new float[] {0, 0, 0, 0, 1}};
colorMatrix = new ColorMatrix(matrixItems);
imageAtt = new ImageAttributes();
imageAtt.SetColorMatrix(colorMatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap);
}
private void loadImageButton_Click(object sender, EventArgs e)
{
openFileDialog.ShowDialog(Parent);
sourceFileName = openFileDialog.FileName;
image = new Bitmap(sourceFileName);
Console.WriteLine("The file to modify is: " + sourceFileName);
//IndexedToARGB_Converter conv = new IndexedToARGB_Converter(sourceFile);
//Bitmap modifiedImage = conv.getNewImage();
pictureBox.Image = image;
}
private void saveImageButton_Click(object sender, EventArgs e)
{
proposedDestFile = DestFileName();
saveFileDialog.FileName = proposedDestFile;
saveFileDialog.ShowDialog(Parent);
destFileName = saveFileDialog.FileName;
Console.WriteLine("The modified file will be saved to: " + destFileName);
newImage.Save(destFileName);
}
private string DestFileName()
{
modifiedImagesCounter++;
StringBuilder strbld = new StringBuilder();
strbld.Append(sourceFileName, 0, sourceFileName.Length - 4);
strbld.Append(modifiedImagesCounter.ToString());
strbld.Append(".GIF");
return strbld.ToString();
}
private void trackBar_Scroll(object sender, EventArgs e)
{
g = pictureBox.CreateGraphics();
//Graphics g = Graphics.FromImage(image);
TrackBar trackBar = (TrackBar)sender;
float f = (float)(trackBar.Maximum - trackBar.Value) / (float)(trackBar.Maximum - trackBar.Minimum);
colorMatrix[3, 3] = f;
int iWidth = image.Width;
int iHeight = image.Height;
Rectangle rect = new Rectangle(pictureBox.Location.X, pictureBox.Location.Y, iWidth, iHeight);
g.DrawImage(
image,
rect, // destination rectangle
0.0f, // source rectangle x
0.0f, // source rectangle y
iWidth, // source rectangle width
iHeight, // source rectangle height
GraphicsUnit.Pixel,
imageAtt);
this.Update();
}
}
|
|
|
|
|
Here is a little method that I think will do what you desire. It requires unsafe code, but will probably be extremely fast:
private static Bitmap ChangeImageAlpha(Bitmap bmp, float newAlpha) {
Bitmap rval = new Bitmap(bmp);
BitmapData bmpData = rval.LockBits(new Rectangle(0, 0, rval.Width, rval
.Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
try {
unsafe {
byte* bmpPtr = (byte*)bmpData.Scan0.ToPointer();
byte* last = bmpPtr + (bmp.Height * bmp.Width << 2);
do {
float a = (*bmpPtr) * newAlpha;
*bmpPtr = (byte)Math.Max(Math.Min(a, byte.MaxValue), byte.MinValue);
bmpPtr += 4;
} while (bmpPtr < last);
}
return rval;
} catch {
return null;
} finally {
bmp.UnlockBits(bmpData);
}
} I have not tested this code, so I don't know if it actually works or not. Things to check:
1: The constructor used to create rval actually copies the image data
2: The alpha channel is the first byte in each double-word (if not, change all *bmpPtr to bmpPtr[3])
Hope this helps,
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
I don't know about all of you, but I assume you've experienced the same frustrations as me when it comes to a Solution with multiple projects added to it.
We have 'Project References' as opposed to 'File References' where possible for the following reasons:
1 - We need to be able to enter the referenced assemblies during debugging.
2 - When our .sln builds, we need to make sure we've got the latest and greatest changes from our referenced assemblies.
Before I (or someone on my team) embarks down the road of finding a solution to our problem, I thought I'd ask if anyone else has a solution or ideas on how we might change our Project Refs to File Refs, and not lose the benefit of the two points described above.
It shouldn't be too difficult to build an add-in (or external tool) that would build a .csproj file in debug mode, and copy the .dll and .pdb file into the appropriate location for my solution. This would allow us to step through the code, satisfying point 1 above.
I guess my main struggle is how would I setup a pre-build script (or something) to figure out which file references are actually from projects I've got on my box, and then figure out if it needs to rebuild them, and them build them and copy the dll and pdb file over.
Any thoughts or comments would be great!
Paul Brower
|
|
|
|
|
Paul Brower wrote: how we might change our Project Refs to File Refs, and not lose the benefit of the two points described above.
It's not currently possible.
Paul Brower wrote: I guess my main struggle is how would I setup a pre-build script (or something) to figure out which file references are actually from projects I've got on my box, and then figure out if it needs to rebuild them, and them build them and copy the dll and pdb file over.
That's not generally how file references are used. If you think of the file reference as a complete third-party library, you only pick up a newer version when the consuming code is 100% ready to and it is a deliberate step.
It sounds like you have some references that are "common library" type of things. Even in this case, I would treat them the same way and look at them as if they were third-party libraries.
To do what you want you would need to build an external tool (or add-in).
Scott.
—In just two days, tomorrow will be yesterday.
—Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
[ Forum Guidelines] [ Articles] [ Blog]
|
|
|
|
|
Hi,
How can I launch an my application (.exe) after msi installation is complete?
I'm using VS installer, also custom actions. I tried to give Process.Start and run my exe from TARGETDIR in the Commit event of Installer class, but its throwing file cannot be found exception. The file is created before the Commit event, still it throws the error during installation.
I've Googled for the entire day today, and couldn't find a solution for this using Visual Studio 2003. I read that its possible using third party installers, but I cannot use other installer software.
Please somebody help!!
|
|
|
|
|
I would try the following in order until one of them worked:
1. Try hard-coding the path to the default exe location
2. Try doing #1, but do it after the commit stage
3. If neither 1 nor 2 worked, then simply write a console app that instantiates your exe.
If you cannot do this, then post a question here on how to do so If you are successful at step 1, then your problem is your target path. If you are not successful at step 1, but are in step 2, then the installer locks all installation files during the install, and you will need to execute your exe after the commit. If you fail at both 1 & 2, then you are probably attempting to instantiate your application incorrectly. Let us know the results of these tests,
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
Hi Jeff,
Thanks for the help.
I tried something else on my own in the mean time. I added the primary output of my project (.exe) to the Install under Custom Actions. Then in the Commit event override, I called my exe using Process.Start(), target path was taken from savedState IDictionary object.
So now the aplication is launched when the installer reaches its final stage.
Isn't that a work around?
Blumen
|
|
|
|
|
Well-played! I would not have thought of that.
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
Skippums wrote: 1. Try hard-coding the path to the default exe location
<BitchSlap>Hard-coding a path for any reason is a cardnial sin. You should never, Never, NEVER, EVER do this!</BitchSlap> Unless you want to really piss off the person who comes in behind you to maintain your code. Then, you can expect a visit from a very large, intimidating man, wearing an expensive suit with a black leather coat and wielding a silenced pistol. Need I explain what happens next?
|
|
|
|
|
Maybe I wasn't clear on what exactly I was recommending. I was attempting to break down the problem into multiple steps. The progression is as follows...
Step 1: get your executable to run AFTER it is completely installed by hand-
starting a separate application which loads your app via hard-coded paths
Step 2: modify your code from step 1 so that it runs automatically AFTER the commit phase of the installer
Step 3: modify your code from step 2 so that it runs automatically PRIOR to the commit phase of the installer
Step 4: change the path to your executable so that it is NOT hard coded It has been my experience that most questions arise when people try to code the final step as the first step. I was simply trying to illustrate the steps that were skipped so that the person asking the question could step backward through the progression until he had working code that he could then move forward with. Clearly (at least to me) I didn't mean to hard-code the value and leave it. I was offering debugging advice, not coding advice. Hope this clears things up for you.
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
Yes
we can do this with commit event in the Installed class.
with in after commint event write a process object and pass ur exe name with path.
application will be start automatically
i hope this is help 2 u.
Cheers
RRave
MCTS,MCPD
|
|
|
|
|
calling the exe using Process.Start() alone will not run the exe. you have to add the primary output of that exe project to install Custom Action in the deployment project.
|
|
|
|
|