|
Hi there,
I met the same problem as yours, would you please give me some suggestions?
thanks.
|
|
|
|
|
How can i create a Xor Pen.
|
|
|
|
|
dichen wrote:
How can i create a Xor Pen.
I don't beleive this is directly available in GDI+.
-Nick Parker
|
|
|
|
|
You could consider using System.Windows.Forms.ControlPaint.DrawReversibleLine(), or look into importing SetROP2() and using that. There's an article on CodeProject for the latter.
|
|
|
|
|
GDI+ does not support raster ops. What are you needing an XOR pen for, BTW?
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
I have a override of the Panel control where I draw a dotted-line grid in it. But the painting is really slow whenever the control needs to redraw.
This is the paint code:
protected override void OnPaint(PaintEventArgs pe)
{
base.OnPaint(pe);
if (ShowGrid && !this.DesignMode)
{
this.SuspendLayout();
Graphics g = pe.Graphics;
Pen pen = new Pen(Color.Black, 1);
pen.DashStyle = DashStyle.Dot;
Point p1 = new Point(0,0);
Point p2 = new Point(0,0);
for (int x = BorderSize.Width; x < this.Size.Width - BorderSize.Width; x += GridSize.Width)
{
p1.X = x; p1.Y = BorderSize.Height;
p2.X = x; p2.Y = this.Size.Height - BorderSize.Height;
g.DrawLine(pen, p1, p2);
}
for (int y = BorderSize.Height; y < this.Size.Height - BorderSize.Height; y += GridSize.Height)
{
p1.X = BorderSize.Width; p1.Y = y;
p2.X = this.Size.Width - BorderSize.Width; p2.Y = y;
g.DrawLine(pen, p1, p2);
}
this.ResumeLayout();
}
}
|
|
|
|
|
Have you tried using ControlPaint.DrawGrid ?
James
"I despise the city and much prefer being where a traffic jam means a line-up at McDonald's"
Me when telling a friend why I wouldn't want to live with him
|
|
|
|
|
ah thats much better. thanks.
|
|
|
|
|
Hi,
I would like to make a custom form class in c# (think Winamp). I am not sure where to begin; how low in the class hierarchy should i inherit to override the windows container?
I haven't found any attempts at this yet, but any direction to such would also be great!
|
|
|
|
|
I think Terrarium[^] will be a good start.
Cheers,
Kannan
|
|
|
|
|
Not sure what I did but the form controls in the Toolbox have dissapeared. The only remaining control is the pointer.
I am using Visual c#.net.... 2003 edition.
Does anyone know how to correct this ???
Thanks,
Ken
|
|
|
|
|
ken-l1 wrote:
Does anyone know how to correct this ???
Make sure you have a design surface active
<a TITLE="See my user info" href=http:
|
|
|
|
|
the toolbox has several sections in it including:
Data
Dialog Editor
Components
Windows Forms
General
if you are in the General section all you will see is 'Pointer'.. also make sure you have a dialog selected to edit like another user pointed out.
still a newb.. cut me some slack :P
-dz
|
|
|
|
|
I have a chunk of data that is pulled from a database. I want to insert a new column into the dataset, and have every cell in that new column have new values based on an existing columns values. IE:
-Price----Amt.------NewColumn
---------------------------
100 | 2 |
220 | 4 |
335 | 5 |
400 | 6 |
554 | 8 |
655 | 9 |
| | Say I want 'NewCol' to equal Price * 2.2, so the new data set would look like this:
-Price----Amt.------NewColumn
---------------------------
100 | 2 | 220
220 | 4 | 484
335 | 5 | 737
400 | 6 | 880
554 | 8 | 1218.8
655 | 9 | 1441
| |
I hope this isn't too confusing. It's really just like I would do using Excel. having a column's values based in part on another column.
How would I approach this?
Steve
McLenithan
Is Bert Evil? | Homer: "Hello, operator, gimme the number for 911!"
|
|
|
|
|
add an expression column. The way to do that is
Dataset.Tables["tablename"].Columns.Add("columnname",Type.GetType("the type like System.String"), "the expression like equal Price * 2.2")
so
Dataset.Tables["tablename"].Columns.Add("NewCol",Type.GetType("System.Double"), "equal Price * 2.2")
that's it
From Greece:
Dimitris Iliopoulos
dimilio@yahoo.com
|
|
|
|
|
Thanks for the reply. I am trying to do what you have shown but I am getting an error; Where you put System.String for the
'int' denotes a 'class' where a 'variable' was expected
I dont get that because intellisense is showing it should be something like you had shown.
Also how do I figure out the expression. Do I simply use the names of the database columns in a mathematical formula string?
Thanks for the help
Steve
McLenithan
Is Bert Evil? | Homer: "Hello, operator, gimme the number for 911!"
|
|
|
|
|
|
Completely new to C#.
can anyone give me a big picture on how Timer works in C#?
For example, what is the framework for me to do a certain job, say methodX(), every 5 seconds?
thanks in advance!
|
|
|
|
|
Timers are really simple to use in C#.
All you have to do is declare a timer:
private System.Windows.Forms.Timer timer1; or drag it onto your form.
Setup the interval and add a message handler:
this.timer1.Enabled = true;
this.timer1.Interval = 1000;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
private void timer1_Tick(object sender, System.EventArgs e)
{
// add your code here. right now tis fucntion will get called once every second.
}
Hope this helps.
|
|
|
|
|
Good morming gurus,
Do you know a good source on how to alternate color on every other items of list box or combo box?
Thanks so much
Khang Nguyen
|
|
|
|
|
This is what I did in a listview control. The code below changes every other row to a different back color.
private void ColorRow()
{
if( m_bListViewBackColor )
{
m_bListViewBackColor = false;
}
else
{
m_bListViewBackColor = true;
}
ListViewItem Lvi;
// Add a listitem
Lvi = m_ListView.Items.Add( 1 );
Lvi.SubItems.Add( "John" );
Lvi.SubItems.Add( "Smith" );
if( m_bListViewBackColor )
{
Lvi.BackColor = Color.Crimson;
}
else
{
m_bListViewBackColor = false;
Lvi.BackColor = Color.White;
}
}
Declare m_bListViewBackColor at the top of your app.
This isn't exactly what you're looking for, but I think it should get you headed in the right direction.
|
|
|
|
|
Thank you very much for the tip, Manster!
Khang Nguyen
|
|
|
|
|
Hi !
I'd like to implement basic image processing like gamma, brightness and contrast.
I found on codeproject an excellent article by Christian Graus on image processing with GDI+.
Problem is that method is very slow. I compare it with Microsoft Photo Editor (included with MS Word) and it's much faster.
Maybe my method isn't the best one:
On Filter Attribut Changed:
Bitmap b = m_OriginalImage.Clone();
Filters.Brightness(b, BrightnessAttribut);
Filters.Contrast(b, ContrastAttribut);
Filters.Gamma(b, GammaAttribut);
pictureBox.Image = b;
End
Help's appreciate.
Thanks
--
aer@s
|
|
|
|
|
Does anybody know how show "welcome" dialog while the the rest of the application is being loaded (C#)?
Thanks a lot,
Andrey
|
|
|
|
|
here is what im using in my apps:
AboutBox myAboutBox = new AboutBox();
myAboutBox.Show();
myAboutBox.Refresh();
Thread.Sleep(1500);
InitializeComponent();
myAboutBox.Hide();
myAboutBox.Dispose();
i find that you need to call the Refresh() before doing anything cpu intensive or it might not show cause its too busy processing other stuff..
still a newb.. cut me some slack :P
-dz
|
|
|
|