|
Hi,
I have a treeView Control. I am adding a node with text . The text is very large one. It is giveing scroll bar for the tree view but all the text is not visible (the text is very large around 1000characters). How can I change the properties to make the entire text visible.
Karteek
|
|
|
|
|
Why on earth would you put a string that long in a TreeView? That is more like detail that should be displayed on some other control. I'm just saying this because if I saw an application do something like that, the first thought in my head would be "WHAT WERE THE DEV's THINKING WHEN THEY DID THIS?!?!"
Now, the TreeView control doesn't support putting huge strings on multiple lines in a single node. You COULD break up that string into multiple nodes under the same parent node. Or you could attempt to ownerdraw the TreeView, but that's not exactly easy. Another option would be to check out an alternate TreeView control from, say, Infragistics...
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi,
I usually don't have such long strings in my control but in some case I amy get such strings. So I want this.
Karteek.
|
|
|
|
|
You may want it, but would anyone else want to use it?
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi,
Actually I am reading the input for the tree from a file . So I can have any type of text in the file.
Karteek
|
|
|
|
|
Hi
Im creating a service application which has the job of watching if my main application is running.
If my application is not running, I wish to start it, but this is where my problems ocures.
It seems that my service application correctly sees that my program is not running, but when it starts the program it just never shows up.
If i take a look in my process list, the program has been started but the GUI (a simple form) is just never shown.
I have a feeling that its because the process is also started in the context of the windows service, and therefor does not support a GUI.
If i run my code in a standard windows app, it works just fine.
Has anyone got any sugestions?
Heres the code I use to check and start up my application:
Process[] processes = Process.GetProcessesByName("WindowsApplication4");
if(processes.Length != 1)
{
Process tallyMachine = new Process();
tallyMachine.StartInfo.FileName = "C:\\WindowsApplication4\\WindowsApplication4.exe";
tallyMachine.StartInfo.WorkingDirectory = "C:\\WindowsApplication4";
tallyMachine.Start();
}
Any help would be greatly appreciated
Regards
Janus Klok
|
|
|
|
|
Hi,
Try this...
tallyMachine.startInfo.WindowStyle = ProcessWindowStyle.Maximized;
Add this line in your code and see if it works...
Hope this solves your prob...
regards,
Aryadip.
Cheers !! and have a Funky day !!
|
|
|
|
|
Thank you for your sugestion.
I havent tried it thoug as the other solution wich is postet to this problem, solved the problem.
Regards
Janus
|
|
|
|
|
Klok wrote:
I have a feeling that its because the process is also started in the context of the windows service, and therefor does not support a GUI.
Your absolutely right! This IS what's happening!
To fix this this, try going into the Services manager, click the Properties of your service, change the logon to "Local System Account", then enable "Allow service to interact with desktop". This should take care it.
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Great
This works absolutly perfect.
Thank you very much.
Regards
Janus
|
|
|
|
|
Another alternative is to set the credentials of the service to a user with "Log on Locally" and "Log in as a Service" rights. What Dave said is perfectly fine, but it runs with SYSTEM privileges. Just something to think about depending on what your application does.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I'am trying to retrieve a graphics object from an image object using the piece of code given below
Graphics GDC = Graphics.Getimage(objImage)
But it is throwing the exception...graphics cannot b retrieved from an image having INDEXED PIXEL FORMAT.Cud u tell me the reason y???
Nature of my work:
I'am trying 2 draw some shapes on 2 an image in a picturebox control.After drawing the image i need 2 rotate the image.While rotating i need my drawings also 2 b rotated.
I have tried it with all sort of transformations and then also itz not working.So i thought of retrieving the graphics object from the image and draw the shape(rectangle) using that so that while i'am rotating the image the drawing is also rotated.
Pleez help me as i'm less xperienced in C#
Regards,
MMX
|
|
|
|
|
|
Then how do u retrieve the graphics handle of an image object which is having an indexed pixel format!!!!
Regards,
Mmx
|
|
|
|
|
Hi,
Has anyone made some examples/functions for combining bitmaps? I have one simple program that can seperates a color picture into C,M,Y,K colors picture.
Now I want to combine these pictures into one picture under C#, and finally convert it to *.jpg.
So anyone knows how to do this process..?
THanks for your kindly help..
|
|
|
|
|
|
yes.. it is alpha blend images.
e.g. I used the simple program to seperate the color image into C,M,Y,K 4 images. They are same, but different color seperation layers
Now I wnat to generate a correct color image as same as origion one in C#, and then preview it. I don't know how can I do this blending process..
Can you help me ? Thank you
|
|
|
|
|
Check out Joe Pardue's tutorial on alpha blending here http://www.codeproject.com/cs/media/CsTranspTutorial1.asp
or Rakesh Rajan's article here
http://www.codeproject.com/cs/media/alphafx.asp
|
|
|
|
|
Hello!
I want to create a method that connects to a sql db and retrives some values. I want the connection in a method so I can reuse the code. My question is if I can return a data in the same way you return a string or int? And how do i do this?
|
|
|
|
|
_Searcher_ wrote:
My question is if I can return a data in the same way you return a string or int?
Yes
_Searcher_ wrote:
And how do i do this?
For example:
public DataReader MyMethod()
{
DataReader dr = myCommand.ExecuteDataReader();
return dr;
}
Does this help?
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
The Second EuroCPian Event will be in Brussels on the 4th of September
|
|
|
|
|
Well the earlier response I guess answers your question. I just would like to add that you may go through Microsoft Data Application Block(downloadable from Microsoft site) and use their ready made methods to connect to database and retrieve or insert data. It is damn simple to use and very very efficient... believe me... and lines of code???... Imagine writing just 2 lines of code to retrieve data from database...
To give you a picture... the application block manages the connection... you only need to supply the query...
Cheers...
Aryadip.
Cheers !! and have a Funky day !!
|
|
|
|
|
Thanks so much for the answers!
It worked out great. I didnt try the data application block, but I will look in to that later!
|
|
|
|
|
hi
friends i am working with listbox
The problem :Horizontal scroll is not working as expected when i use
OwnerDraw mode
MeasureItemEventHandler
please help
regards
and thank you in advance
/**************** code ************/
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace WindowsApplication1
{
///
/// Summary description for Form1.
///
public class Form1 : System.Windows.Forms.Form
{
///
/// Required designer variable.
///
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
///
/// Clean up any resources being used.
///
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(292, 266);
this.Name = "Form1";
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
}
#endregion
///
/// The main entry point for the application.
///
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void Form1_Load(object sender, System.EventArgs e)
{
InitializeOwnerDrawnListBox();
}
internal System.Windows.Forms.ListBox ListBox1;
private void InitializeOwnerDrawnListBox()
{
this.ListBox1 = new System.Windows.Forms.ListBox();
// Set the location and size.
ListBox1.Location = new Point(20, 20);
ListBox1.Size = new Size(100, 100);
// Populate the ListBox.ObjectCollection property
// with several strings, using the AddRange method.
this.ListBox1.Items.AddRange(new object[]{"System.Windows.Forms",
"System.Drawing", "System.Xml", "System.Net", "System.Runtime.Remoting",
"System.Web"});
// Turn off the scrollbar.
ListBox1.ScrollAlwaysVisible = true;
// Set the border style to a single, flat border.
//ListBox1.BorderStyle = BorderStyle.FixedSingle;
// Set the DrawMode property to the OwnerDrawVariable value.
// This means the MeasureItem and DrawItem events must be
// handled.
ListBox1.DrawMode = DrawMode.OwnerDrawVariable;
ListBox1.MeasureItem +=
new MeasureItemEventHandler(ListBox1_MeasureItem);
ListBox1.DrawItem += new DrawItemEventHandler(ListBox1_DrawItem);
this.Controls.Add(this.ListBox1);
}
// Handle the DrawItem event for an owner-drawn ListBox.
private void ListBox1_DrawItem(object sender, DrawItemEventArgs e)
{
// If the item is the selected item, then draw the rectangle
// filled in blue. The item is selected when a bitwise And
// of the State property and the DrawItemState.Selected
// property is true.
if ((e.State & DrawItemState.Selected) == DrawItemState.Selected)
{
e.Graphics.FillRectangle(Brushes.CornflowerBlue, e.Bounds);
}
else
{
// Otherwise, draw the rectangle filled in beige.
e.Graphics.FillRectangle(Brushes.Beige, e.Bounds);
}
// Draw a rectangle in blue around each item.
e.Graphics.DrawRectangle(Pens.Blue, e.Bounds);
// Draw the text in the item.
e.Graphics.DrawString(ListBox1.Items[e.Index].ToString(),
this.Font, Brushes.Black, e.Bounds.X, e.Bounds.Y);
// Draw the focus rectangle around the selected item.
e.DrawFocusRectangle();
}
// Handle the MeasureItem event for an owner-drawn ListBox.
private void ListBox1_MeasureItem(object sender,
MeasureItemEventArgs e)
{
// Cast the sender object back to ListBox type.
ListBox theListBox = (ListBox) sender;
// Get the string contained in each item.
string itemString = (string) theListBox.Items[e.Index];
// Split the string at the " . " character.
string[] resultStrings = itemString.Split('.');
// If the string contains more than one period, increase the
// height by ten pixels; otherwise, increase the height by
// five pixels.
if (resultStrings.Length>2)
{
e.ItemHeight += 10;
//theListBox.HorizontalScrollbar = true ;
}
else
{
e.ItemHeight += 5;
}
e.ItemWidth +=100000 ;
}
}
}
P.S. PATWAL
|
|
|
|
|
hi,
I guess you need to set the
"listBox1.HorizontalScrollbar = true"
property of the ListBox... and that will do the magic...
regards,
Aryadip.
Cheers !! and have a Funky day !!
|
|
|
|
|
i did that !!!! for c#'s sake !!!
check the code
P.S. PATWAL
|
|
|
|