|
I noticed that TextEditBase or RichEditBox does not allow the Paint to be overriden.
I can intercept the WM_PAINT message by overriding WndProc. I'm basically trying to implement a left margin with number numbers in RichEditBox, now this is real easy using MFC/Win32 by implementing a OnPaint/WM_PAINT message validating the margin, calling Default/DefWindowProc then invalidating the margin and the drawing the margin in the begin paint...
Ok here's the snippet:
void CWinRETestView::OnPaint()
{
CRect rc;
GetClientRect(rc);
int nSave = rc.right;
rc.right = m_nMargin;
ValidateRect(rc);
Default();
InvalidateRect(rc);
CPaintDC dc(this); // device context for painting
DrawMargin(rc, dc);
}
How can this be done using RichEditBox using C#, .net?
|
|
|
|
|
Hallo *.*,
how do I convert IPicture to Image? I know there is a HANDLE field, but whenever I call Image.FromHbitmap(handle), it fails with an ExternalException in system.drawing.dll.
What am I doing wrong?
//get an IPicture of the visible MapPoint map
MapPointUtilities util = new MapPointUtilitiesClass();
Object obj = util.GetPictureFromObject(mapControl.ActiveMap, 100000, 100000);
//get the handle
Type t = obj.GetType();
Object handle = t.InvokeMember("HANDLE", BindingFlags.GetProperty, null, obj, null);
//convert the handle
Int32 intHandle = (Int32)handle;
IntPtr ptrHandle = new IntPtr(intHandle);
//get the image
Image img = Image.FromHbitmap(ptrHandle);
//does not work either
//Bitmap bmp = Bitmap.FromHbitmap(ptrHandle);
Image.FromHbitmap throws this exception:
System.Runtime.InteropServices.ExternalException' in system.drawing.dll
Additional Information: A general error has occurred in GDI+
Thanks for every hint,
Corinna
|
|
|
|
|
I'm reading in some XML where the date is formatted like: Mon, 01 Sep 2003 11:50:00 PDT. I can read this element as text and I want to convert it to a System.DateTime but the XmlConvert.ToDateTime and DateTime.Parse don't seem to support a format for the timezone (i.e. interpretting the "PDT"). I've also looked at the TimeZone class but no help.
Can anyone give some direction on how to handle this formatting-wise either by telling me what format represents timezone (no "zzz" doesn't work) or a class/method that can help here?
Thanks.
|
|
|
|
|
Anything that goes into a collection must also be Serializable if you want to serialize it. So make sure CodeItem is set as Serializable.
dog_spawn
http://www.hatekill.com[^]
|
|
|
|
|
Hi there,
I set up a DataSet (C#/.net) with a few tables, one table containing the DataSet Primary Key and the other tables containing only Foreign Key refering to the PK.
Now I am trying to populate the DataSet manually, reading from a Binary File:
FileStream fs = new FileStream("C:\\File", FileMode.Open);
Byte[] abyBuffer = new Byte[fs.Length];
BinaryReader r = new BinaryReader(fs);
db3plus.headerRow hrow = db3plus1.header.NewheaderRow();
hrow.version = r.ReadByte();
db3plus1.header.Rows.Add(hrow);
db3plus.lastupdateRow lrow = db3plus1.lastupdate.NewlastupdateRow();
lrow.byte1 = r.ReadByte();
lrow.byte2 = r.ReadByte();
db3plus1.lastupdate.Rows.Add(lrow);
The thing is, the Relation I set up between these two tables seems to be lost, since the second entry won't be inserted in the same DataSet as the first entry.
Leaving me with the second Table not having a Relation (Foreign Key) to the Parent-Table
Any help?????
|
|
|
|
|
I think I know the answer to this, but one thing to check first: when is it 'lost'?
dog_spawn
http://www.hatekill.com[^]
|
|
|
|
|
Hi,
I've already found out what I did wrong: I thought when working with a typed DataSet, when I create new Rows and add them to a Table, my Relations would be automatically set.
But I actually had to use the SetParentRow Method...
But still it would be helpful to get some feedback on this, since I don't really know, if this isn't totally bull*hit, what I'm doing here:
db3plus.headerRow hrow = db3plus1.header.NewheaderRow();
hrow.version = r.ReadByte();
db3plus1.header.Rows.Add(hrow);
db3plus.lastupdateRow lrow = db3plus1.lastupdate.NewlastupdateRow();
lrow.SetParentRow(hrow);
lrow.byte1 = r.ReadByte();
lrow.byte2 = r.ReadByte();
lrow.byte3 = r.ReadByte();
db3plus1.lastupdate.Rows.Add(lrow);
THANKS
|
|
|
|
|
I am writing a .NET control to run inside an ActiveX Container. Our existing interface uses VARIANT* and this needs to be maintained.
I've used ref Object as a type in order for Studio to create a VARIANT* type against my function in the type library but I can't seem to pass any objects out of the control without generating a runtime exception or a compile error.
I've tried using an Object member variable and passing it out as SendMessage( ref m_MyObject ); (which compiles).
I actually need to be able to pass out types as variants (mostly doubles and strings).
Anyone know why I can't do this or how I should do it?
Thanks
|
|
|
|
|
Actually, could the exception be caused by the container not implementing the message event? (it's the old "Object reference not set to an instance of an object" exception). I assumed it was complaining about the objects passed out of the function rather than the function call itself.
Luke
|
|
|
|
|
Just suggestion:
Maybe you should consider wrapper ActiveX Control that you insert into your ActiveX Container, that will wrap .NET control methods according to your container rules and delegates calls to .Net control, while converting arguments from VARIANT* to default types expected by .Net control...
"...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..."
Me
|
|
|
|
|
Hello
Is there some way how to use windows forms or some third party .net controls and components in my MFC application?
I have a application, with MFC and COM controls and I' d like to use there some third party .NET components.
In all MS examples for MC++, there is only shown,. how to create applicatino, that opens new window with this windows forms controls.
Thanks
|
|
|
|
|
Tom Archer and Nishant S (two well known CP members) wrote a book on this recently. Extending MFC Applications with the .Net Framework[^]
"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
|
|
|
|
|
yes, but this book is being published in december
don't you know, whether there is some possibility to buy electronical version or so?
Thanks
|
|
|
|
|
don't you know, whether there is some possibility to buy electronical version or so?
Unfortunately I do not. But maybe one of the two will be able to help you if they happen to drop by this forum.
"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
|
|
|
|
|
You might try contacting Tom Archer directly and ask him that same question - he's a CP member, and his profile is here:
Tom Archer
Jerry Dennany
|
|
|
|
|
I have a problem with NumericUpDown, they are set to increment and decrement by 2. It does not seem to accept the first click. I have a function SetNumberGrid which draws a number of controls, and works fine.
However the NumericUpDown does not except the first click and then it becomes corrupted so (if nCols = 1)
when 1 is shown 3 controls are drawn, when 3 is shown 1 control is drawn, when 5 is shown 3 controls are drawn, 7 = 5 controls, 9 = 7 controls and so on.
the NumericUpDown control is initialised to 1.
System::Void HeightUpDown_ValueChanged(System::Object * sender, System::EventArgs * e)
{
int nCols = 1;
//get number of columns already visible
if(this->m_numTextBoxArray != 0)
{
nCols = this->m_numTextBoxArray->GetUpperBound(1)+1;
}
//draw controls
this->SetNumberGrid(Int32::Parse(this->HeightUpDown->Text), nCols);
}
|
|
|
|
|
I think i've worked out the problem, the Text held in the NumericUpDown control must not change until after this event.
|
|
|
|
|
Hi
I wan´t to implement DIME in my managed c++ web service, but after I´ve installed WSE 2.0 and chooses to "Enable this project for Web Service Enhencments" I get the errormessage "The WSE must be installed to enable this feature"
Why is that, I have installed, the dll is in the assembly. What is wrong?
With highest regards
// Daniel
|
|
|
|
|
I want to use tcpTrace.exe to test the encryption sink that Ingo Rammer provided in his book, but i couldn't get anything.
my client and server is using port 5555, my default local host port is 80. in client.exe.config, the url is "http://localhost:5555/SomeSAO.soap" />. how do I configure tcpTrace's destination server, listen port# and destination port#?
|
|
|
|
|
Patrick Burke with Navistaff. I just wanted to check in with you regarding a spot I had come up at a major Ibank in the NYC area.
This bank is currently looking for a very strong C# developer with financial trading system experience to join their program trading group. Must have excellent WinForms development experience with multi-threaded applications and synchonization mechanisms. Experience with threading namespace would be a plus.
Must have strong experience with building and support high performance/high capacity systems. Experience with Oracle, IPC's, TibcoRV and FIX would be ideal.
Please send resumes to pb@navistaff.com
|
|
|
|
|
Greetings All!
My question is (i think pretty straight forward) mainly about logging errors from a web services or a webform.
What I would like to do is write to the event log from a web service and/or webform. I have read some of the articles on codeproject on how to do this.. but achieved zero success .. Can anyone help?
To further explain what I want to do..
An example web method :
[WebMethod]
public void someMethod()
{
try
{
// soem random code that might throw and exception
}
catch(Exception e)
{
// write to event log here
}
}
This is just one example.. There are more ofcourse.. But again if anyone can shed some light on this subject it would be greatly appreciated!
Regards,
Daniel Rodriguez
|
|
|
|
|
When debugging a serial app I'm working on, I notice that every so often a call to WriteFile with a handle corresponding to a serial port blocks indefinately...
After hunting this down I added a healthy write interval timeout and now the call returns (without completing the expected output fully), but after calling ClearCommError() I get no errors
returned, but the condition persists..
Representative calls below:
<br />
hComm = CreateFile(PortText, GENERIC_READ|GENERIC_WRITE,<br />
0, 0, OPEN_EXISTING, FILE_FLAG_NO_BUFFERING, 0);<br />
<br />
SetCommTimeouts(hComm, &MyTimeouts);<br />
...
<br />
<br />
WriteFile((HANDLE)hComm, Buffer, Size, &BytesWritten,<br />
(LPOVERLAPPED)NULL);<br />
Now with the write interval timeout, I check BytesWritten with OutputSize (passed in) and can see when the problem occurs (they don't match), but still have no clue as to why...
Any Resonable suggestions would be greatly appreciated. Thanks in advance.
Kevin
|
|
|
|
|
Hi,
I am using the PageSetupDialog, and all documentation says the Margin units are in 100ths of an Inch. However, the dialog box displays the margin values in either Millimeters or Inches depending on the setting in Control Panel - Regional Options - Numbers - Measurement system.
When the PageSetupDialog box is displayed, the values passed for the margins are converted to Inches, regardless of the 'Measurement system' selected in the control panel. This all works if you select 'U.S.' as your measurement system, but selecting 'Metric' causes the margin values to be corrupted when the PageSetupDialog box is used.
Try it yourself - select 'Metric' in the control panel setting, then use a .NET application that has a PageSetupDialog in it and simply open and close the dialog repeatedly. You will notice that the margin values will slowly decrese until they reach the minimum allowed values. Try setting them higher and repeat the open/close thing.
Shouldn't the PageSetupDialog be using the RegionInfo.CurrentRegion settings to decide on the measurement system instead of the control panel setting???
Is there a way to work around this?
Thanks for any help.
|
|
|
|
|
I've been using the colour (Color) structure and noticed you can get the Hue, Saturation and Brightness elements using GetHue() etc. However there does not been anyway to convert a HSB colour back to RGB.
Is there any other class (which I can't find) that can do this?
If there isn't then I have an algorithm to do RGB to HSB, but does anyone know what value GetHue() returns when the Hue value is undefined?
Thanks
|
|
|
|
|
Gomac wrote:
Is there any other class (which I can't find) that can do this?
Not that I know of. I wrote my own.
Gomac wrote:
If there isn't then I have an algorithm to do RGB to HSB, but does anyone know what value GetHue() returns when the Hue value is undefined?
You mean when it's grayscale? I don't know, but you might want to experiment to find out.
"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
|
|
|
|