|
The only way I know of with 1.1 is to subclass ListView and override the WndProc method and listen for the relevant messages (like you would with a non .Net app). This article[^] is a pretty good example.
"I think I speak on behalf of everyone here when I say huh?" - Buffy
|
|
|
|
|
Hello All,
I am tring to redrew the button to be a Circleur button. but affte i did it there is a rectangle apper when i click the button.
How can i remove this rectangle or disable it?
Regards
Hay
|
|
|
|
|
Hello Hay,
I think you just have to change the Property "FlatStyle" from "Flat" to "Popup", "Standard" or "System".
Good luck
Martin
|
|
|
|
|
Thanks Martin
I did it but there is still doted rectangle apper when i click to the button.
Regards
Hay
|
|
|
|
|
this is a focus rectangle which appear when buttn have Focused if you make your button circular by set its region
the focus rectangle will still appear
Do You Inherit youe control from button ?if yes you need to handle focus staff in your painting functions like draw circle instead rectangle when your control have the focus orany thing else
MCAD
|
|
|
|
|
Hello everybody!
In my VS2003 Windows application, I created an instance of a Form during runtime.
I then whant to use it with the ShowDialog method.
everything worked fine, until I whanted to set the Witdh of the Form smaller then 112 pixel.
Can I block this limitation?
Thank you for your time.
Martin
|
|
|
|
|
There are minimum and maximum size properties, perhaps they are set ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
How can I change the Frame color of a textbox?
|
|
|
|
|
I was wondering the same thing myself, and ended up just changing the BorderStyle to None, and drawing a simple border myself in the parent form/user control with a function like:
private void DrawTextBoxBorder(Graphics g)
{
Rectangle rectClient = myTextBox.ClientRectangle;
Rectangle rect = myTextBox.RectangleToScreen(rectClient);
rect.Offset(-1,-1);
rect.Width += 1;
rect.Height += 1;
Point ptClient = new Point(0,0);
Point ptScreen = PointToScreen(ptClient);
rect.Offset(-ptScreen.X, -ptScreen.Y);
g.DrawRectangle(Pens.SlateGray, rect);
}
|
|
|
|
|
Inherit your class from TextBox Overrid OnPaint and set
ControlStyle to UserPaint use The Following Class as start
public class TextBoxEx :TextBox
{
private Color borderColor;
public TextBoxEx()
{
this.SetStyle(ControlStyles.UserPaint,true);
this.BorderStyle=BorderStyle.FixedSingle;
borderColor=Color.Red;
}
public Color BorderColor
{
get
{
return borderColor;
}
set
{
borderColor=value;
}
}
protected override void OnBorderStyleChanged(EventArgs e)
{
this.BorderStyle=BorderStyle.FixedSingle;
base.OnBorderStyleChanged (e);
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint (e);
ControlPaint.DrawBorder
(e.Graphics,e.ClipRectangle,borderColor,ButtonBorderStyle.Solid);
}
MCAD
|
|
|
|
|
void DrawComplexNumber(double re_, double im_)
{
//What code in here creates a Graphics obj?
}
thanks
|
|
|
|
|
Al drawing should be done in an OnPaint Handler. OnPaint gets called when the form/control needs to be painted again (ew.g. another window was moved above it)
If you call DrawComplexNumer from an OnPaint handler, simply pass the Graphics object as additional parameter.
Pandoras Gift #44: Hope. The one that keeps you on suffering. aber.. "Wie gesagt, der Scheiss is' Therapie" boost your code || Fold With Us! || sighist | doxygen
|
|
|
|
|
Where you want to draw form,PictudeBox?
MCAD
|
|
|
|
|
|
i mean the surface you want to draw on it?
MCAD
|
|
|
|
|
private void complexA_OK_Click(object sender, System.EventArgs e)
{
Graphics g = this.CreateGraphics();
Pen cmplxAPen = new Pen(Color.Crimson);
//
try {
double valAReal;
double valAComplex;
valAReal = Convert.ToDouble (this.textComplexAReal.Text);
valAComplex = Convert.ToDouble(this.textComplexAComplex.Text);
//HOW TO DEFINE THIS FUNCTION?
DrawComplexNumber(valAReal, valAComplex);
}
catch {
MessageBox.Show("Invalid Complex A Number", "Error!");
}
}
|
|
|
|
|
You need to modify DrawComplexNumber Function let its Decleraion like
DrawComplexNumber(Graphics g ,double re_, double im_)
{
//Your implementation
//g.DrawLine(.......)
}
and in complexA_OK_Click call it like
DrawComplexNumber(g,valAReal, valAComplex);
where g =this.CreateGraphics()
MCAD
-- modified at 16:32 Monday 5th September, 2005
|
|
|
|
|
Mohammed-- got it to work! thanks
However each time I input values to the TextBox and click the "OK" button event, it will not erase the previous line that was drawn. So each set of coords are all drawn on the graph.....?
Invalidate()? Where?
|
|
|
|
|
You can Call Clear method of Graphics object
g.Clear(color); set color to the background color
but note that this clear all not onley the line you draw
if you want to clear onley the line
Pen p=new Pen(new SolidBrush(this.BackColor));
g.DrawLine(p,x1,y1,x2,y2);
MCAD
|
|
|
|
|
I am using file watcher and a timer in a windows service and i want that timer_elapsed function should be called only when any file sytem watcher event is not working.i think it can be done using threading if i will assign lowest priority to the timer_elapsed thread.but i am not able to do it.
can anybody can tell me how to do it in C#.
|
|
|
|
|
I would use something as simple as a static variable as a counter. Increase the counter when a watcher event starts, and decrese it when it ends. Check the counter in the timer, and only do anything if the counter is zero.
---
b { font-weight: normal; }
|
|
|
|
|
In C# the easiest way to accomplish this is to use a lock on an object.
private static object sLock = new object();
private void Timer_elapsed(object source, EventArgs e)
{
lock (sLock)
{
}
}
private void FileWatcher_event(object source, EventArgs e)
{
lock (sLock)
{
}
}
any code in the lock blocks is protected from multiple threads accessing it at the same time. I do something similar with the timer that I wrote: http://www.codeproject.com/dotnet/ABTransClockArticle.asp[^]
I can imagine the sinking feeling one would have after ordering my book,
only to find a laughably ridiculous theory with demented logic once the book arrives - Mark McCutcheon
|
|
|
|
|
Working with a encryption app that stores data in a xml-file.
When i encrypt "Test" it looks like below:
1/2 6 square D
when i store it in the xml file it reads:
8
What can be the problem... should i encode it in some special way?
Below is some of my code. As you see iam using Encoding.Default... UTF-8.
Creates the xml file:
XmlTextWriter initXmlWriter = new XmlTextWriter (_strFilePath+" neocodes.xml", Encoding.Default);
initXmlWriter.Formatting = Formatting.Indented;
initXmlWriter.WriteStartDocument(false);
Get the xml file into a xml node list:
_xmlNeoCodes.Load(_strFilePath+" neocodes.xml");
_xnlCodes = _xmlNeoCodes.GetElementsByTagName("code");
Read node:
tempNode = _xnlCodes[i].ChildNodes;
tempstring = tempNode[3].InnerXml.ToString();
Johan
|
|
|
|
|
How to make Intelligent datagrid like yahoo messenger address tab. When we type any word first letter like
In Datagrid Column name is Name it has different name like
Muhammad Waqas Butt
Muhammad Sheraz Butt
Saad Butt
Aarij Butt
So when we type M then it show and select the record and then type u it show only record which are starting from M and second word u.
Any Idea? In C#.Net
|Muhamad Waqas Butt|
waqasb4all@yahoo.com
www.sktech.freewebspace.com
|
|
|
|
|
search for Asynchronous Javascript and XML (AJAX) on google...
|
|
|
|