|
I should reply to my own post. I found the answer to this long ago, but never came back to update this. So here goes. Regasm comes with Visual Studio. So a machine with no visual studio and just the .Net framework will NOT have regasm on it.
Hence, you cannot rely on
[ComRegisterFunctionAttribute]
public static void Register( Type t )
For this is called by regasm. You need to find other ways to register your DLL and make otehr registry entries.
|
|
|
|
|
I have a control that is derived from the standard ComboBox. I want to lock or suppress the DropDown when the arrow button is clicked without disabling the control.
This is related to another post that I have out there for a custom OnPaint event. I want to provide custom colors for ComboBox that work even when the Enabled is set to false (by default it is set to Gray). I have provided a new implementation for the Enabled property to handle it myself. When the control is in my disabled state I am supressing KeyDowns so that it appears as if it is disabled. The only problem is that you can still drop down the list, and choose an item. If I can lock this, I'm good to go.
Oh, and I'd rather not have to use SendMessage in WndProc to accomplish this. I don't want to have a dependency on user32.dll.
--Ian;
|
|
|
|
|
--Ian wrote: I want to lock or suppress the DropDown when the arrow button is clicked without disabling the control.
Sound like a textbox with an image of an arrow next to it.
|
|
|
|
|
I'd also not like to reinvent the wheel. Everything else the ComboBox does is great, I just want to lock the drop down list from being dropped down.
--Ian;
|
|
|
|
|
I guess I don't understand. A dropdown without being able to dropdown is not a dropdown. A rose by any other name would be a textbox.
|
|
|
|
|
The problem is that I need a dropdown with my own custom Enabled property. When I disable it, I want to lock or suppress the dropdown list from being displayed. In other words, this rose must still be a dropdown.
Once again, the root cause for this is that the BackColor is set to Gray when the ComboBox is diabled by setting Enabled = false. The OnPaint event is creating other issues, as expressed in another post, and I'm looking for another workaround.
--Ian;
|
|
|
|
|
Hi CP,
May i know anyone get the things ?
Regards ,
|
|
|
|
|
I have a control that is derived from the standard ComboBox. I have an override for the OnPaint method that paints a border, drop down arrow button, background, and foreground. The only problem is that something (some other event/subcontrol) is drawing a black text box with a large font over top of the text box region of the combo box control.
I am drawing a background in my OnPaint event, and it is being draw on top of. I can see that the background is drawn because there is a border around the text box region. My code looks like the following:
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
DrawBorder();
DrawBackground();
DrawArrowButton();
DrawForegroundText();
}
What am I missing here??? By the way, this control works just fine if the DropDownStyle is set to DropDownList, however I'm need it to work as a DropDown (being able to edit the text box).
--Ian;
|
|
|
|
|
--Ian wrote: base.OnPaint(e);
I think you dont need to call that
|
|
|
|
|
Actually it doesn't matter if I call base.OnPaint(e), because I'm doing my custom paint stuff after the call. Either way, if you remove the call, the text box is still drawn by something else.
--Ian;
|
|
|
|
|
The sample class below does not contain all the code, however it will give you an idea of the problem. Just drop this class into your a project, compile, and drop it the ComboDraw control onto a form.
<br />
using System;<br />
using System.Collections.Generic;<br />
using System.Drawing;<br />
using System.Text;<br />
using System.Windows.Forms;<br />
<br />
namespace ComboTest<br />
{<br />
class ComboDraw : ComboBox<br />
{<br />
public ComboDraw()<br />
{<br />
DrawMode = DrawMode.OwnerDrawFixed;<br />
DropDownStyle = ComboBoxStyle.DropDown;<br />
FlatStyle = FlatStyle.Flat;<br />
SetStyle(ControlStyles.UserPaint, true);<br />
}<br />
<br />
protected override void OnPaint(PaintEventArgs e)<br />
{<br />
base.OnPaint(e);<br />
<br />
e.Graphics.FillRectangle(new SolidBrush(Color.Green), ClientRectangle);<br />
}<br />
}<br />
}<br />
--Ian;
|
|
|
|
|
Dear friends,
I draw a circle in the client area of the window. Then i divide that circle into four parts by drawing two straight lines passing from the middle of that circle. It means that the circle is divided into four pies.
Now what i want is that whenever i click inside any pie, it should get filled with color. I dont want to fill entire circle with the color. What i want is that whenever i click inside any closed region (like pie), that region get filled with some color. Please tell me how is this possible ?
I want to do some something like famous MS-Paint program. In MS-Paint, we select brush and then click inside any bounded region, as such only that region gets filled with the color.
Imtiaz
|
|
|
|
|
A little bit of research will go a long way.
If you look at the Graphics object you will find methods called FillPie and FillRegion. Perhaps these are what you need.
|
|
|
|
|
Whatever i wrote above is just a simplified form, actually i need to do something like MS paint. If we select brush object in MS paint and click on the drawing, specific portion surrounded by lines or curve gets colored.
Imtiaz
|
|
|
|
|
|
Could give you a cheater (or FillArc). If you want to do it dynamically you may have to do image processing logic. http://www.cs.rit.edu/~icss571/filling/how_to.html
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
Hi,
I need help in avoiding the window which pops up during the USB detection. I am using Windows XP professional and I actually does not want any window to be popped up during this USB Mass storage device or MP3 Player Detection.
Please help me in this issue.
|
|
|
|
|
I have a stored proc in which I want to return a value. This is what I have in my c# code:
private void btnAdd_Click(object sender, System.EventArgs e)<br />
{<br />
strPartNumberInputReference = txtSearchPart.Text;<br />
strDwgNumber = txtDwgNumber.Text;<br />
strDwgRevision = txtDwgRevision.Text;<br />
strDwgLocation = txtDwgLocation.Text;<br />
<br />
ds2 = new DataSet();<br />
SqlParameter param1 = new SqlParameter("@PartNumber", strPartNumberInputReference); <br />
SqlParameter param2 = new SqlParameter("@DwgNumber", strDwgNumber);<br />
SqlParameter param3 = new SqlParameter("@DwgRevision", strDwgRevision);<br />
SqlParameter param4 = new SqlParameter("@DwgLocation", strDwgLocation);<br />
SqlParameter param5 = new SqlParameter("@PartTypeDescription", strPartTypeID);<br />
SqlParameter param6 = new SqlParameter(@ID, 0);<br />
param6.Direction = ParameterDirection.Output;<br />
ds2=SqlHelper.ExecuteDataset(this.connectionString, CommandType.StoredProcedure,"dbo.UpdatePart_Step_1_Test", param1, param5);<br />
dt2 = ds2.Tables[0];<br />
}
My question is on the bolded portions since this is what I just added. I haven't worked with ParameterDirection.Output before. I have (@ID, 0); I put the 0 in there because I saw a response to a similar question on CodeProject. Is this what it really should be? I am returning @ID which is an integer. If I write (@ID, int) the compiler doesn't like it.
Thanks!
|
|
|
|
|
SqlParameter param6 = new SqlParameter(@ID, SqlDbType.Int);
Look at the documentation for SqlParameter, particularly the overloaded constructors
|
|
|
|
|
Thank you, I will do that!
|
|
|
|
|
Although in the case of an ID I must certainly do use them. Don't forget to use SCOPE_IDENTITY in your sp instead of IDENTITY
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
Can you elaborate? I'm having trouble with the stored proc. It says it's expecting @ID but not getting it.
CREATE PROCEDURE [dbo].[UpdatePart_Step_1]<br />
@PartNumber varchar (15),<br />
@PartTypeDescription varchar (60),<br />
@ID int OUTPUT<br />
<br />
AS<br />
declare @pt_id integer, @ThePartNumber integer<br />
<br />
if NOT EXISTS (Select * from Parts where PartNumber = @PartNumber)<br />
BEGIN<br />
<br />
SELECT @pt_id = pt.ID FROM PartTypes pt <br />
<br />
INNER JOIN Parts p on pt.ID = p.PartTypeID<br />
<br />
WHERE pt.Description = @PartTypeDescription<br />
<br />
insert into Parts<br />
(PartNumber, PartTypeID)<br />
<br />
VALUES<br />
(<br />
@PartNumber,<br />
@pt_id<br />
)<br />
<br />
<br />
END<br />
SELECT @ID=@@IDENTITY <big>Change this to SELECT @ID = @@SCOPE_IDENTITY?</big>return 0
|
|
|
|
|
Yeah, I use SET @ID = @@SCOPE_IDENTITY. In most cases the two methods are the same. However, if a trigger is called on your insert @@IDENTITY could be changed before your set (or SELECT both are valid)
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
Hi,
When comparing two models in MS Rose I recieve the following problem:
** Exception **
Bai.Uml.Delta.PropertyComparison.GetValue(IElement element) called with element [3D3D4E3D017E] for property "Packages" failed.
Exception has been thrown by the target of an invocation.
-- Inner Exception --
Not enough storage is available to complete this operation.
Source: mscorlib
-- Stack Trace --
at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean isBinderDefault, Assembly caller, Boolean verifyAccess)
at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean verifyAccess)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.MethodInfo.Invoke(Object obj, Object[] parameters)
at Bai.Uml.Delta.PropertyComparison.GetValue(IElement element)
** End Exception **
Anyone an idea what the reason can be and how to solve it?
Thanks,
Flash-Over
|
|
|
|
|
in my application contains two readbuttons when click one it should display data thatb is present in xml into combobox 1st time it works clearly but when user click on readbutton the value appears coupled with previous value inthe combobox
plz any one send a suggestion to solve this problem
gsvgnani
|
|
|
|