|
I cannot use other controls. It has to be Picture Box.
But it is mandatory to call drawimage in Paint message.
I want to zoom the image on the button click and display the zoomed image in picture box.
If user clicks 2-3 time it should zoom 2-3 times.
|
|
|
|
|
Message Closed
modified 23-Nov-14 6:15am.
|
|
|
|
|
Hi I have modified the code as below and it is working: -
Bitmap originalBitmap = picturebox.Image;
Bitmap newBitmap = new Bitmap(originalBitmap);
//Creates a new Graphics object from the specified Image object.
Graphics g = Graphics.FromImage(newBitmap);
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.ScaleTransform(Zoomfactor, Zoomfactor);
g.DrawImage(originalBitmap, 0, 0);
picturebox.Image = newBitmap;
Thanks a lot.
|
|
|
|
|
Hi, i started from some example,
http://www.dofactory.com/Patterns/PatternDecorator.aspx#_self1[^]
then added a var in the Component class.
In the end, seems d2 cannot access var,
i mean d2.component.var is not there,
instead it's sth. like d2.base.base.component.var.
This looks different from c++, anyone knows how to get d2.component.var directly ?
using System;
namespace DoFactory.GangOfFour.Decorator.Structural
{
class MainApp
{
static void Main()
{
ConcreteComponent c = new ConcreteComponent(5);
ConcreteDecoratorA d1 = new ConcreteDecoratorA();
ConcreteDecoratorB d2 = new ConcreteDecoratorB();
d1.SetComponent(c);
d2.SetComponent(d1);
d2.Operation();
}
}
abstract class Component
{
public int var; // i added this
public abstract void Operation();
public Component(int n){var = n;} // i added this
}
class ConcreteComponent : Component
{
public ConcreteComponent(int n):base(n){}
public override void Operation()
{
Console.WriteLine("ConcreteComponent.Operation() {0}", var);
}
}
abstract class Decorator : Component
{
protected Component component;
public void SetComponent(Component component)
{
this.component = component;
}
public override void Operation()
{
if (component != null)
{
component.Operation();
}
}
}
class ConcreteDecoratorA : Decorator
{
public override void Operation()
{
base.Operation();
Console.WriteLine("ConcreteDecoratorA.Operation()");
}
}
class ConcreteDecoratorB : Decorator
{
public override void Operation()
{
base.Operation();
AddedBehavior();
Console.WriteLine("ConcreteDecoratorB.Operation()");
}
void AddedBehavior()
{
}
}
}
wow
|
|
|
|
|
Can't read that, won't read that.
However, I'll say that a base class should know nothing about any possible derived classes.
|
|
|
|
|
ok, this is the compiled code, in the end i got "get 0", instead of "get 30".
why ?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace test2
{
class MainApp
{
static void Main()
{
ConcreteComponent c = new ConcreteComponent(5);
ConcreteDecoratorA d1 = new ConcreteDecoratorA();
ConcreteDecoratorB d2 = new ConcreteDecoratorB();
d1.SetComponent(c);
d2.SetComponent(d1);
d2.Operation();
}
}
abstract class Component
{
public int var; // i added this
public Component(int n) { var = n;}
public Component() { var = 0;}
public abstract void Operation();
public void get()
{
Console.WriteLine("get {0}", var);
}
//public Component(int n) { var = n; } // i added this
}
class ConcreteComponent : Component
{
public ConcreteComponent(int n):base(n){}
public override void Operation()
{
Console.WriteLine("ConcreteComponent.Operation()");
}
}
abstract class Decorator : Component
{
protected Component localComponent;
public void SetComponent(Component component)
{
this.localComponent = component;
}
public override void Operation()
{
if (localComponent != null)
{
localComponent.Operation();
}
}
}
class ConcreteDecoratorA : Decorator
{
public override void Operation()
{
base.Operation();
Console.WriteLine("ConcreteDecoratorA.Operation()");
localComponent.var *= 2;
localComponent.get();
}
}
class ConcreteDecoratorB : Decorator
{
public override void Operation()
{
base.Operation();
AddedBehavior();
Console.WriteLine("ConcreteDecoratorB.Operation()");
localComponent.var *= 3;
localComponent.get();
}
void AddedBehavior()
{
Console.WriteLine("AddBehavior()");
}
}
}
wow
|
|
|
|
|
The line public Component(int n){var = n;} is not ok for an abstract class - it contains a public constructor.
For accessing var in d2, use d2.var .
|
|
|
|
|
Hi all,
I'm going to make a dbf file using c#.net , in my case I need to make a dbf file which could be stored on floppy and moved to insurance company , and of course it must be formatted in standard details that informed by the company, and the problem is ....
How to make dbf file in c#? of course for free! I searched google but there is no related result
Thank You
|
|
|
|
|
Make Empty dbf file , and store it in your application resource , or application location
Then fill it with data "Using OleDB" , and copy it to floppy
HINT Code :
OleDbConnection ccc = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filepath.Substring(0, filepath.LastIndexOf("\\")) + ";Extended Properties=dBASE IV;");
ccc.Open();
OleDbCommand cmd1 = new OleDbCommand("Select * From " + filepath + "smsout.dbf", ccc);
OleDbDataReader dr1 = cmd1.ExecuteReader();
if (dr1.HasRows)
{
DataTable dt1 = new DataTable();
dt1.Load(dr1);
}
ccc.Close();
BTW:
Is floppy still in use ?
I know nothing , I know nothing ...
|
|
|
|
|
mersad00 wrote: could be stored on floppy
Your about five years too late.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
But I thought dbfs could only be stored on floppy.
|
|
|
|
|
As far as I can see it's not dependent on storage medium. But I meant that I haven't seen a floppy in years. Useless to have a file no one can use.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Mark Nischalke wrote: to have a file no one can use
I think that's his goal.
|
|
|
|
|
Success by failure
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
in my country floppy is the only medium for some old companies,like insurances and banks
another question? How to make empty dbf files????????
|
|
|
|
|
That's pretty modern. Here in Germany some companies'/authorities' IT departments prevent the introduction of digital dictation and speech recognition by insisting that that must be done without computers, like dictation on tapes. Maybe they fear their backup of the files become to heavy, several tons of punch cards...
|
|
|
|
|
"How to make an empty DBF" ? ...
Get one with data in it and ZAP it ...
|
|
|
|
|
I´m sure the youngsters don´t even know the zap statement
|
|
|
|
|
I don´t believe you .... google finds a lot of things about dbf´s.
And if you search codeproject with the keyword "dbf", you will find an helpful article/project by pascal ganaye
|
|
|
|
|
all you're doing a project: QuickSpark Game C #, use winform .. but do not, who do their own risk can send all files for future reference. Thank. Mail: no.touch@yahoo.com.vn
|
|
|
|
|
Don't post your email to any forum - unless you really like spam. If anyone responds to you, you will get an email (like this one).
Did you know:
That by counting the rings on a tree trunk, you can tell how many other trees it has slept with.
|
|
|
|
|
Help,I have tried to do three days do not risk that. I had no new requests for help. I live in Vietnam
|
|
|
|
|
Why not try and do it yourself? That way, your tutor will not get thirty identical copies of the same code and fail all your asses...
Did you know:
That by counting the rings on a tree trunk, you can tell how many other trees it has slept with.
|
|
|
|
|
chiprom wrote: all you're doing a project: QuickSpark Game C #, use winform
Are you asking a question or giving assignments to us? If assignments then we are not here for that!
chiprom wrote: but do not, who do their own risk can
Sounds like you need help. If so, asking for code without putting/showing effort is not encouraged here. Try first and then post specific issue if you have.
chiprom wrote: Mail: no.touch AT yahoo.com.vn
Don't post your emailid like this. They will just attract spam.
|
|
|
|
|
I am using xtraGrid from DevExpress which doesn't support Resource images for its EmbeddedNavigator buttons. It only support ImageCOllection and ImageIndex. I am asking if there is any way to create the ImageList on Form_Load from the Resources and populate all images and attach the image to the EmbeddedButton but referring to it using the name like _newicon or _editicon?
|
|
|
|