|
|
Hi,
Easy question here. I found this online, but (I'm still new to programming) I'm not sure how to use it.
protected override CreateParams CreateParams<br />
{<br />
get<br />
{<br />
CreateParams cp = base.CreateParams;<br />
cp.ExStyle |= 0x00000020;
return cp;<br />
}<br />
}
Do I create a new class for this code? Either way, how and where do I say that I want a label (not all labels) to be this way.
Thanks so much!!!
Mel
|
|
|
|
|
Hi again,
Ok, I created a class and put the code in it.
public class TransparentControl : Label<br />
{<br />
protected override CreateParams CreateParams<br />
{<br />
get<br />
{<br />
CreateParams cp = base.CreateParams;<br />
cp.ExStyle |= 0x00000020;
return cp;<br />
}<br />
}<br />
}
Back in the normal form, I made the label private TransparentControl label7; and changed the appropriate line in InitializeComponent() this.label7 = new HCAUT.TransparentControl(); . I also made the backcolor of the label Transparent. But when I run everything, the label's backcolor still isn't transparent. Can anyone see what I'm doing wrong?
Thanks again,
Mel
|
|
|
|
|
hi melanieab!
i think if you inherited the Label, it already supports transparency.
try to remove the override property you've added.
if still doesn't allow transparency, add this line of code on the constructor of your control.
SetStyle(ControlStyles.SupportsTransparentBackColor, true)
hope that helps!
microsoc
|
|
|
|
|
hi all, Im using Microsoft Data Application Block for this.
Im trying to execute a sql procedure that inserts a row. I need
to get the identity field (eventID) returned back to me.
Ive tried several ways but it wont work. Anyone have a complete
example written in c# 1.0 for sql server 8.0, with c# code and
stored procedure?
Really appreciate all the help.
thanks
Moazzam
|
|
|
|
|
Why don't you show us your code and we can show you where to put it right?
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
|
|
|
|
|
Assuming your table contains an Identity column ..
create procedure EmployeeCreate (@name varchar(20), @dept varchar(20), @employeeid numeric out)<br />
as<br />
begin<br />
insert into Emplyee (Name, Department) values (@name, @dept)<br />
select @employeeid = @@identity<br />
end
So when you execute your SQL command from .net and pass parameters, pass a parameter for "@employeeid". You wont need to set a value for this SqlParameter, but you'll have to set the correct Direction.
- Malhar
|
|
|
|
|
Hey guys, could anyone please tell me from where i can get the windows default bitmaps for standard toolbar buttons like 'cut', 'copy', 'print', 'save',etc..... in my C# forms
|
|
|
|
|
c:\program files\vs.net\common7\graphics\...
|
|
|
|
|
If you make a toolstrip and in its options choose to embedd standard items, then the cut copy save etc appear with icons
You could search for the strings they use to get the icons in the designer file
|
|
|
|
|
Our main application is written in vb 6.0. The latest module for this product is written in .net. To accomplish this our .net module expose a COM interface to start and stop the .net module from the vb 6.0 code base.
Furthermore the module needs to receive data from the vb application during the session. Otherwise the connection between both is useless. At the moment the .net module is a Inproc COM thing which runs in the same process as the vb app does.
At first glance the problem seemed just to be that the Tab key behaved strange. A few tests later we saw that the .net module opens a MDI Form but didn't create a message loop (Application.Run). A few coffees later we fixed that part and the .net module main window was finally running inside a Application.Run(new MdiMainForm()) call. Guess what, the tab problem was fixed...
I assume that the vb application message loop wasn't suitable for the .net part of the process I guess it's very strange to have such a constelation inside one process, right?
After seeking codeproject I know that the best solution would be to let the module run as an exe in his very own process, OutOfProcess as a COM Server or use one of the IPC solutions (Named Pipe, Remoting WM Messages etc..)
This seems all to be very compilcated, all I want is to start/control/stop our .net module by the vb application, any ideas?
myMsg.BehindDaKeys = "Jerry Maguire";
|
|
|
|
|
This doesn't apply specifically to C#, but it is the language I am using and I did not see a better place to post this. If there is a better place, please let me know.
I have a finite, positive number of integers (in most cases between 3 and 20)
I want to split the integers into two groups such that their sums are as equal as possible (easy)
now the part that I'm having trouble with:
I want to find the top X combinations of groupings with the closest total sums (not just the top 1)
Obviously, I need calculate the sums for every possible combination, but I'm having trouble figuring out how to do this. Any ideas from veteran developers on a strategy to approach this or a recommended data structure?
EDIT:
I should add one more stipulation, the two groupings must both have the same number of elements (or one off if an odd number of total elements).
-- modified at 13:02 Thursday 2nd February, 2006
|
|
|
|
|
Just to clarify - combinations of groupings (of any amount of the numbers) that have the closest possible sums with any of the other groupings (of any amount of the numbers).
This is going to work out to being a very large number of calculations/combinations...
Depending on the number of numbers of course...
-- modified at 12:27 Thursday 2nd February, 2006
|
|
|
|
|
I should add one more stipulation, the two groupings must both have the same number of elements (or one off if an odd number of total elements).
for example, if I had elements with values: 1, 5, 19, 10
and I wanted the best 2 groupings, I would get:
{ 19, 1 }, { 10, 5 }
{ 19, 5 }, { 10, 1 }
I hope that clarifies things. It will be a fair amount of calculations, but it shouldn't be too bad because the maximum number of elements (in this case) is 20. That and I can't think of a better way :/
|
|
|
|
|
Are there any limitations on the number of items in each group, or can one group have many more items as long as the totals are close?
An easy way to find all combinations is too look at each item belonging to either group as a bit value. If you have 8 items you need 8 bits to represent which group they belong to, so there are 256 (2^8) ways of dividing the items into two groups if there is no limitations on the number of items in each group.
If you place the (rather obvious) limitation that each group has to contain at least one item, you have (2^n)-2 combinations, where n is the number of items.
---
b { font-weight: normal; }
-- modified at 12:44 Thursday 2nd February, 2006
|
|
|
|
|
I editted my main post to include the limitation that both groups must have an as-close-to-equal-as-possible number of elements.
|
|
|
|
|
Which is more important then, the difference in total sum, or the difference in number of elements?
---
b { font-weight: normal; }
|
|
|
|
|
the [lack of] diffrence in number of elements is more important
|
|
|
|
|
Then you only have to do the actual calculation for those combinations where the difference is low enough. Loop through the combinations and count the bits, and if the difference between zeroes and ones are low enough, calculate the sums. You can keep a sorted list with the best results so that you easily can add results that are better than the previous.
---
b { font-weight: normal; }
|
|
|
|
|
Hi,
I'm doing a windows app and I need to know if the user pushed the red X button in the top right of my form.
I know the Form_closing has an enum telling the reason of the form close, but it doesnt specify if it was my own cancel button or the X button, and I need to know it.
Any ideas?
Thanks in advance
|
|
|
|
|
public class MyForm:Form<br />
{<br />
private bool _cancelButtonClicked = false;<br />
private void cancelbutton_clicked(..)<br />
{<br />
_cancelButtonClicked = true;<br />
}<br />
private void form_closing(..)<br />
{<br />
if (_cancelButtonClicked)<br />
{<br />
}<br />
else<br />
{<br />
}<br />
}<br />
}
- Malhar
|
|
|
|
|
Yeah, well...thanks for the reply, but I was looking for a non-flag solution, thats the easy way
|
|
|
|
|
That's also the only way you can tell the difference.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Damn...thats bad. Thanks for your help guys
|
|
|
|
|
hi chals!
try this:
private const int WM_SYSCOMMAND = 0x112;
private const int SC_CLOSE = 0xF060;
protected override void WndProc(ref Message m)
{
if (m.Msg == WM_SYSCOMMAND && m.WParam.ToInt32() == SC_CLOSE)
{
}
}
messages under WM_SYSCOMMAND includes:
- Restore, Move, Size, Minimize, Maximize & Close (x button in the forms) or the commands in the context menu when you right click the title bar of a window.
the SC_CLOSE WParam is for the close command.
you can look for other commands in the WinUser.h file of Visual Studios. most of the time it is in "C:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\Include\" folder. It has the list of constants for API commands.
hope that helps!
microsoc
|
|
|
|