|
Hi. Thanks for the reply.
Yeah, I've already got a lot of drawing going on, but I'm just using the Pain(t) events Graphics object for now and I cant find anything that will give ne a graphics object pointing to an off screen buffer or Bitmap...
?
Pete
|
|
|
|
|
Just create a Bitmap object, using whichever of its multitude of constructors is most use for you, then if you need a Graphics object use Graphics.FromImage(MyBitmap).
Paul
Life is just a sexually transmitted desease - Matthew Wright (ex-journalist, TV presenter) 10-Oct-02
I finally have a sig! - Paul Riley (part-time deity) 10-Oct-02
|
|
|
|
|
You beauty!
Have now got some piss simple test code working. I didn't even think to look through the static members of the Graphics class.
For anyone else trying this. Heres some Very simple code...
Thanks
Pete
private void ctlSoundScene_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
Bitmap oBitmap = new Bitmap(100, 100 ,e.Graphics);
Graphics oBuffer = Graphics.FromImage(oBitmap);
oBuffer.FillRectangle(new SolidBrush(Color.DarkMagenta), 10,10,30,30);
e.Graphics.DrawImage(oBitmap, 10,10);
...
...
...
|
|
|
|
|
Hi.
In my organisation we want to run an application from a server on the co-workers computers when they log-on to the local intranet, to register that they have loged-on, set the printer connections and so on. In order to be able to do this we want to set the permission level on the machines for the Local Intranet to FullTrust.
I'm trying to create an application that installed locally will do this. I have been able to create a new child codegroup that gives FullTrust to the directory where the inlogg-application is situated, but efforts changing the permission set for the LocalIntranet_Zone is so far without success.
The sample code below shows what I have done:
penumLevels=SecurityManager::PolicyHierarchy();
while (penumLevels->MoveNext())
{
try
{
pPolLevel = __try_cast <policylevel*> (penumLevels->Current);
}
catch(System::InvalidCastException* pcatchException)
{
MessageBox::Show(pcatchException->get_Message());
}
// Positioning at root level
pGroup =pPolLevel->RootCodeGroup;
// Find Machine Level Policy
pstrTmp=pPolLevel->Label->ToString();
if ( pstrTmp->Compare(pstrTmp,"Machine")==0)
{
//Find All Code codegroup
pstrTmp=pGroup->MembershipCondition->ToString();
if(pstrTmp->Compare(pstrTmp,"All code")==0)
{
//Loop through the children to find LocalIntranet_Zone
pList=pGroup->get_Children();
sCount=pList->get_Count();
for(sIndex=0;sIndex<scount;sindex++)
{
="" try
="" pchildgroup="__try_cast" <unioncodegroup*="">(pList->get_Item(sIndex));
}
catch(System::InvalidCastException* pcatchException)
{
MessageBox::Show(pcatchException->get_Message());
}
pstrTmp=pChildGroup->get_Name();
if(pstrTmp->Compare(pstrTmp,"LocalIntranet_Zone")==0)
{
//Getting the FullTrust permission set
pFullPerm=pPolLevel->GetNamedPermissionSet("FullTrust");
//Checking what is the present permission set
pstrTmp=pChildGroup->get_PermissionSetName();
//Create a new policy statement with the desired trust level
Security::Policy::PolicyStatement *pPolicy;
pPolicy=new Security::Policy::PolicyStatement(pFullPerm);
//Set the new policy
pChildGroup->set_PolicyStatement(pPolicy);
//And save changes System::Security::SecurityManager::SavePolicy();
//And again checking what the permission set is
//to make sure it has been changed
pstrTmp=pChildGroup->get_PermissionSetName();
}
}
}
}
}
When I check the name of the permission set the second time it is FullTrust, quite as I want it to only this does not have any impact on the real setting, the local intranet does still not have FullTrust status. Is there something preventing the level from being changed to a higher trustee level or am I missing something?
Best regards
/EnkelIk
|
|
|
|
|
Hey guys,
I'm looking for material depicting the current adoption rate of the .NET framework in the industry. If anyone has come across anything usefull in this regard, I will greatly appreciate it.
- Tariq
|
|
|
|
|
I haven't seen anything but I would imagine that in the current slump it's quite low.
Kevin
|
|
|
|
|
Well how about info on the existing developer movement, i mean what portion of the vb pool going to .net etc. I immagine codeproject should have some info on this.
- Tariq
|
|
|
|
|
I don't recommend switching if you have alot of code to support (existing) or if you are considering porting everything. It's not nearly as easy a migration as Microsoft might have you think. However, if the code you're writing is mostly new, .NET is wonderful, whatever the language. I work for a startup company and there's simply no way we'd ever have met our deadlines if I wrote all our code in VB6 and/or C++.
.NET makes VB wonderful and ASP glorious.
|
|
|
|
|
The following C# code is supposed to be an extended System.Windows.Forms.Panel class that provides a very basic implementation of the panels that Windows XP uses (when you take away the folder view in Explorer).
CollapsiblePanel simply contains two labels, one docked to the top for a title, and another anchored to the top right to display an expand/collapse image (the ImageList is exposed as a public property of the class).
At first glance, when you add a CollapsiblePanel to a Form it looks fine and seems to work okay. However, as soon as you add controls to the panel, the top right label with the image disappears
Any ideas why?
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;
namespace Salamander.Windows.Forms
{
public class CollapsiblePanel : System.Windows.Forms.Panel
{
private System.ComponentModel.IContainer components;
private System.Windows.Forms.Label labelExpand;
private System.Windows.Forms.Label labelTitle;
private int panelHeight;
#region Windows Form Designer generated code
private void InitializeComponent()
{
this.labelTitle = new System.Windows.Forms.Label();
this.labelExpand = new System.Windows.Forms.Label();
this.SuspendLayout();
this.labelTitle.BackColor = System.Drawing.SystemColors.ActiveCaption;
this.labelTitle.Cursor = System.Windows.Forms.Cursors.Default;
this.labelTitle.Dock = System.Windows.Forms.DockStyle.Top;
this.labelTitle.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.labelTitle.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
this.labelTitle.Name = "labelTitle";
this.labelTitle.Size = new System.Drawing.Size(200, 24);
this.labelTitle.TabIndex = 0;
this.labelTitle.Text = "Title";
this.labelTitle.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.labelExpand.Anchor = (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right);
this.labelExpand.BackColor = System.Drawing.SystemColors.ActiveCaption;
this.labelExpand.Cursor = System.Windows.Forms.Cursors.Hand;
this.labelExpand.Location = new System.Drawing.Point(17, 17);
this.labelExpand.Name = "labelExpand";
this.labelExpand.Size = new System.Drawing.Size(24, 24);
this.labelExpand.TabIndex = 1;
this.labelExpand.Click += new System.EventHandler(this.labelExpand_Click);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.labelTitle,
this.labelExpand});
this.ResumeLayout(false);
}
#endregion
public CollapsiblePanel() : base()
{
this.components = new System.ComponentModel.Container();
InitializeComponent();
this.BackColor = SystemColors.ControlLightLight;
this.labelExpand.Location = new System.Drawing.Point(this.Width - this.labelExpand.Width, 0);
this.labelExpand.BringToFront();
this.panelHeight = this.Height;
}
[Category("Title")]
public string TitleText
{
get
{
return this.labelTitle.Text;
}
set
{
this.labelTitle.Text = value;
}
}
[Category("Title")]
public Color TitleBackColour
{
get
{
return this.labelTitle.BackColor;
}
set
{
this.labelTitle.BackColor = value;
this.labelExpand.BackColor = value;
}
}
[Category("Title")]
public Color TitleForeColour
{
get
{
return this.labelTitle.ForeColor;
}
set
{
this.labelTitle.ForeColor = value;
}
}
[Category("Title")]
public Font TitleFont
{
get
{
return this.labelTitle.Font;
}
set
{
this.labelTitle.Font = value;
}
}
[Category("Title")]
public ImageList ImageList
{
get
{
return this.labelExpand.ImageList;
}
set
{
this.labelExpand.ImageList = value;
}
}
[Category("Title")]
public int ImageIndex
{
get
{
return this.labelExpand.ImageIndex;
}
set
{
this.labelExpand.ImageIndex = value;
}
}
private void labelExpand_Click(object sender, System.EventArgs e)
{
if((null != labelExpand.ImageList) && (labelExpand.ImageList.Images.Count >=2))
{
if(0 == labelExpand.ImageIndex)
{
this.panelHeight = this.Height;
this.Height = labelTitle.Height;
labelExpand.ImageIndex = 1;
}
else
{
this.Height = this.panelHeight;
labelExpand.ImageIndex = 0;
}
}
}
}
}
Derek Lakin.
I wish I was what I thought I was when I wished I was what I am.
Salamander Software Ltd.
|
|
|
|
|
You may want to contact Nnamdi Onyeyiri. He's done a panel bar just like Windows XP's. He's still working out a few bugs, but I'm sure that he'd be glad to help you out.
Norm Almond: I seen some GUI's in my life but WTF is this mess
Leppie: I made an app for my sister and she wouldnt use it till it was colorful enough
Norm:good point leppie, from that statement I can only deduce that this GUI must be aimed at children
Leppie:My sister is 25
-Norm on the MailMagic GUI
|
|
|
|
|
|
Hi.
I can't recreate your exact problem but I've got it working, as I think you want. There are a couple of things I've changed.
I think you were having trouble with the parent form calling SuspendLayout while it set the properties of you Panel. All I've really done is added an event handler for the Resize event of you panel. It now explicitly sets the position of the labelExpand control.
Also, added a touch of code to the ImageList set. Just displays the first item when an ImageList is assigned to it.
Other than that, it works ok. I can put other controls on it no problem and it expands/contracts correctly.
One thing I dont like about C# is everyones tendancy to write
this.blah = this.control.property.blah;
when this would be prefectly readable
blah = control.property.blah;
The full source follows...(minus the Namespace) Hope this helps.
Unless your more adept with the IDE your going to have to paste this all into a new HTML doc and then copy/paste out from there into a c# doc. Pasting straight from IE to the c# class always removes all the CRLFs for me
Pete Bassett
public class CollapsablePanel : System.Windows.Forms.Panel
{
private System.ComponentModel.IContainer components;
private System.Windows.Forms.Label labelExpand;
private System.Windows.Forms.Label labelTitle;
private int panelHeight;
#region Windows Form Designer generated code
private void InitializeComponent()
{
this.labelTitle = new System.Windows.Forms.Label();
this.labelExpand = new System.Windows.Forms.Label();
this.SuspendLayout();
this.labelTitle.BackColor = System.Drawing.SystemColors.ActiveCaption;
this.labelTitle.Cursor = System.Windows.Forms.Cursors.Default;
this.labelTitle.Dock = System.Windows.Forms.DockStyle.Top;
this.labelTitle.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.labelTitle.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
this.labelTitle.Name = "labelTitle";
this.labelTitle.Size = new System.Drawing.Size(200, 24);
this.labelTitle.TabIndex = 0;
this.labelTitle.Text = "Title";
this.labelTitle.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.labelExpand.Anchor = System.Windows.Forms.AnchorStyles.None;
this.labelExpand.BackColor = System.Drawing.SystemColors.ActiveBorder;
this.labelExpand.Cursor = System.Windows.Forms.Cursors.Hand;
this.labelExpand.Location = new System.Drawing.Point(229, 142);
this.labelExpand.Name = "labelExpand";
this.labelExpand.Size = new System.Drawing.Size(24, 24);
this.labelExpand.TabIndex = 1;
this.labelExpand.Click += new System.EventHandler(this.labelExpand_Click);
this.Anchor = System.Windows.Forms.AnchorStyles.None;
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.labelTitle,
this.labelExpand});
this.Resize += new System.EventHandler(this.CollapsablePanel_Resize);
this.ResumeLayout(false);
}
#endregion
public CollapsablePanel() : base()
{
this.components = new System.ComponentModel.Container();
InitializeComponent();
this.BackColor = SystemColors.ControlLightLight;
labelExpand.BringToFront();
}
[Category("Title")]
public string TitleText
{
get
{
return this.labelTitle.Text;
}
set
{
this.labelTitle.Text = value;
}
}
[Category("Title")]
public Color TitleBackColour
{
get
{
return this.labelTitle.BackColor;
}
set
{
this.labelTitle.BackColor = value;
this.labelExpand.BackColor = value;
}
}
[Category("Title")]
public Color TitleForeColour
{
get
{
return this.labelTitle.ForeColor;
}
set
{
this.labelTitle.ForeColor = value;
}
}
[Category("Title")]
public Font TitleFont
{
get
{
return this.labelTitle.Font;
}
set
{
this.labelTitle.Font = value;
}
}
[Category("Title")]
public ImageList ImageList
{
get
{
return this.labelExpand.ImageList;
}
set
{
this.labelExpand.ImageList = value;
if(labelExpand.ImageList != null)
if(labelExpand.ImageList.Images.Count > 1)
ImageIndex = 0;
}
}
[Category("Title")]
public int ImageIndex
{
get
{
return this.labelExpand.ImageIndex;
}
set
{
this.labelExpand.ImageIndex = value;
}
}
private void labelExpand_Click(object sender, System.EventArgs e)
{
if((null != labelExpand.ImageList) && (labelExpand.ImageList.Images.Count >=2))
{
if(0 == labelExpand.ImageIndex)
{
this.panelHeight = this.Height;
this.Height = labelTitle.Height;
labelExpand.ImageIndex = 1;
}
else
{
this.Height = this.panelHeight;
labelExpand.ImageIndex = 0;
}
}
}
private void CollapsablePanel_Resize(object sender, System.EventArgs e)
{
labelExpand.Location = new Point(Width - labelExpand.Width, 0);
}
}
|
|
|
|
|
Thanks very much. I'll take a look when I get to work
Derek Lakin.
I wish I was what I thought I was when I wished I was what I am.
Salamander Software Ltd.
|
|
|
|
|
Hi,
David directed me to this post, i have actually made a version of this, there is a screenshot here[^] as david said, there are a few problems to work out, but if you want the code, its yours.
1001111111011101111100111100101011110011110100101110010011010010 Sonork | 100.21142 | TheEclypse
|
|
|
|
|
It looks great! The source would be much appreciated, thanks
Derek Lakin.
I wish I was what I thought I was when I wished I was what I am.
Salamander Software Ltd.
|
|
|
|
|
http://www.onyeyiri.co.uk/ExplorerBarDemo.zip[^]
hope you like it, unsuprisingly, the controls code is in the file called ExplorerBar.cs, that download is a demo app, showing the current features of it.
NOTE: the errors are as follows, it does not like you switching Colour Schemes on-the-fly [doing this changes the look, but causes other problems], and in the XPTheme mode, it doesnt quite come out with the color of the current xptheme [i suggest using the colour scheme style]. i am wokring on both of these problems.
1001111111011101111100111100101011110011110100101110010011010010 Sonork | 100.21142 | TheEclypse
|
|
|
|
|
Thanks very much. Great stuff
Derek Lakin.
I wish I was what I thought I was when I wished I was what I am.
Salamander Software Ltd.
|
|
|
|
|
Thanks, btw, if you manage to fix those bugs, let me know
1001111111011101111100111100101011110011110100101110010011010010 Sonork | 100.21142 | TheEclypse
|
|
|
|
|
I haven't had chance to look at your bugs (no XP availablity at work and life's too busy at home!), but I have started one of my own, with a different design-time approach: http://www.codeproject.com/useritems/CollapsiblePanelBar.asp[^].
Let me know what you think.
P.S. One thing I did find with your ExplorerBar is that the drawing code is slightly out for the right hand curve. The start position needs to come in a bit.
Derek Lakin.
I wish I was what I thought I was when I wished I was what I am.
Salamander Software Ltd.
|
|
|
|
|
Derek.
Unless you're in this for a learning exercise, I'd use the one Nnamdi has directed you too. It looks great.
Hopefully source will be included and the style fits with your app..
Pete
|
|
|
|
|
|
Quick question: does all .NET runtimes provide a compiler? I saw some compiler classes in the .NET class browser the other night. Is it possible to deploy a .NET application which can compile "anything" without a VS.NET installation?
--
Please state the nature of your medical emergency.
|
|
|
|
|
Jörgen Sigvardsson wrote:
Is it possible to deploy a .NET application which can compile "anything" without a VS.NET installation?
Yes, it is possible to compile VB code (with the vbc.exe compiler) and C# code (with the csc.exe compiler) which are part of the .NET framework.
After all, those 20Mb should have a use, right?
My latest articles:
XOR tricks for RAID data protection
Win32 process suspend/resume tool
|
|
|
|
|
Sweet!
--
Please state the nature of your medical emergency.
|
|
|
|
|
I have an MFC App that is creating a .NET form dynamically. .NET handles the mixed interface properly but the .NET form is independent of the MFC interface. Is it possible to have MFC parent the form properly?
Thanks for any help
|
|
|
|