|
i want to watter effect in c# using vs10.
watter effect control not found in vs10
|
|
|
|
|
I want same effect in visual basic.Can anyone guide me how to do it please
|
|
|
|
|
Just use Telerik C# to VB.NET Online Converter.
|
|
|
|
|
I am doing a project and want to give a water effect or make the form to flow as waves when the user moves the cursor over the form..!So if anyone knows please let me know..!
You can mail me at "tabrez.rules@gmail.com"
In advance
Thank you
|
|
|
|
|
cool
|
|
|
|
|
|
Great Control! But what license are you using? I need something cimilar to the CPOL license. Would it be possible to use this in a internally distributed (only distributed within my company) commercial application?
|
|
|
|
|
Error in Dragging the WaterEffectControl from the toolbox.
Any thoughts on how to fix this?
|
|
|
|
|
Sorry, but my knowledge of how C# works is minimal. I have struggled for days working to put this wave effect onto a picture on a tab control. In fact, I can't even get it to work on a new WinForm. When I drag the Toolbox item "WaterEffectControl" onto a form, I get "Object reference not set to an instance of an object".
For example, in the exact same project that is provided, I have started a new Form1 project, added an identical class to the project "WaterEffectPictureBox.cs", and then dragged the Toolbox control onto either a picturebox or a panel or a plain form1. The error message always appears.
My usual experience with Toolbox controls is that all I have to do is drag-and-drop and then set properties and events.
I realize the instructions say: "The control itself is derived from System.Windows.Forms.Panel. So all you have to do is to place a standard PictureBox control onto your form and change the type of this control to WaterEffectControl." <=== I don't understand how to do that.
Can someone please help provide a "drag-and-drop" Toolbox item?
|
|
|
|
|
|
hi
i want to draw an drawing like a rug
im using the following code
it working but only on Window form
i m using same code on panel but there is no results
any idea................!
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace what_it_is
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
rnd = new System.Random();
myPen = new Pen(Color.Blue);
}
private Bitmap DrawingArea;
private System.Random rnd;
private Pen myPen;
private void Form1_Load(object sender, EventArgs e)
{
DrawingArea = new Bitmap(
this.Size.Width,
this.Size.Height,
System.Drawing.Imaging.PixelFormat.Format24bppRgb);
InitializeDrawingArea();
}
private void btnLine_Click(object sender, EventArgs e)
{
Graphics oGraphics;
oGraphics = Graphics.FromImage(DrawingArea);
myPen.Color = Color.Blue;
for (int x = 1; x < 50; x++)
{
oGraphics.DrawLine(
myPen,
(int)rnd.Next(0, this.Width),
(int)rnd.Next(0, this.Height),
(int)rnd.Next(0, this.Width),
(int)rnd.Next(0, this.Height));
}
oGraphics.Dispose();
this.Invalidate();
}
private void btnCircle_Click(object sender, EventArgs e)
{
Graphics oGraphics;
oGraphics = Graphics.FromImage(DrawingArea);
// get a radius for circle - up to 1/2 the width of form
int radius = rnd.Next(0, (this.Width / 2));
for (int x = 1; x < 50; x++)
{
myPen.Color = Color.FromArgb(
(rnd.Next(0, 255)),
(rnd.Next(0, 255)),
(rnd.Next(0, 255)));
oGraphics.DrawEllipse(
myPen,
rnd.Next(0, this.Width),
rnd.Next(0, this.Height),
radius, radius);
}
oGraphics.Dispose();
this.Invalidate();
}
private void InitializeDrawingArea()
{
Graphics oGraphics;
oGraphics = Graphics.FromImage(DrawingArea);
myPen.Color = Color.AliceBlue;
for (int x = 0; x < this.Width; x++)
{
oGraphics.DrawLine(myPen, x, 0, x, this.Height);
}
oGraphics.Dispose();
this.Invalidate();
}
private void btnOK_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void Form1_Closed(object sender, System.EventArgs e)
{
DrawingArea.Dispose();
}
private void Form1_Paint(object sender, PaintEventArgs e)
{
Graphics oGraphics;
oGraphics = e.Graphics;
oGraphics.DrawImage(DrawingArea,
0, 0,
DrawingArea.Width,
DrawingArea.Height);
oGraphics.Dispose();
}
private void button1_Click(object sender, EventArgs e)
{
UserControl1 ctrl = new UserControl1();
this.Controls.Add(ctrl);
}
private void panel1_Paint_1(object sender, PaintEventArgs e)
{
}
}
}
|
|
|
|
|
I was able to change the picture of control but when I added the new bmp file (which I saved as being very small) the control seems to take a long time. How was the included picture saved?
stjds
|
|
|
|
|
Hi,
Thanks for your goold control.
When i compare the results of your Water Effect with another on in http://www.durius.com/104.asp
i can see the better simulation in second program. one of differences is when i clicked on sample picture
it start with big wave instead small wave.
Thansk again.
|
|
|
|
|
I am curious why you didn't use a PictureBox instead of a panel?
jr
|
|
|
|
|
To behonest: I can't remember as it's too long ago when I coded this.
Maybe you'll find something obvious if you try to change it.
Cheers
Chris
|
|
|
|
|
This fixes the bug where the water would never become completely still in the top-left area of the bitmap.
In the function ProcessWaves(), just after the main loop and before the line that says "_weHaveWaves = wavesFound", insert the following code:
for (int x=0; x<_waveWidth ; x++)
_waves[x,0,newBuffer] = 0 ;
for (int y=0; y<_waveHeight ; y++)
_waves[0,y,newBuffer] = 0 ;
That will hopefully fix the problem.
|
|
|
|
|
|
When you put drop near end of the picture, after the drop fall off, there is a trembling left. I noticed that if the spot is more satiated with colors the bigger is the trembling. Can you correct that
RawSteel
|
|
|
|
|
Good job,
But I found a bug.
The wave effect continues on the left and upper sides of the picture infinitely. It does not stop until you close the application?
Sefai Tandogan
|
|
|
|
|
|
This rocks! I'm currently programming in VB .Net because my roots are VB and I'm working hard to get to grips with everything the .Net platform offers. Having recently done very badly in my Maths exams, I was still very interested in the algorithms. I'm gonna see if I can implement in VB .Net, just to see if I can. It's things like this that really showcase the power of the .Net platform, and I'll be interested to see if VB can hack it. Otherwise, I'll be buying C# .Net 2003 that much sooner!
We can't all do everything (Virgil)
modified 15-Jun-21 21:01pm.
|
|
|
|
|
I tried to implement the control in my application with an image of my own but I always get errors. How exactly do you change the bitmap on your example? I'm new with C#...
Thanks.
Johnny67
|
|
|
|
|
Hi,
well, as described the simplest way doing it, is to drag a PictureBox control onto your form and change the picture. Then you have to rename the class type.
HTH
Chris
|
|
|
|
|
Thanks Christian, but still can't make it to work. This is what I did. I took the sample form you provide and opened it in design view. The form looks empty, no picture in there, I assume is because you changed the class type to a waterControl right? Next I added a PictureBox and specified my own picture. Then I went to the code of the form and changed the type from PictureBox to waterControl. I actually copied and pasted the code from WaterEffectForm.cs. I build the program and seems to build OK but when running I get this error:
"An unhandled exception of type 'System.NullReferenceException' occurred in WaterEffectDemo.exe
Additional information: Object reference not set to an instance of an object."
This is where it stops inside WaterEffectPictureBox.cs:
public Bitmap ImageBitmap
{
get { return _bmp; }
set
{
_bmp = value;
_bmpHeight = _bmp.Height; <--Stops here
_bmpWidth = _bmp.Width;
What am I doing wrong? Thank you for your time and patience. As you can see I'm not a C# expert.
Johnny67
|
|
|
|
|
Have you also this line for your new control within the InitializeComponent() method?
<br />
this.waterControl.ImageBitmap = ((System.Drawing.Bitmap)(resources.GetObject("waterControl.ImageBitmap")));<br />
-Chris
|
|
|
|