|
I have this code in a C# class library
[Conditional("DBC_CHECK_ALL")]<br />
public static void Assert(bool assertion)<br />
{<br />
ExceptionAssert(assertion);<br />
TraceAssert(assertion);<br />
}<br />
<br />
[Conditional("DBC_USE_EXCEPTIONS")]<br />
static void ExceptionAssert(bool assertion)<br />
{<br />
if (!assertion) throw new AssertionException("Assertion failed.");<br />
}<br />
<br />
[Conditional("DBC_USE_ASSERTIONS")]<br />
static void TraceAssert(bool assertion)<br />
{<br />
Trace.Assert(assertion, "Assertion failed.");<br />
}
which is attempting to implement Anding of attributes as per this topic
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/csref/html/vclrfconditional.asp[^]
However, when I define either or both of DBC_USE_EXCEPTIONS or DBC_USE_ASSERTIONS in a Console app. that uses the library neither ExceptionAssert nor TraceAssert gets called.
Note: when all this is done within a single console app. it works OK.
Kevin
|
|
|
|
|
In .NET Compact Framework, System.Threading.Monitor.Wait(Object obj) and
System.Threading.Monitor.Pulse(Object obj) are not available. Does anyone know to use these functions or replace by other functions in .NET Compact Framework? Really Thanks a lot!!!!!
|
|
|
|
|
Hi everybody,
now for something completely different
I just read an article on pathfinding here on CP(http://www.codeproject.com/csharp/CSharpPathfind.asp) but it did not really get me started as I am too dumb to convert this to 3D
MY PROBLEM:
I have to write a program which checks if there is a path through a threedimensional cube, which consists of smaller cubes (scubes)
The cube dimensions are fixed (20x20x20 scubes) and each scube may be filled or void.
The is one variable, p, which determines the probability of a scube being filled (p) or being a void (1-p). This does not change as we iterate through the scubes on startup.
I have this cube ready to go and should now determine if there is a path from the top side to the bottom side.
Movement Rule: No Diagonal Moves, only along the three axis.
I smell recursion here, but I can't figure out how to do this
If I had some Lego(tm) here, I might have BUILT a cube and found a solution, but right now all I have is one sheet of paper and a pencil.
Can anyone get me back on track?
Cheers
Sid
|
|
|
|
|
find string Expire and change the first two lines after Expire to Code project
example
Expire
12345
23423 cool
To
Expire
Code project
Code project
thx
|
|
|
|
|
So, what's the qustion? And, no, we're not going to write the code for you. If you're having a problem with the logic or some code issue, we can help with that. But don't expect anyone to write the whole thing for you.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I recommend looking up, 'String'
IM PROUD TO BE A GMAIL;
|
|
|
|
|
I recommend telling the person who originally posted the question, not me...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
|
Hi! I’m working on a simple Windows.Forms database project. It would be nice for me to work with DataGrid (set properties & behavior of its elements) mostly via designer. Before setting DataSource & DataMember of the DataGrid I need to fill relative dataset with data. For that purpose I call myDataAdapter.Fill method.
The question is: Where can I paste myDataAdapter.Fill method to get filled DataGrid in the designer?
I’ve tried to put fill method in InitializeComponent, but designer recreates this section every time I change any property with it. Putting fill method somewhere in myForm constructor takes no effect on the designer. So maybe there is an attribute saying [no recreate] to mark constant section of designer region?
Thanks!
Dizzy
|
|
|
|
|
I might be wrong but I'm practically sure u can't make a DataGrid's databinding "active" in design time.
|
|
|
|
|
As long as the dataset exists and the datagrid's datasource property is set, filling the dataset in the c.tor has always worked for me... maybe paste some code (including your initializecomponent method) and it would be easier to see your problemo.
|
|
|
|
|
So, there is no special attribute for designer region. That’s ok. Maybe I've pasted fill method to the wrong constructor.
Let’s simplify my question, so there is no need to paste a lot of code.
Now I have a form & a button. There is my form constructor.
public Form1()<br />
{<br />
InitializeComponent();<br />
this.button1.BackColor = Color.Red;
}<br />
Initialize component is fully generated by designer and not takes a point of interest for us.
Please help me. In which class constructor I've to paste "this.button1.BackColor = Color.Red" to have colored button in the designer?
Dizzy
|
|
|
|
|
As far as I know, you cant create any method that the designer will run when creating a new instance of the control/component. It only does that with InitializeComponent() and it must be hardcoded because the method doesnt have any Atribute to tell the designer to run it in design time.
The only way u might be able to achieve what I think you want is creating some Browsable Get/Set property and putting the DataSet binding code in the setter. Then create a new form inheriting from the one u just created and go back to the designer and change the derived form's property. That should run whatever code you want.
Haven't tested it, but it should work. I dont know what the use in doing this is unless u want to get a better idea in design time how ur DataGridStyle is looking when displaying data but ...if thats the case, once it looks good just copy all generated code to ur original form and ur set.
|
|
|
|
|
How can I allow the Form to only do paint and move, resize, maximize and minimize events? I have the code for paint below.
private const int WM_NCPAINT = 0x0085;
private const int WM_PAINT = 0x000F;
private const int WM_ERASEBKGND = 0x0014;
private const int WM_PRINTCLIENT = 0x0318;
[SecurityPermission(SecurityAction.LinkDemand, UnmanagedCode=true)]
protected override void WndProc(ref Message m)
{
if (this.Buzy)
{
if (!((m.Msg == WM_PAINT) || (m.Msg == WM_NCPAINT) || (m.Msg == WM_ERASEBKGND) || (m.Msg == WM_PRINTCLIENT)))
{
return;
}
base.WndProc(ref m);
}
|
|
|
|
|
try this:
private bool allowPaint = false;
protected override void OnPaint(PaintEventArgs e)
{
if(this.allowPaint)
{
base.OnPaint (e);
}
this.allowPaint = false;
}
protected override void OnResize(EventArgs e)
{
this.allowPaint = true;
base.OnResize (e);
}
protected override void OnMove(EventArgs e)
{
this.allowPaint = true;
base.OnMove (e);
}
|
|
|
|
|
Hi
I had an resorce in my Assembly (Bitmap) and need to get resource ID of one, for pass to an function.How i can do this??
Please help!!!
|
|
|
|
|
There's no resources IDs like with native images - they have the name that you gave them when you compiled your assembly.
To get a list of the names, use Assembly.GetManifestResourceNames . To actually get the stream, use Assembly.GetManifestResourceStream .
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
I am trying to convert project originally written in SDK to .NET and came accross a problem that SetPixel function is not available anymore in .NET's GDI+. The function in original code was used to paint a grid (or I should better say a dot matrix) in a sort of a vector editor.
The SetPixel function is available in Bitmap class, but that won't help me, I guess.
Of course to draw a line just 1 pixel long does not work,
thus I would like to ask for any suggestion how to realise this in .NET
Lost In China
|
|
|
|
|
Probably easiest to just create a Bitmap, draw to it using SetPixel, then render it to the window (or whatever you have) using GDI+
--
Help me! I'm turning into a grapefruit!
Phoenix Paint - back from DPaint's ashes!
|
|
|
|
|
I had this problem as well. In VisualStudio 2002, I used the FillRectangle function with a rectangle that was 3 X 3 pixels. This would produce on pixel, filling the inside of the 3 X 3 rectangle fed to it, but not the rectangle border itself. In VS 2003, (using the newer .Net 1.1.1 framework) I beleve, the rectangle only had to be 1 X 1 pixel as the FillRectangle function now fills the border and the inside. You'll have to double check me on the detials, but the FillRectangle function is what your looking for.;)
|
|
|
|
|
Thanks Adam, FillRectangle(brush, x, y, 1, 1) does the job . Hope the function doesn't have too much overhead in comparison to SetPixel.
|
|
|
|
|
|
gavinJeffrey wrote:
Hi,
Erm, Hi
Can we help?
--
Help me! I'm turning into a grapefruit!
Phoenix Paint - back from DPaint's ashes!
|
|
|
|
|
I pushed enter to go to a new line but instead it posted the page (not the first time this has happened either). Yeah i did have a question but I figured it out. I also went and deleted my post straight away after I realized what I had done - dont know why it is still here though - just one of those days I guess.
|
|
|
|
|
Hi,
i want to embed a signed windows forms control (assembly with strong name, using a .snk key pair) into a html page. Using the normal <object>-tag works fine with the unsigned control, but doesn't work with the signed one! The signed control doesn't even open! In both cases i used the same html code. Is there information missing (e.g. about the key pair)?
Thanks a lot for your help!
Fridtjof
|
|
|
|