|
Just i need to get Visible property only
i declare 2 images within datagrid like
<asp:datagrid id="dGrid" Width="50%" AutoGenerateColumns="False" Runat="server">
<Columns>
<asp:TemplateColumn ItemStyle-Width="10%">
<ItemTemplate>
<asp:Image ID="imgPlus" Runat="server" ImageUrl="iimages\plus.gif"></asp:Image>
<asp:Image ID="imgMinus" Runat="server" ImageUrl="iimages\minus.gif"></asp:Image>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid>
Now i can't get the image using id in C#, I asked, how can i get that images id or visible property in C#.
|
|
|
|
|
hello
i have aproblem here mixing RGB rays to produce colors??
i wanna to draw a color triangle using this mixture??
if i cant explain the problem told me to more explanitions
thx
|
|
|
|
|
So you want to draw an equilateral triangle like so:
R
*
***
*****
G ******* B
excuse the crappy ascii graphics
So the red componant of each pixel will depend on how close it is to the R point, the green componant on the distance from G and the blue point from it's distance from B.
Working these out is fairly straightforward using high school trig
--
Help me! I'm turning into a grapefruit!
Phoenix Paint - back from DPaint's ashes!
|
|
|
|
|
look u have to know that the center of the triangle is white(255,255,255)
and there is no function draw pixel or points in windows application so plz help
thx
|
|
|
|
|
To draw pixels (assuming you're working on a Windows Forms project), place a PictureBox control on your form, create a Bitmap object in your code, then pass the PictureBox the bitmap using it's Image property
You can then use the bitmaps SetPixel member to plot points
--
Help me! I'm turning into a grapefruit!
Phoenix Paint - back from DPaint's ashes!
|
|
|
|
|
A PictureBox is a lot of overhead (no need for an in-memory bitmap to get blitted to the on-screen bitmap) and it's often better to encapsulate your controls rather than using whatever you can find. This gives you much more control over what the control does.
To the original poster: In this case, the PathGradientBrush can be very effective when overriding OnPaint of your own control. There's a lot of documentation you should, read, however, which can be found at http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemDrawingDrawing2DPathGradientBrushClassTopic.asp[^]. It - along with related classes - can calculate the gradient for you, if that's what you're trying to do.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Take a look at the PathGradientBrush , the GraphicsPath , and related classes and structs. If I understand your question right, the sample below should work for you by encapsulating your triangle into a separate control (with a clipping region set to the triangle for your control as well).
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
class Test : Form
{
static void Main()
{
Application.Run(new Test());
}
Test()
{
Text = "Triangle Example";
Triangle t = new Triangle();
Controls.Add(t);
t.Dock = DockStyle.Fill;
}
}
class Triangle : Control
{
public Triangle()
{
SetStyle(ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint
| ControlStyles.DoubleBuffer | ControlStyles.ResizeRedraw, true);
UpdatePath();
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
if (!init)
{
UpdateBrush();
init = true;
}
Graphics g = e.Graphics;
g.Clip = region;
g.FillPath(brush, path);
}
protected override void OnResize(EventArgs e)
{
base.OnResize(e);
UpdatePath();
}
protected override void Dispose(bool disposing)
{
if (disposing)
{
if (path != null) path.Dispose();
if (region != null) region.Dispose();
if (brush != null) brush.Dispose();
}
}
GraphicsPath path;
Region region;
void UpdatePath()
{
PointF p1 = new PointF(Width / 2, Top);
PointF p2 = new PointF(0, Bottom);
PointF p3 = new PointF(Width, Bottom);
if (path != null)
{
path.Dispose();
path = null;
}
if (region != null)
{
region.Dispose();
region = null;
}
path = new GraphicsPath();
path.AddPolygon(new PointF[] {p1, p2, p3});
region = new Region(path);
if (init) UpdateBrush();
}
PathGradientBrush brush;
bool init = false;
void UpdateBrush()
{
if (brush != null)
{
brush.Dispose();
brush = null;
}
brush = new PathGradientBrush(path);
brush.CenterColor = Color.Gray;
brush.SurroundColors = new Color[] {c1, c2, c3};
}
Color c1 = Color.Red, c2 = Color.Green, c3 = Color.Blue;
public Color C1
{
get { return c1; }
set { c1 = value; UpdateBrush(); }
}
public Color C2
{
get { return c2; }
set { c2 = value; UpdateBrush(); }
}
public Color C3
{
get { return c3; }
set { c3 = value; UpdateBrush(); }
}
}
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Hello,
I already looked in the articles but i did not found anyone. Does there not exist any article for PocketPc which works with tab pages - tab panes?
regards
pat
|
|
|
|
|
That's a rather vague question. What do you want to know, exactly? All you need to do is drag a TabControl onto your form, add tages through the TabPages property in the PropertyGrid, then drag controls onto specific TabPage s, which you can select like you would a TabControl at runtime in the designer to switch tabs.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
I want to build a menu with tabpanes, and I want to switch manually through the tab panes but also automatically when i press a specific button. Ist there no example available for that?
best regards
patrick
|
|
|
|
|
Hi all,
Are there any c# code for writing a simple HTTPS server.
I have written code for a http but not a https server.
Thanks
Patrick
|
|
|
|
|
Why not use IIS?
Do you want to know more?
Vogon Building and Loan advise that your planet is at risk if you do not keep up repayments on any mortgage secured upon it. Please remember that the force of gravity can go up as well as down.
|
|
|
|
|
|
please help me, i want to know how can i use xml as database for pocket pc or in compact framework. with coding.
|
|
|
|
|
pujas wrote:
with coding.
You had to post another message to clutter up this board just to add that? Please use the [Delete] and [Modify] buttons appropriately when you want to change or delete a post, otherwise you force other threads off the board that may not get seen if someone doesn't page through.
XML is not a suitable replacement for a database. Instead, you should use SQL Server CE - a file-based database engine with much of the power of SQL Server 2000 (including replication, which is handy to stay in sync with a corporate or desktop database when going back online) but optimized for handheld PCs. Take a look at http://msdn.microsoft.com/sql/sqlce/[^].
If you want to store a relatively small amount of data, you could use XML but don't associate XML with traditional databases. XML is not designed to handle the load that databases do, nor does it scale nearly so well. You also don't have the flexibility of executing simple SQL expressions.
Because trying to replace a database with XML is not a good idea and would warrant an entire article - if not several - I'm not going into details, but you can get more information and examples of using XML by reading about the classes in the System.Xml[^] and System.Xml.XPath[^] namespaces, like the XmlDocument and XPathNavigator (for fast reads over a document without loading the entire thing into memory like you would with the XmlDocument ; use the XmlReader instead).
MSDN also has an entire developer center for XML and most often discusses managed implementations (i.e., .NET Framework applications) regarding XML. Take a look at http://msdn.microsoft.com/xml/[^].
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
please help me, i want to know how can i use xml as database for pocket pc or in compact framework.
|
|
|
|
|
My problem is a very straightforward one. MS (probably for marketing purposes) claims that destructors are no longer necessary, while they obviously are - for freeing resources and similar tasks. Now I have a bit of a problem with getting a real destructor, not just a method that does some stuff without affecting object's existence at all. I want to kill an object so that every reference to that object anywhere becomes null - is that at all possible? Or do I have to keep track inside of the object of all possible references to it and free them from Dispose? Is there any way to force GC to kill the object?
|
|
|
|
|
Microsoft have a good marketing strategy that is true. But don't think microsoft playing marketing strategy in technologies that they are providing to developers. If so their product own survive in this competative industry. This is the first thing you need to know. This is fact (Don't worry i am not working for MS Corp).
See here you didn't mention which laguage that you are using to do deterministic destruction. So please specify that language first.
One more thing , here in CP we have an article which will deals the Diterministic Destruction. It's actually in MC++ by some other. Cool;)
Sreejith Nair
[ My Articles ]
|
|
|
|
|
"Microsoft have a good marketing strategy that is true. But don't think microsoft playing marketing strategy in technologies that they are providing to developers. If so their product own survive in this competative industry. This is the first thing you need to know. This is fact (Don't worry i am not working for MS Corp)."
______________________________________________
Don't worry - I wouldn't hold it against you. I consider MS to be the best software company there is (which is not to say "ideal" or "fair"). But as a matter of fact I *do* think that they are tweaking programming languages for marketing purposes. I fail to see any other possible reason for removing keyword "delete" from a programming language other than to boast about GC doing all the work for you. It doesn't and writing destructors is absurdly complicated with .NET documentation trying to scare you into not doing it, quoting some huge performance overheads. What (non) quality IDisposable offers... well - I've already stated my opinion.
"See here you didn't mention which laguage that you are using to do deterministic destruction. So please specify that language first. "
______________________________________________
Er... but i *did* post the message in C# forum, now didn't I? C# obviously.
"One more thing , here in CP we have an article which will deals the Diterministic Destruction. It's actually in MC++ by some other. Cool"
______________________________________________
Yeah, read it. Won't help me much. As there apparently is absolutely no way of clearing the memory manualy, well... I guess I'll just have to provide some instance managers for essential objects. Geez, how much time I save thanks to the whole autoGC idea - amazing, isn't it?
Thanks anyway.
|
|
|
|
|
nurglitch wrote:
I fail to see any other possible reason for removing keyword "delete" from a programming language other than to boast about GC doing all the work for you
Java doesn't have a delete operator either. Was that for marketing purposes? Magik doesn't have a delete operator (and that is one of the most academically oriented commercial languages I've ever used), was that for marketing purposes?
nurglitch wrote:
What (non) quality IDisposable offers... well - I've already stated my opinion.
Can you give me an example in another language where if you delete an object all references to it instantly change to null?
Perhaps you should look at using a WeakReference[^].
Do you want to know more?
Vogon Building and Loan advise that your planet is at risk if you do not keep up repayments on any mortgage secured upon it. Please remember that the force of gravity can go up as well as down.
|
|
|
|
|
Can you give me an example in another language where if you delete an object all references to it instantly change to null?
I second Colin's comments; in particular even C++ doesn't do that.
Here's an example of bad code that someone under the contrary illusion might create:
void StupidFunction( SomeObject * o )
{
delete o;
o = null;
}
SomeObject * obj = new SomeObject();
StupidFunction( obj );
if( obj )
{
obj->Bronk();
delete obj;
}
Anyway, what exactly is the problem you are trying to solve? Perhaps there is a good C# idiom to handle that problem, instead of trying to make C# be C++. Are you trying to make sure an object is not used after it is invalid? Then maybe it should have some internal validity checking that is done whenever it is used. Or are you worried about memory usage? If so, then fooling around with GC() still might not help, since the VM may still keep memory from the OS, even in cases where it could return it (keeping it around for other object creation). This is all performance tuning stuff that may not be within your control (and probably shouldn't be). Anyway, even if you could have this ability to delete an object and have all references to it become null, wouldn't that just cause NullReferenceExceptions all over the place? If you have references to an object that you don't know about, then magically "nullifying" them doesn't seem like a great idea.
If you really need to worry about bits and bytes of memory allocation, you probably shouldn't be writing mangaged code; in such cases, I like to create a COM automation library that I can call from C#. You could also just create a "plain old" dll that you call with DllImport.
Once again, it boils down to what exactly you are trying to do.
Matt Gerrans
|
|
|
|
|
Hi!
I´m working on a project where we are making a hook for an other software. Now we have encountered a problem and I would like some help on finding a work-around.
When we are opening a new form in the hook an exception is thrown and the form is destroyed. The exception is a System.TypeInitializationException that says that "The type initializer for "System.Drawing.SafeNativeMethods" threw an exception. -->System.NullreferenceException: Object reference not set to an instance of an object".
I have traced the exception into the InitializeComponent() method and it is thrown when the first component on the form is initialized. This exception does not appere every time, but once in a while. I can not see any real reason for the problem and we are not doing any different when it works and does not.
I have searched the net and found others that have had the same problem, mut I have not found any good solution. The problem seems to be in GDI+, at least that is what how I have understod it when reading posts on other forums..
The application loading the hook is creating appDomains for all hooks so that it can unload them as it whishes, I think that this might be the root of the problem, or? We would really need to show this form, its for configuring the hook, and the main application really needs to unload the hooks now and then, so the problem is a fact.
Is there any good work-around for this? Is there anything we can do to solve this problem without having to make changes in the main application?
All help appriciated!
Regards Mikael
|
|
|
|
|
Hi,
I have created a domain user through code using ActiveDs. I want to add that user to administrative group using c#.
i have to do the same in workgroup environment also
Please help me to solve this problem
Thanks in advance
Regards
Subin
|
|
|
|
|
I have tried passing variables (strings) by reference to a new, daughter form where the values will be manipulated. This works and the new values are clearly seen on the parent form during debuging. BUT, when the daughter form is closed the modified values are lost and the parent form has only the origional values.... can this be correct? Is this by design (an 'undocumented feature') or have I missed something important here?
Peter Beedell
"Remember that age and treachery will always triumph over youth and ability." Quoted from the BBC Comedy 'The Office'.
|
|
|
|
|
This is all be designed, and well-documented if you read the .NET Framework SDK. While a String is a reference type (and, hence, always passed by reference - at least in C#), it is immutable; any changes you make to the string are actually made on a copy. Why do you think that methods like String.Replace return a string?
If you want to modify a string from a method in a child class, either return a string from your method or default an out or ref parameter like so:
using System;
class Test
{
static void Main()
{
string value = "Hello, world!";
Console.WriteLine(value);
value.Replace("Hello", "Guten tag");
Console.WriteLine(value);
Change(ref value);
Console.WriteLine(value);
}
static void Change(ref string value)
{
value = "Tschuss!";
}
} For value types - numbers, enumerations, and structures - they are always passed by value, so you have declare value type parameters using out or ref if you plan on changing their values.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|